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.
30 $#ARGV == 0 or die "usage: $0 FILE";
32 my $dir = dirname
($in);
33 open(IN
, $in) or die "open $in: $!";
34 chdir($dir) or die "chdir $dir: $!";
37 if (/^(disable |(tcg) |(vcpu) )*([a-z_0-9]+)\(/i) {
39 $pat .= '_tcg' if defined $2;
40 open GREP
, '-|', 'git', 'grep', '-lw',
41 defined $3 ?
() : ('--max-depth', '1'),
43 or die "run git grep: $!";
44 while (my $fname = <GREP
>) {
46 next if $seen{$fname} || $fname eq 'trace-events';
48 push @files, "# $fname\n";
51 die "close git grep: $!"
55 } elsif (/^# ([^ ]*\.[ch])$/) {
59 warn "unintelligible line";
65 close(IN
) or die "close $in: $!";