[PATCH 2/2] trim: Invert the meaning of the --calls argument.

Eric Anholt eric at anholt.net
Tue Sep 4 12:28:41 PDT 2012


When you're trying to actually do trimming, you're identifying some
class of things to remove ("all the rendering between the load screen
and the frame that had the bug" or "all the rendering after the frame
that had the bug"), and asking trim to remove them (like the command
name suggests).

Without this, while trying to debug large app trims we were faced with
passing some callset to apitrace dump, processing it with "cut",
running it through a python script to invert the set, and then failing
to run apitrace trim because the argument describing the set was too
large.
---
 cli/cli_trim.cpp    |    4 ++--
 gui/trimprocess.cpp |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cli/cli_trim.cpp b/cli/cli_trim.cpp
index d944682..0010855 100644
--- a/cli/cli_trim.cpp
+++ b/cli/cli_trim.cpp
@@ -47,7 +47,7 @@ usage(void)
         << synopsis << "\n"
         "\n"
         "    -h, --help               show this help message and exit\n"
-        "        --calls=CALLSET      only retain specified calls\n"
+        "        --calls=CALLSET      only remove specified calls\n"
         "        --thread=THREAD_ID   only retain calls from specified thread\n"
         "    -o, --output=TRACE_FILE  output trace file\n"
         "\n"
@@ -129,7 +129,7 @@ command(int argc, char *argv[])
 
         trace::Call *call;
         while ((call = p.parse_call())) {
-            if (calls.contains(*call) &&
+            if (!calls.contains(*call) &&
                 (thread == -1 || call->thread_id == thread)) {
                 writer.writeCall(call);
             }
diff --git a/gui/trimprocess.cpp b/gui/trimprocess.cpp
index c23475d..60c5bac 100644
--- a/gui/trimprocess.cpp
+++ b/gui/trimprocess.cpp
@@ -66,9 +66,9 @@ void TrimProcess::start()
     QString outputArgument = outputFormat
                                 .arg(m_trimPath);
 
-    QString callSetFormat = QLatin1String("--calls=0-%1");
+    QString callSetFormat = QLatin1String("--calls=%1-");
     QString callSetArgument = callSetFormat
-                                .arg(m_trimIndex);
+                                .arg(m_trimIndex + 1);
 
     arguments << QLatin1String("trim");
     arguments << outputArgument;
-- 
1.7.10.4



More information about the apitrace mailing list