• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include "VtsTraceProcessor.h"
17 // Usage examples:
18 //   To cleanup trace, <binary> --cleanup <trace file>
19 //   To profile trace, <binary> --profiling <trace file>
20 //   To dedup traces, <binary> --dedup <trace file directory>
21 // Cleanup trace is used to generate trace for replay test, it will replace the
22 // old trace file with a new one of the same format (VtsProfilingRecord).
23 //
24 // Profile trace will calculate the latency of each API recorded in the trace
25 // and print them out with the format api:latency. e.g.
26 //   open:150231474
27 //   write:842604
28 //   coreInitialized:30466722
29 //
30 // Dedup trace is used to remove all duplicate traces under the given directory.
31 // A trace is considered duplicated if there exists a trace that contains the
32 // same API call sequence as the given trace and the input parameters for each
33 // API call are all the same.
main(int argc,char * argv[])34 int main(int argc, char* argv[]) {
35   if (argc == 3) {
36     android::vts::VtsTraceProcessor trace_processor;
37     if (!strcmp(argv[1], "--cleanup")) {
38       trace_processor.CleanupTraceForReplay(argv[2]);
39     } else if (!strcmp(argv[1], "--profiling")) {
40       trace_processor.ProcessTraceForLatencyProfiling(argv[2]);
41     } else if (!strcmp(argv[1], "--dedup")) {
42       trace_processor.DedupTraces(argv[2]);
43     } else {
44       fprintf(stderr, "Invalid argument.\n");
45       return -1;
46     }
47   } else {
48     fprintf(stderr, "Invalid argument.\n");
49     return -1;
50   }
51   return 0;
52 }
53