2 # Copyright (C) 2013 Red Hat, Inc.
5 # Markus Armbruster <armbru@redhat.com>
7 # This work is licensed under the terms of the GNU GPL, version 2 or
8 # later. See the COPYING file in the top-level directory.
10 # Usage: cleanup-trace-events.pl trace-events
12 # Print cleaned up trace-events to standard output.
27 $#ARGV == 0 or die "usage: $0 FILE";
29 my $dir = dirname
($in);
30 open(IN
, $in) or die "open $in: $!";
31 chdir($dir) or die "chdir $dir: $!";
34 if (/^(disable |(tcg) |vcpu )*([a-z_0-9]+)\(/i) {
36 $pat .= '_tcg' if (defined $2);
37 open GREP
, '-|', 'git', 'grep', '-lw', '--max-depth', '1', $pat
38 or die "run git grep: $!";
39 while (my $fname = <GREP
>) {
41 next if $seen{$fname} || $fname eq 'trace-events';
43 $buf = "# $fname\n" . $buf;
46 die "close git grep: $!"
50 } elsif (/^# ([^ ]*\.[ch])$/) {
54 warn "unintelligible line";
60 close(IN
) or die "close $in: $!";