-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathgcov-report.pl
executable file
·46 lines (41 loc) · 992 Bytes
/
gcov-report.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl
# runs gcov, and produces a coverage report
foreach $_ (qx/find . -name "*.cc" -exec gcov -o . -r {} \\;/)
{
if (/^File/)
{
# ignore header files
if (/.cd'$/ || /.h'$/)
{
$ignore=1;
next;
}
else
{
$ignore=0;
}
($name)=/File '(.*)'/;
}
if (!$ignore && /^Lines/)
{
($time,$lines)=/Lines executed:(.*)% of (.*)/;
$times{$name}=$time;
if ($name=~/\//)
{
($dir)=$name=~/(.*)\//;
$dir_exec{$dir}+=0.01*$time*$lines;
$dir_total{$dir}+=$lines;
}
$exec+=0.01*$time*$lines;
$total+=$lines;
}
}
print "Total exec $exec of $total = ",100*$exec/$total,"%\n";
foreach $dir (keys %dir_exec)
{
print "$dir: $dir_exec{$dir} of $dir_total{$dir} = ",100*$dir_exec{$dir}/$dir_total{$dir},"%\n";
}
foreach $name (sort(keys %times))
{
print "$name $times{$name}%\n";
}