Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation/trace/postprocess/trace-vmscan-postprocess.pl: fix the traceevent regex

When irq, preempt and lockdep fields are printed (field 3 in the example
below) in the trace output, the script fails.

An example entry:
kswapd0-610 [000] ...1 158.112152: mm_vmscan_kswapd_wake: nid=0 order=0

Signed-off-by: Vinayak Menon <vinayakm.list@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Vinayak Menon and committed by
Linus Torvalds
bd727816 da8c757b

+9 -9
+9 -9
Documentation/trace/postprocess/trace-vmscan-postprocess.pl
··· 123 123 124 124 # Static regex used. Specified like this for readability and for use with /o 125 125 # (process_pid) (cpus ) ( time ) (tpoint ) (details) 126 - my $regex_traceevent = '\s*([a-zA-Z0-9-]*)\s*(\[[0-9]*\])\s*([0-9.]*):\s*([a-zA-Z_]*):\s*(.*)'; 126 + my $regex_traceevent = '\s*([a-zA-Z0-9-]*)\s*(\[[0-9]*\])(\s*[dX.][Nnp.][Hhs.][0-9a-fA-F.]*|)\s*([0-9.]*):\s*([a-zA-Z_]*):\s*(.*)'; 127 127 my $regex_statname = '[-0-9]*\s\((.*)\).*'; 128 128 my $regex_statppid = '[-0-9]*\s\(.*\)\s[A-Za-z]\s([0-9]*).*'; 129 129 ··· 270 270 while ($traceevent = <STDIN>) { 271 271 if ($traceevent =~ /$regex_traceevent/o) { 272 272 $process_pid = $1; 273 - $timestamp = $3; 274 - $tracepoint = $4; 273 + $timestamp = $4; 274 + $tracepoint = $5; 275 275 276 276 $process_pid =~ /(.*)-([0-9]*)$/; 277 277 my $process = $1; ··· 299 299 $perprocesspid{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN}++; 300 300 $perprocesspid{$process_pid}->{STATE_DIRECT_BEGIN} = $timestamp; 301 301 302 - $details = $5; 302 + $details = $6; 303 303 if ($details !~ /$regex_direct_begin/o) { 304 304 print "WARNING: Failed to parse mm_vmscan_direct_reclaim_begin as expected\n"; 305 305 print " $details\n"; ··· 322 322 $perprocesspid{$process_pid}->{HIGH_DIRECT_RECLAIM_LATENCY}[$index] = "$order-$latency"; 323 323 } 324 324 } elsif ($tracepoint eq "mm_vmscan_kswapd_wake") { 325 - $details = $5; 325 + $details = $6; 326 326 if ($details !~ /$regex_kswapd_wake/o) { 327 327 print "WARNING: Failed to parse mm_vmscan_kswapd_wake as expected\n"; 328 328 print " $details\n"; ··· 356 356 } elsif ($tracepoint eq "mm_vmscan_wakeup_kswapd") { 357 357 $perprocesspid{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD}++; 358 358 359 - $details = $5; 359 + $details = $6; 360 360 if ($details !~ /$regex_wakeup_kswapd/o) { 361 361 print "WARNING: Failed to parse mm_vmscan_wakeup_kswapd as expected\n"; 362 362 print " $details\n"; ··· 366 366 my $order = $3; 367 367 $perprocesspid{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD_PERORDER}[$order]++; 368 368 } elsif ($tracepoint eq "mm_vmscan_lru_isolate") { 369 - $details = $5; 369 + $details = $6; 370 370 if ($details !~ /$regex_lru_isolate/o) { 371 371 print "WARNING: Failed to parse mm_vmscan_lru_isolate as expected\n"; 372 372 print " $details\n"; ··· 387 387 } 388 388 $perprocesspid{$process_pid}->{HIGH_NR_CONTIG_DIRTY} += $nr_contig_dirty; 389 389 } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") { 390 - $details = $5; 390 + $details = $6; 391 391 if ($details !~ /$regex_lru_shrink_inactive/o) { 392 392 print "WARNING: Failed to parse mm_vmscan_lru_shrink_inactive as expected\n"; 393 393 print " $details\n"; ··· 397 397 my $nr_reclaimed = $4; 398 398 $perprocesspid{$process_pid}->{HIGH_NR_RECLAIMED} += $nr_reclaimed; 399 399 } elsif ($tracepoint eq "mm_vmscan_writepage") { 400 - $details = $5; 400 + $details = $6; 401 401 if ($details !~ /$regex_writepage/o) { 402 402 print "WARNING: Failed to parse mm_vmscan_writepage as expected\n"; 403 403 print " $details\n";