|
From: <sv...@va...> - 2016-11-11 14:22:40
|
Author: philippe
Date: Fri Nov 11 14:22:34 2016
New Revision: 16125
Log:
Small changes in callgrind_annotate and callgrind manual
* callgrind_annotate: ignore the lines giving the long names of the
events: such lines are used by kcachegrind for the GUI, so are better
accepted (and ignored) by callgrind_annotate
* Document in callgrind_annotate manual that thresholds can be given
per event kind.
* Avoid a division by zero in callgrind_annotate, for 'special data'
such as produced by (some) xtrees.
Modified:
trunk/callgrind/callgrind_annotate.in
trunk/callgrind/docs/cl-manual.xml
Modified: trunk/callgrind/callgrind_annotate.in
==============================================================================
--- trunk/callgrind/callgrind_annotate.in (original)
+++ trunk/callgrind/callgrind_annotate.in Fri Nov 11 14:22:34 2016
@@ -429,6 +429,9 @@
$has_line = ($positions =~ /line/);
$has_addr = ($positions =~ /(addr|instr)/);
}
+ elsif (/^event:\s+.*$/) {
+ # ignore lines giving a long name to an event
+ }
elsif (/^events:\s+(.*)$/) {
$events = $1;
@@ -1216,9 +1219,17 @@
if ($did_annotations) {
my $percent_printed_CC;
foreach (my $i = 0; $i < @$summary_CC; $i++) {
- $percent_printed_CC->[$i] =
- sprintf("%.0f",
- $printed_totals_CC->[$i] / $summary_CC->[$i] * 100);
+ # Some files (in particular the files produced by --xtree-memory)
+ # have non additive self costs, so have a special case for these
+ # to print all functions and also to avoid a division by 0.
+ if ($summary_CC->[$i] == 0
+ || $printed_totals_CC->[$i] > $summary_CC->[$i]) {
+ $percent_printed_CC->[$i] = "100";
+ } else {
+ $percent_printed_CC->[$i] =
+ sprintf("%.0f",
+ $printed_totals_CC->[$i] / $summary_CC->[$i] * 100);
+ }
}
my $pp_CC_col_widths = compute_CC_col_widths($percent_printed_CC);
print($fancy);
Modified: trunk/callgrind/docs/cl-manual.xml
==============================================================================
--- trunk/callgrind/docs/cl-manual.xml (original)
+++ trunk/callgrind/docs/cl-manual.xml Fri Nov 11 14:22:34 2016
@@ -1257,6 +1257,8 @@
</term>
<listitem>
<para>Sort columns by events A,B,C [event column order].</para>
+ <para>Optionally, each event is followed by a : and a threshold,
+ to specify different thresholds depending on the event.</para>
</listitem>
</varlistentry>
|