- " -b benchmark mode (no error checking or warning messages)\n"
- " -pcpu cpu profiling (cpu times per call)\n"
- " -pgpu gpu profiling (gpu times per draw call)\n"
- " -ppd pixels drawn profiling (pixels drawn per draw call)\n"
- " -c PREFIX compare against snapshots\n"
- " -C CALLSET calls to compare (default is every frame)\n"
- " -core use core profile\n"
- " -db use a double buffer visual (default)\n"
- " -sb use a single buffer visual\n"
- " -s PREFIX take snapshots; `-` for PNM stdout output\n"
- " -S CALLSET calls to snapshot (default is every frame)\n"
- " -v increase output verbosity\n"
- " -D CALLNO dump state at specific call no\n"
- " -w waitOnFinish on final frame\n";
+ " -b, --benchmark benchmark mode (no error checking or warning messages)\n"
+ " --pcpu cpu profiling (cpu times per call)\n"
+ " --pgpu gpu profiling (gpu times per draw call)\n"
+ " --ppd pixels drawn profiling (pixels drawn per draw call)\n"
+ " --pmem memory usage profiling (vsize rss per call)\n"
+ " -c, --compare=PREFIX compare against snapshots with given PREFIX\n"
+ " -C, --calls=CALLSET calls to compare (default is every frame)\n"
+ " --call-nos[=BOOL] use call numbers in snapshot filenames\n"
+ " --core use core profile\n"
+ " --db use a double buffer visual (default)\n"
+ " --driver=DRIVER force driver type (`hw`, `sw`, `ref`, `null`, or driver module name)\n"
+ " --sb use a single buffer visual\n"
+ " -s, --snapshot-prefix=PREFIX take snapshots; `-` for PNM stdout output\n"
+ " -S, --snapshot=CALLSET calls to snapshot (default is every frame)\n"
+ " -v, --verbose increase output verbosity\n"
+ " -D, --dump-state=CALL dump state at specific call no\n"
+ " -w, --wait waitOnFinish on final frame\n"
+ " --singlethread use a single thread to replay command stream\n";
+}
+
+enum {
+ CALL_NOS_OPT = CHAR_MAX + 1,
+ CORE_OPT,
+ DB_OPT,
+ DRIVER_OPT,
+ PCPU_OPT,
+ PGPU_OPT,
+ PPD_OPT,
+ PMEM_OPT,
+ SB_OPT,
+ SINGLETHREAD_OPT,
+};
+
+const static char *
+shortOptions = "bc:C:D:hs:S:vw";
+
+const static struct option
+longOptions[] = {
+ {"benchmark", no_argument, 0, 'b'},
+ {"call-nos", optional_argument, 0, CALL_NOS_OPT },
+ {"calls", required_argument, 0, 'C'},
+ {"compare", required_argument, 0, 'c'},
+ {"core", no_argument, 0, CORE_OPT},
+ {"db", no_argument, 0, DB_OPT},
+ {"driver", required_argument, 0, DRIVER_OPT},
+ {"dump-state", required_argument, 0, 'D'},
+ {"help", no_argument, 0, 'h'},
+ {"pcpu", no_argument, 0, PCPU_OPT},
+ {"pgpu", no_argument, 0, PGPU_OPT},
+ {"ppd", no_argument, 0, PPD_OPT},
+ {"pmem", no_argument, 0, PMEM_OPT},
+ {"sb", no_argument, 0, SB_OPT},
+ {"snapshot-prefix", required_argument, 0, 's'},
+ {"snapshot", required_argument, 0, 'S'},
+ {"verbose", no_argument, 0, 'v'},
+ {"wait", no_argument, 0, 'w'},
+ {"singlethread", no_argument, 0, SINGLETHREAD_OPT},
+ {0, 0, 0, 0}
+};
+
+
+static void exceptionCallback(void)
+{
+ std::cerr << retrace::callNo << ": error: caught an unhandled exception\n";