X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fretrace.cpp;h=bbd10b45c2cd58cb12a5cbe2892675b1c0f25ee8;hb=edea899194c441353943c22577bc22bf0e64d187;hp=1630995cdb440551232c6bdfcd214ea1f61f2abe;hpb=9d27a54b0381610c30964880a5fdd4c27bb6e732;p=apitrace diff --git a/retrace/retrace.cpp b/retrace/retrace.cpp index 1630995..bbd10b4 100644 --- a/retrace/retrace.cpp +++ b/retrace/retrace.cpp @@ -28,18 +28,13 @@ #include #include "os_time.hpp" -#include "trace_dump.hpp" #include "retrace.hpp" namespace retrace { -trace::Parser parser; - - -int verbosity = 0; -bool profiling = false; +trace::DumpFlags dumpFlags = 0; static bool call_dumped = false; @@ -47,7 +42,8 @@ static bool call_dumped = false; static void dumpCall(trace::Call &call) { if (verbosity >= 0 && !call_dumped) { - std::cout << call; + std::cout << std::hex << call.thread_id << std::dec << " "; + trace::dump(call, std::cout, dumpFlags); std::cout.flush(); call_dumped = true; } @@ -89,13 +85,6 @@ void Retracer::addCallbacks(const Entry *entries) { void Retracer::retrace(trace::Call &call) { call_dumped = false; - if (verbosity >= 1) { - if (verbosity >= 2 || - !(call.flags & trace::CALL_FLAG_VERBOSE)) { - dumpCall(call); - } - } - Callback callback = 0; trace::Id id = call.sig->id; @@ -119,20 +108,15 @@ void Retracer::retrace(trace::Call &call) { assert(callback); assert(callbacks[id] == callback); - 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); + if (verbosity >= 1) { + if (verbosity >= 2 || + (!(call.flags & trace::CALL_FLAG_VERBOSE) && + callback != &ignore)) { + dumpCall(call); + } } + + callback(call); }