From: Philippe Waroquiers Date: Sun, 3 Nov 2019 16:09:54 +0000 (+0100) Subject: Have callgrind producing event: lines before events: line. X-Git-Tag: VALGRIND_3_16_0~208 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46cdf576a050c7d40994f2b266c06678f1ac4bee;p=thirdparty%2Fvalgrind.git 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. --- diff --git a/callgrind/dump.c b/callgrind/dump.c index f95bdb5b02..368a740b46 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -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 );