X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils%2Fbabelstats.pl;h=16766baabd2810412bb27253f5fd5ab9aaaaddb9;hp=53c85d4d0fd6974202adf6a8b0a8db4fafaf51fc;hb=c8e51d1559c48a12f18053997bbcff0c162691c4;hpb=d9c3a893353259c76f6c8083befdf6f401450d86 diff --git a/tests/utils/babelstats.pl b/tests/utils/babelstats.pl index 53c85d4d0..16766baab 100755 --- a/tests/utils/babelstats.pl +++ b/tests/utils/babelstats.pl @@ -92,9 +92,8 @@ sub merge_fields my %merged; foreach my $event (@{$events_ref}) { - my $tp_provider = $event->{'tp_provider'}; - my $tp_name = $event->{'tp_name'}; - my $tracepoint = "$tp_provider:$tp_name"; + my $tp_event = $event->{'tp_event'}; + my $tracepoint = "${tp_event}"; foreach my $key (keys %{$event->{'fields'}}) { my $val = $event->{'fields'}->{$key}; @@ -142,33 +141,18 @@ my @events; while (<>) { - my $timestamp = '\[(.*)\]'; - my $elapsed = '\((.*)\)'; - my $hostname = '.*'; - my $pname = '.*'; - my $pinfo = '.*'; - my $pid = '\d+'; - my $tp_provider = '.*'; - my $tp_name = '.*'; - my $cpu_info = '{\scpu_id\s=\s(\d+)\s\}'; - my $fields = '{(.*)}'; + my $timestamp = '\[(?:.*)\]'; + my $elapsed = '\((?:.*)\)'; + my $hostname = '(?:.*)'; + my $tp_event = '(.*)'; + my $pkt_context = '(?:\{[^}]*\},\s)*'; + my $fields = '\{(.*)\}$'; # Parse babeltrace text output format - if (/$timestamp\s$elapsed\s($pinfo)\s($tp_provider):($tp_name):\s$cpu_info,\s$fields/) { + if (/$timestamp\s$elapsed\s$hostname\s$tp_event:\s$pkt_context$fields/) { my %event_hash; - $event_hash{'timestamp'} = $1; - $event_hash{'elapsed'} = $2; - $event_hash{'pinfo'} = $3; - -# my @split_pinfo = split(':', $3); -# $event_hash{'hostname'} = $split_pinfo[0]; -# $event_hash{'pname'} = defined($split_pinfo[1]) ? $split_pinfo[1] : undef; -# $event_hash{'pid'} = defined($split_pinfo[2]) ? $split_pinfo[2] : undef; - - $event_hash{'tp_provider'} = $4; - $event_hash{'tp_name'} = $5; - $event_hash{'cpu_id'} = $6; - $event_hash{'fields'} = parse_fields($7); + $event_hash{'tp_event'} = $1; + $event_hash{'fields'} = parse_fields($2); push @events, \%event_hash; }