3 # $Id: gcov_resultinterpreter.pl,v 1.3 2005-11-02 17:24:12 kz Exp $
6 # GCOV_RESULTINTERPRETER
8 # Helper, to interpret the result
18 our $version_info = 'gcov helper $Revision: 1.3 $ ';
20 our $help; # Help option flag
21 our $version; # Version option flag
24 our $usedFunctions; # show all functions, which have a value > 0
25 our $nonusedFunctions; # show all functions, which have a value == 0
26 our $nPercent; # show all functions, which have a value > $nPercent
27 our $complete; # show all functions, which have a value == 100
28 our $incomplete; # show all functions, which have a value > 0 && < 100
32 sub read_gcov_function_file
($);
34 # Parse command line options
36 "usedfunctions" => \
$usedFunctions,
37 "nonusedfunctions" => \
$nonusedFunctions,
38 "percent=s" => \
$nPercent,
39 "complete" => \
$complete,
40 "incomplete" => \
$incomplete,
42 "version" => \
$version
49 # Check for help option
56 # Check for version option
59 print("$version_info\n");
63 # check if enough parameters
66 print("No input filename specified\n");
75 # ------------------------------------------------------------------------------
77 my %list = read_gcov_function_file
($ARGV[0]);
82 while (($key, $value) = each %list)
84 # print "function: $key = $value\n";
85 if ($nonusedFunctions)
92 elsif ($usedFunctions)
96 print "$key, $value\n";
101 if ($value >= $nPercent)
103 print "$key, $value\n";
108 if ($value > 0.00 && $value < 100.00)
110 print "$key, $value\n";
115 print "$key, $value\n";
119 # --------------------------------------------------------------------------------
120 # Read the gcov function (gcov -f) file
121 # and compare line by line with the export function list
122 # so we get a list of functions, which are only exported, and not all stuff.
124 sub read_gcov_function_file
($)
131 open(INPUT_HANDLE
, $file)
132 or die("ERROR: cannot open $file!\n");
134 while ($line = <INPUT_HANDLE
>)
137 # sample line (for reg exp:)
138 # 100.00 rtl_ustr_toDouble
139 if ($line =~ /^(.*) (\w+)$/ )
144 $list{$value} = $percent;
151 # ----------------------------------------------------------------------------
154 local *HANDLE
= $_[0];
155 my $tool_name = basename
($0);
157 print(HANDLE
<<END_OF_USAGE);
159 Usage: $tool_name [OPTIONS] INPUTFILE
161 -u, --usedFunctions show all functions, which have a value > 0
162 -n, --nonusedFunctions show all functions, which have a value == 0
163 -p, --percent show all functions, which have a value > percent
164 -c, --complete show all functions, which have a value == 100
165 -i, --incomplete show all functions, which have a value > 0 && < 100
167 -h, --help Print this help, then exit
168 -v, --version Print version number, then exit