[RFC] retrace: add option to profile a single frame
Rob Clark
robdclark at gmail.com
Sat Jul 23 19:39:39 UTC 2016
---
TODO maybe we want to support a range of frames. Not sure that using a
full-blown callset would work well (since there is some assumptions that
retrace::profiling doesn't change within the frame), and not really sure
that is useful.
TODO intention is to use this from qapitrace to have some sort of to
profile the selected frame. Generally, the startup/menu bits of a trace
aren't so interesting. And profiling for all frames tends to run out of
memory on the devices I have. (And trim isn't good enough to work around
that.) Ofc I haven't figured out enough about qt for the GUI bits yet,
so I just recompile glretrace with different hard coded values, so far ;-)
One issue is that the heatmap graph needs to somehow grok that the first
frame in the dataset is not frame #0. Not sure how to fix that yet.
retrace/retrace_main.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/retrace/retrace_main.cpp b/retrace/retrace_main.cpp
index 7aa04b4..7b8d364 100644
--- a/retrace/retrace_main.cpp
+++ b/retrace/retrace_main.cpp
@@ -102,6 +102,7 @@ bool profilingPixelsDrawn = false;
bool profilingMemoryUsage = false;
bool useCallNos = true;
bool singleThread = false;
+int profileFrame = -1;
unsigned frameNo = 0;
unsigned callNo = 0;
@@ -115,6 +116,9 @@ void
frameComplete(trace::Call &call) {
++frameNo;
+ if (profileFrame > 0)
+ profiling = (profileFrame == frameNo);
+
if (!(call.flags & trace::CALL_FLAG_END_FRAME) &&
snapshotFrequency.contains(call)) {
// This call doesn't have the end of frame flag, so take any snapshot
@@ -646,6 +650,7 @@ enum {
PPD_OPT,
PMEM_OPT,
PCALLS_OPT,
+ PFRAME_OPT,
PFRAMES_OPT,
PDRAWCALLS_OPT,
PLMETRICS_OPT,
@@ -681,6 +686,7 @@ longOptions[] = {
{"pgpu", no_argument, 0, PGPU_OPT},
{"ppd", no_argument, 0, PPD_OPT},
{"pmem", no_argument, 0, PMEM_OPT},
+ {"pframe", required_argument, 0, PFRAME_OPT},
{"pcalls", required_argument, 0, PCALLS_OPT},
{"pframes", required_argument, 0, PFRAMES_OPT},
{"pdrawcalls", required_argument, 0, PDRAWCALLS_OPT},
@@ -871,6 +877,9 @@ int main(int argc, char **argv)
retrace::profilingMemoryUsage = true;
break;
+ case PFRAME_OPT:
+ retrace::profileFrame = atoi(optarg);
+ break;
case PCALLS_OPT:
retrace::debug = 0;
retrace::profiling = true;
@@ -940,6 +949,9 @@ int main(int argc, char **argv)
retrace::profiler.setup(retrace::profilingCpuTimes, retrace::profilingGpuTimes, retrace::profilingPixelsDrawn, retrace::profilingMemoryUsage);
}
+ if (retrace::profileFrame >= 0)
+ retrace::profiling = false;
+
os::setExceptionCallback(exceptionCallback);
for (retrace::curPass = 0; retrace::curPass < retrace::numPasses;
--
2.7.4
More information about the apitrace
mailing list