From 09b00108069f16a6a654b88b4d87fbd3f566f2f0 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Tue, 1 Jan 2013 20:56:16 -0800 Subject: script: Add a script to display testsuite runtime sorted Signed-off-by: Matthieu Patou Reviewed-By: Andrew Bartlett --- script/show_testsuite_time | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 script/show_testsuite_time (limited to 'script') diff --git a/script/show_testsuite_time b/script/show_testsuite_time new file mode 100755 index 0000000000..40153218f5 --- /dev/null +++ b/script/show_testsuite_time @@ -0,0 +1,40 @@ +#!/usr/bin/env perl +use Time::Local ('timegm'); +my $in = STDIN; +use strict; + +my $intest=0; +my $name; +my $start=0; +my $end=0; +my %hash; +my $fh; +if ($#ARGV >= 0) { + open($fh, "<", $ARGV[0]) || die "can't open ".$ARGV[0]; +} else { + $fh = $in; +} +while(<$fh>) +{ + if (m/^testsuite: (.*)/) { + $intest = 1; + $name = $1; + } + if (m/testsuite-\w+:/) { + $hash{"$name -> ".($end - $start)} = $end - $start; + $intest = 0; + $start = 0; + } + if (m/^time: (\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/ && $intest) { + my $ts=timegm($6,$5,$4,$3,$2 - 1,$1 - 1900); + if ($start == 0) { + $start = $ts; + } else { + $end = $ts; + } + } +} +my @sorted = sort { $hash{$a}<=>$hash{$b} } keys(%hash); +for my $l (@sorted) { + print $l."\n"; +} -- cgit