[PATCH] [perf] Fix parsing of perf-trace summary reports

Arpad Borsos arpad.borsos at googlemail.com
Mon Apr 5 06:53:23 PDT 2010


---
 perf/cairo-perf-report.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/perf/cairo-perf-report.c b/perf/cairo-perf-report.c
index 2029a88..bfb729b 100644
--- a/perf/cairo-perf-report.c
+++ b/perf/cairo-perf-report.c
@@ -206,16 +206,30 @@ test_report_parse (test_report_t *report, char *line, char *configuration)
 	parse_double (median_time);
 	report->stats.median_ticks = median_time * report->stats.ticks_per_ms;
 
-	skip_space ();
+	if(*s == '%') {
+	    /* This is a summary report generated by cairo-perf-trace which omits the
+	     * number of ticks per ms. Just assume 1 in this case.
+	     */
+	    report->stats.ticks_per_ms = 1;
+	    report->stats.median_ticks = min_time;
+	    report->stats.std_dev = median_time / 100.0;
+	} else {
+	    skip_space ();
 
-	parse_double (report->stats.std_dev);
-	report->stats.std_dev /= 100.0;
+	    parse_double (report->stats.std_dev);
+	    report->stats.std_dev /= 100.0;
+	}
 	skip_char ('%');
 
 	skip_space ();
 
 	parse_int (report->stats.iterations);
-
+	if(*s == '/') {
+	    /* Again, this is the output of cairo-perf-trace */
+	    skip_char ('/');
+	    int unused;
+	    parse_int(unused);
+	}
 	skip_space ();
 	skip_char ('\n');
     }
-- 
1.7.0


--------------040406060809040305050608--


More information about the cairo mailing list