void visit(Call *call) {
CallFlags callFlags = call->flags;
+
+ if (!(dumpFlags & DUMP_FLAG_NO_CALL_NO)) {
+ os << call->no << " ";
+ }
if (callFlags & CALL_FLAG_NON_REPRODUCIBLE) {
os << strike;
void dump(Call &call, std::ostream &os, DumpFlags flags) {
Dumper d(os, flags);
- os << call.no << " ";
d.visit(&call);
}
enum {
DUMP_FLAG_NO_COLOR = (1 << 0),
DUMP_FLAG_NO_ARG_NAMES = (1 << 1),
+ DUMP_FLAG_NO_CALL_NO = (1 << 2),
};
print ' glretrace::insideGlBeginEnd = true;'
elif function.name.startswith('gl'):
# glGetError is not allowed inside glBegin/glEnd
- print ' if (!glretrace::benchmark && !glretrace::insideGlBeginEnd) {'
+ print ' if (!glretrace::benchmark && !retrace::profiling && !glretrace::insideGlBeginEnd) {'
print ' glretrace::checkGlError(call);'
if function.name in ('glProgramStringARB', 'glProgramStringNV'):
print r' GLint error_position = -1;'
long long endTime = os::getTime();
float timeInterval = (endTime - startTime) * (1.0 / os::timeFrequency);
- if (retrace::verbosity >= -1) {
+ if ((retrace::verbosity >= -1) || (retrace::profiling)) {
std::cout <<
"Rendered " << frame << " frames"
" in " << timeInterval << " secs,"
"Replay TRACE.\n"
"\n"
" -b benchmark mode (no error checking or warning messages)\n"
+ " -p profiling mode (run whole trace, dump profiling info)\n"
" -c PREFIX compare against snapshots\n"
" -C CALLSET calls to compare (default is every frame)\n"
" -core use core profile\n"
benchmark = true;
retrace::verbosity = -1;
glws::debug = false;
+ } else if (!strcmp(arg, "-p")) {
+ retrace::profiling = true;
+ retrace::verbosity = -1;
+ glws::debug = false;
} else if (!strcmp(arg, "-c")) {
compare_prefix = argv[++i];
if (compare_frequency.empty()) {
#include <string.h>
#include <iostream>
+#include "os_time.hpp"
#include "trace_dump.hpp"
#include "retrace.hpp"
int verbosity = 0;
+bool profiling = false;
static bool call_dumped = false;
assert(callback);
assert(callbacks[id] == callback);
- callback(call);
+ if (retrace::profiling) {
+ long long startTime = os::getTime();
+ callback(call);
+ long long stopTime = os::getTime();
+ float timeInterval = (stopTime - startTime) * (1.0E6 / os::timeFrequency);
+
+ std::cout
+ << call.no << " "
+ << "[" << timeInterval << " usec] "
+ ;
+ trace::dump(call, std::cout, trace::DUMP_FLAG_NO_CALL_NO | trace::DUMP_FLAG_NO_COLOR);
+ } else {
+ callback(call);
+ }
}
*/
extern int verbosity;
+/**
+ * Add profiling data to the dump when retracing.
+ */
+extern bool profiling;
+
std::ostream &warning(trace::Call &call);