Fix verilator_profcfunc on old gprofs.

This commit is contained in:
Wilson Snyder 2018-04-10 22:05:17 -04:00
parent 9219ddaece
commit a46aa2d62b
2 changed files with 9 additions and 1 deletions

View File

@ -1062,7 +1062,7 @@ block or wire statement. (Note this will slow down the executable by ~5%.)
Furthermore, the function name will be suffixed with the basename of the
Verilog module and line number the statement came from. This allows gprof
or oprofile reports to be correlated with the original Verilog source
statements.
statements. See also L<verilator_profcfunc>.
=item --private

View File

@ -73,6 +73,14 @@ sub profcfunc {
$funcs{$func}{sec} += $sec;
$funcs{$func}{calls} += $calls;
}
# Older gprofs have no call column for single-call functions
# %time cumesec selfsec {stuff} name
elsif ($line =~ /^\s*([0-9.]+)\s+[0-9.]+\s+([0-9.]+)\s+[^a-zA-Z_]*([a-zA-Z_].*)$/) {
my $pct=$1; my $sec=$2; my $calls=1; my $func=$3;
$funcs{$func}{pct} += $pct;
$funcs{$func}{sec} += $sec;
$funcs{$func}{calls} += $calls;
}
}
$fh->close;