1 # Copyright (c) 2009 Nicira Networks.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
20 my ($counter) = /^\s*COVERAGE_(?:INC|ADD)\s*\(\s*([a-zA-Z_][a-zA-Z_0-9]*)/
22 push (@{$counters{$counter}}, "$ARGV:$.");
24 # This magic resets $. from one file to the next. See "perldoc -f eof".
29 #include "coverage-counters.h"
36 for my $counter (sort(keys(%counters))) {
37 my $locations = join(', ', @{$counters{$counter}});
40 struct coverage_counter ${counter}_count = { "$counter", 0, 0 };
44 print "struct coverage_counter *coverage_counters[] = {\n";
45 print " \&${_}_count,\n" foreach (sort(keys(%counters)));
47 print "size_t coverage_n_counters = ARRAY_SIZE(coverage_counters);\n";