]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Have callgrind producing event: lines before events: line.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 3 Nov 2019 16:09:54 +0000 (17:09 +0100)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 3 Nov 2019 16:09:54 +0000 (17:09 +0100)
callgrind_annotate expects the 'events:' line to be the last line
of the header of a Part.

When event: lines are after the events: line, these event: lines are
handled by the calllgrind_annotate body line logic, that does not recognises
them and generates warnings such as:
  WARNING: line 18 malformed, ignoring
      line: 'event: sysTime : sysTime (elapsed ns)'
  WARNING: line 19 malformed, ignoring
      line: 'event: sysCpuTime : sysCpuTime (system cpu ns)'

So, output event: lines before events: line.

callgrind/dump.c

index f95bdb5b02c656211911b9bab91115f26ab916a1..368a740b46c1c98476124bb51b2047fbe5c57a0d 100644 (file)
@@ -1301,25 +1301,30 @@ static VgFile *new_dumpfile(int tid, const HChar* trigger)
                CLG_(clo).dump_bb    ? " bb" : "",
                CLG_(clo).dump_line  ? " line" : "");
 
-   /* "events:" line */
+  /* Some (optional) "event:" lines, giving long names to events. */
+   switch (CLG_(clo).collect_systime) {
+     case systime_no: break;
+     case systime_msec:
+        VG_(fprintf)(fp, "event: sysTime : sysTime (elapsed ms)\n");
+        break;
+     case systime_usec:
+        VG_(fprintf)(fp, "event: sysTime : sysTime (elapsed us)\n");
+        break;
+     case systime_nsec:
+        VG_(fprintf)(fp, "event: sysTime : sysTime (elapsed ns)\n");
+        VG_(fprintf)(fp, "event: sysCpuTime : sysCpuTime (system cpu ns)\n");
+        break;
+     default:
+        tl_assert(0);
+   }
+
+   /* "events:" line
+      Note: callgrind_annotate expects the "events:" line to be the last line
+      of the PartData.  In other words, this line is before the first line
+      of the PartData body. */
    HChar *evmap = CLG_(eventmapping_as_string)(CLG_(dumpmap));
    VG_(fprintf)(fp, "events: %s\n", evmap);
    VG_(free)(evmap);
-  switch (CLG_(clo).collect_systime) {
-    case systime_no: break;
-    case systime_msec:
-       VG_(fprintf)(fp, "event: sysTime : sysTime (elapsed ms)\n");
-       break;
-    case systime_usec:
-       VG_(fprintf)(fp, "event: sysTime : sysTime (elapsed us)\n");
-       break;
-    case systime_nsec:
-       VG_(fprintf)(fp, "event: sysTime : sysTime (elapsed ns)\n");
-       VG_(fprintf)(fp, "event: sysCpuTime : sysCpuTime (system cpu ns)\n");
-       break;
-    default:
-       tl_assert(0);
-  }
 
    /* summary lines */
    sum = CLG_(get_eventset_cost)( CLG_(sets).full );