[PATCH] gui: handle the case where first frame isn't frame zero
Rob Clark
robdclark at gmail.com
Mon Jul 25 11:34:42 UTC 2016
This gets the profile view properly zoomed in if we are, for example,
just profiling a single frame from a larger trace.
---
lib/trace/trace_profiler.cpp | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/trace/trace_profiler.cpp b/lib/trace/trace_profiler.cpp
index 65c91aa..5410e87 100644
--- a/lib/trace/trace_profiler.cpp
+++ b/lib/trace/trace_profiler.cpp
@@ -167,6 +167,8 @@ void Profiler::parseLine(const char* in, Profile* profile)
std::string type;
static int64_t lastGpuTime;
static int64_t lastCpuTime;
+ static int64_t firstGpuTime;
+ static int64_t firstCpuTime;
static int64_t lastVsizeUsage;
static int64_t lastRssUsage;
@@ -176,6 +178,8 @@ void Profiler::parseLine(const char* in, Profile* profile)
if (profile->programs.size() == 0 && profile->calls.size() == 0 && profile->frames.size() == 0) {
lastGpuTime = 0;
lastCpuTime = 0;
+ firstGpuTime = 0;
+ firstCpuTime = 0;
lastVsizeUsage = 0;
lastRssUsage = 0;
}
@@ -214,6 +218,11 @@ void Profiler::parseLine(const char* in, Profile* profile)
lastRssUsage = call.rssStart + call.rssDuration;
}
+ if (profile->calls.size() == 0) {
+ firstGpuTime = call.gpuStart;
+ firstCpuTime = call.cpuStart;
+ }
+
profile->calls.push_back(call);
if (call.pixels >= 0) {
@@ -234,8 +243,8 @@ void Profiler::parseLine(const char* in, Profile* profile)
frame.no = unsigned(profile->frames.size());
if (frame.no == 0) {
- frame.gpuStart = 0;
- frame.cpuStart = 0;
+ frame.gpuStart = firstGpuTime;
+ frame.cpuStart = firstCpuTime;
frame.vsizeStart = 0;
frame.rssStart = 0;
frame.calls.begin = 0;
--
2.7.4
More information about the apitrace
mailing list