X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fretrace_main.cpp;fp=retrace%2Fretrace_main.cpp;h=5f5e095a9cbe875b5bc96fa4ae97dbe06e863d71;hb=6d92327e88d2bb4c03a1b84663e50497f99fc24f;hp=2c14b875a788814da4e54e51b13eb725c1cf82ea;hpb=9840c201de08419f5d940642974438917a44d849;p=apitrace diff --git a/retrace/retrace_main.cpp b/retrace/retrace_main.cpp index 2c14b87..5f5e095 100644 --- a/retrace/retrace_main.cpp +++ b/retrace/retrace_main.cpp @@ -54,14 +54,15 @@ trace::Profiler profiler; int verbosity = 0; bool debug = true; -bool profiling = false; -bool profileGPU = false; bool dumpingState = false; - bool doubleBuffer = true; bool coreProfile = false; +bool profiling = false; +bool profilingGpuTimes = false; +bool profilingCpuTimes = false; +bool profilingPixelsDrawn = false; unsigned frameNo = 0; @@ -171,7 +172,7 @@ mainLoop() { long long endTime = os::getTime(); float timeInterval = (endTime - startTime) * (1.0 / os::timeFrequency); - if ((retrace::verbosity >= -1) || (retrace::profiling) || (retrace::profileGPU)) { + if ((retrace::verbosity >= -1) || (retrace::profiling)) { std::cout << "Rendered " << frameNo << " frames" " in " << timeInterval << " secs," @@ -196,8 +197,9 @@ usage(const char *argv0) { "Replay TRACE.\n" "\n" " -b benchmark mode (no error checking or warning messages)\n" - " -p profiling mode (run whole trace, dump profiling info)\n" - " -pgpu gpu profiling mode (run whole trace, dump gpu profiling info)\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" @@ -232,16 +234,6 @@ int main(int argc, char **argv) } else if (!strcmp(arg, "-b")) { retrace::debug = false; retrace::verbosity = -1; - } else if (!strcmp(arg, "-p")) { - retrace::debug = false; - retrace::profiling = true; - retrace::verbosity = -1; - } else if (!strcmp(arg, "-pgpu")) { - retrace::profileGPU = true; - - retrace::debug = false; - retrace::profiling = false; - retrace::verbosity = -1; } else if (!strcmp(arg, "-c")) { comparePrefix = argv[++i]; if (compareFrequency.empty()) { @@ -283,6 +275,18 @@ int main(int argc, char **argv) ++retrace::verbosity; } else if (!strcmp(arg, "-w")) { waitOnFinish = true; + } else if (arg[1] == 'p') { + retrace::debug = false; + retrace::profiling = true; + retrace::verbosity = -1; + + if (!strcmp(arg, "-pcpu")) { + retrace::profilingCpuTimes = true; + } else if (!strcmp(arg, "-pgpu")) { + retrace::profilingGpuTimes = true; + } else if (!strcmp(arg, "-ppd")) { + retrace::profilingPixelsDrawn = true; + } } else { std::cerr << "error: unknown option " << arg << "\n"; usage(argv[0]); @@ -291,6 +295,9 @@ int main(int argc, char **argv) } retrace::setUp(); + if (retrace::profiling) { + retrace::profiler.setup(retrace::profilingCpuTimes, retrace::profilingGpuTimes, retrace::profilingPixelsDrawn); + } for ( ; i < argc; ++i) { if (!retrace::parser.open(argv[i])) {