aboutsummaryrefslogtreecommitdiff
path: root/scripts/cleanup-trace-events.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cleanup-trace-events.pl')
-rwxr-xr-xscripts/cleanup-trace-events.pl23
1 files changed, 14 insertions, 9 deletions
diff --git a/scripts/cleanup-trace-events.pl b/scripts/cleanup-trace-events.pl
index d4f0e4cab5..c40d2fcc50 100755
--- a/scripts/cleanup-trace-events.pl
+++ b/scripts/cleanup-trace-events.pl
@@ -15,12 +15,15 @@ use warnings;
use strict;
use File::Basename;
-my $buf = '';
+my @files = ();
+my $events = '';
my %seen = ();
sub out {
- print $buf;
- $buf = '';
+ print sort @files;
+ print $events;
+ @files = ();
+ $events = '';
%seen = ();
}
@@ -31,16 +34,18 @@ open(IN, $in) or die "open $in: $!";
chdir($dir) or die "chdir $dir: $!";
while (<IN>) {
- if (/^(disable |(tcg) |vcpu )*([a-z_0-9]+)\(/i) {
- my $pat = "trace_$3";
- $pat .= '_tcg' if (defined $2);
- open GREP, '-|', 'git', 'grep', '-lw', '--max-depth', '1', $pat
+ if (/^(disable |(tcg) |(vcpu) )*([a-z_0-9]+)\(/i) {
+ my $pat = "trace_$4";
+ $pat .= '_tcg' if defined $2;
+ open GREP, '-|', 'git', 'grep', '-lw',
+ defined $3 ? () : ('--max-depth', '1'),
+ $pat
or die "run git grep: $!";
while (my $fname = <GREP>) {
chomp $fname;
next if $seen{$fname} || $fname eq 'trace-events';
$seen{$fname} = 1;
- $buf = "# $fname\n" . $buf;
+ push @files, "# $fname\n";
}
unless (close GREP) {
die "close git grep: $!"
@@ -53,7 +58,7 @@ while (<IN>) {
} elsif (!/^#|^$/) {
warn "unintelligible line";
}
- $buf .= $_;
+ $events .= $_;
}
out;