Have callgrind producing event: lines before events: line.

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.
This commit is contained in:
Philippe Waroquiers 2019-11-03 17:09:54 +01:00
parent 5d687db287
commit 46cdf576a0

View 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 );