1 // 2 // Copyright 2019 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 // ANGLEPerfTestArgs.cpp: 7 // Parse command line arguments for angle_perftests. 8 // 9 10 #include "ANGLEPerfTestArgs.h" 11 #include <string.h> 12 #include <sstream> 13 14 namespace angle 15 { 16 bool gCalibration = false; 17 int gStepsToRunOverride = -1; 18 bool gEnableTrace = false; 19 const char *gTraceFile = "ANGLETrace.json"; 20 } // namespace angle 21 22 using namespace angle; 23 ANGLEProcessPerfTestArgs(int * argc,char ** argv)24void ANGLEProcessPerfTestArgs(int *argc, char **argv) 25 { 26 int argcOutCount = 0; 27 28 for (int argIndex = 0; argIndex < *argc; argIndex++) 29 { 30 if (strcmp("--one-frame-only", argv[argIndex]) == 0) 31 { 32 gStepsToRunOverride = 1; 33 } 34 else if (strcmp("--enable-trace", argv[argIndex]) == 0) 35 { 36 gEnableTrace = true; 37 } 38 else if (strcmp("--trace-file", argv[argIndex]) == 0 && argIndex < *argc - 1) 39 { 40 gTraceFile = argv[argIndex]; 41 // Skip an additional argument. 42 argIndex++; 43 } 44 else if (strcmp("--calibration", argv[argIndex]) == 0) 45 { 46 gCalibration = true; 47 } 48 else if (strcmp("--steps", argv[argIndex]) == 0 && argIndex < *argc - 1) 49 { 50 unsigned int stepsToRun = 0; 51 std::stringstream strstr; 52 strstr << argv[argIndex + 1]; 53 strstr >> stepsToRun; 54 gStepsToRunOverride = stepsToRun; 55 // Skip an additional argument. 56 argIndex++; 57 } 58 else 59 { 60 argv[argcOutCount++] = argv[argIndex]; 61 } 62 } 63 64 *argc = argcOutCount; 65 } 66