X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Ftrace_profiler.cpp;h=ab29e361220bef7ca93c5e2d5edc0af83d86633e;hb=9840c201de08419f5d940642974438917a44d849;hp=fdc0fd4a2f748c170c464bbd7af12e6852d4f68b;hpb=addf7f90727a50040d79e6da6d59ffb031074674;p=apitrace diff --git a/common/trace_profiler.cpp b/common/trace_profiler.cpp index fdc0fd4..ab29e36 100644 --- a/common/trace_profiler.cpp +++ b/common/trace_profiler.cpp @@ -36,26 +36,42 @@ Profiler::~Profiler() { } -void Profiler::addCall(const Call& call) +void Profiler::addCall(unsigned no, const char *name, uint64_t gpu_start, uint64_t gpu_duration, uint64_t samples_passed) { if (baseTime == 0) - baseTime = call.gpu.start; + baseTime = gpu_start; std::cout << "call " - << call.no << " " - << (call.gpu.start - baseTime) << " " - << call.gpu.duration << " " - << call.name << std::endl; + << no << " " + << (gpu_start - baseTime) << " " + << gpu_duration << " " + << samples_passed << " " + << name << std::endl; } -void Profiler::addFrame(const Frame& frame) +void Profiler::addFrameStart(unsigned no, uint64_t timestamp) { if (baseTime == 0) - baseTime = frame.gpu.start; + baseTime = timestamp; - std::cout << "frame " - << frame.no << " " - << (frame.gpu.start - baseTime) << " " - << frame.gpu.duration << std::endl; + lastFrame.no = no; + lastFrame.start = timestamp - baseTime; + + std::cout << "frame begin " + << lastFrame.no << " " + << lastFrame.start << std::endl; +} + +void Profiler::addFrameEnd(uint64_t timestamp) +{ + if (baseTime == 0) + baseTime = timestamp; + + lastFrame.end = timestamp - baseTime; + + std::cout << "frame end " + << lastFrame.no << " " + << lastFrame.end << " " + << (lastFrame.end - lastFrame.start) << std::endl; } }