#include "retrace.hpp"
-static bool wait = false;
+static bool waitOnFinish = false;
static const char *comparePrefix = NULL;
static const char *snapshotPrefix = NULL;
trace::Parser parser;
+trace::Profiler profiler;
int verbosity = 0;
bool debug = true;
bool profiling = false;
+bool profileGPU = false;
+bool dumpingState = false;
bool doubleBuffer = true;
bool coreProfile = false;
-static unsigned frameNo = 0;
+unsigned frameNo = 0;
void
addCallbacks(retracer);
long long startTime = 0;
+ frameNo = 0;
startTime = os::getTime();
trace::Call *call;
" average of " << (frameNo/timeInterval) << " fps\n";
}
- if (wait) {
+ if (waitOnFinish) {
waitForInput();
} else {
- exit(0);
+ return;
}
}
static void
usage(const char *argv0) {
std::cout <<
- "Usage: " << argv0 << " [OPTION] TRACE\n"
+ "Usage: " << argv0 << " [OPTION] TRACE [...]\n"
"Replay TRACE.\n"
"\n"
" -b benchmark mode (no error checking or warning messages)\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 wait on final frame\n";
+ " -w waitOnFinish on final frame\n";
}
extern "C"
int main(int argc, char **argv)
{
+ using namespace retrace;
+
assert(compareFrequency.empty());
assert(snapshotFrequency.empty());
retrace::debug = false;
retrace::profiling = true;
retrace::verbosity = -1;
+ } else if (!strcmp(arg, "-pgpu")) {
+ retrace::profileGPU = true;
} else if (!strcmp(arg, "-c")) {
comparePrefix = argv[++i];
if (compareFrequency.empty()) {
}
} else if (!strcmp(arg, "-D")) {
dumpStateCallNo = atoi(argv[++i]);
+ dumpingState = true;
retrace::verbosity = -2;
} else if (!strcmp(arg, "-core")) {
retrace::coreProfile = true;
} else if (!strcmp(arg, "-v")) {
++retrace::verbosity;
} else if (!strcmp(arg, "-w")) {
- wait = true;
+ waitOnFinish = true;
} else {
std::cerr << "error: unknown option " << arg << "\n";
usage(argv[0]);
retrace::parser.close();
}
- retrace::cleanUp();
+ // XXX: X often hangs on XCloseDisplay
+ //retrace::cleanUp();
return 0;
}