X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Ftrace_profiler.cpp;h=fd684ede7bf16d623b7b54b9f80e67477aaf8bc8;hb=f91056b5782d48d526f19dacd5a988003fc6f11e;hp=fdc0fd4a2f748c170c464bbd7af12e6852d4f68b;hpb=addf7f90727a50040d79e6da6d59ffb031074674;p=apitrace diff --git a/common/trace_profiler.cpp b/common/trace_profiler.cpp index fdc0fd4..fd684ed 100644 --- a/common/trace_profiler.cpp +++ b/common/trace_profiler.cpp @@ -36,26 +36,41 @@ Profiler::~Profiler() { } -void Profiler::addCall(const Call& call) +void Profiler::addCall(unsigned no, const char *name, uint64_t gpu_start, uint64_t gpu_duration) { 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 << " " + << 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; } }