[system] / trunk / webwork2 / bin / timing Repository:
ViewVC logotype

View of /trunk/webwork2/bin/timing

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5319 - (download) (annotate)
Mon Aug 13 22:59:59 2007 UTC (5 years, 10 months ago) by sh002i
File size: 1655 byte(s)
updated copyright dates

    1 #!/usr/bin/env perl
    2 ################################################################################
    3 # WeBWorK Online Homework Delivery System
    4 # Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/
    5 # $CVSHeader: webwork2/bin/timing,v 1.5 2006/01/25 23:13:45 sh002i Exp $
    6 # 
    7 # This program is free software; you can redistribute it and/or modify it under
    8 # the terms of either: (a) the GNU General Public License as published by the
    9 # Free Software Foundation; either version 2, or (at your option) any later
   10 # version, or (b) the "Artistic License" which comes with this package.
   11 # 
   12 # This program is distributed in the hope that it will be useful, but WITHOUT
   13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   14 # FOR A PARTICULAR PURPOSE.  See either the GNU General Public License or the
   15 # Artistic License for more details.
   16 ################################################################################
   17 
   18 use strict;
   19 use warnings;
   20 
   21 use constant ID   => 0;
   22 use constant TIME => 1;
   23 use constant TASK => 2;
   24 use constant DATA => 3;
   25 
   26 my %processes;
   27 
   28 while (<>) {
   29 
   30 	my ($pid, $id, $time, $diff, $task, $data) =
   31 		m/^TIMING\s+(\d+)\s+(\d+)\s+([\d\.]+)\s+(\([\d\.]+\))\s+(.*)\s*:\s*(.*)$/;
   32 	push @{$processes{$pid}}, [$id, $time, $diff, $task, $data] if $pid;
   33 
   34 }
   35 
   36 foreach my $pid (keys %processes) {
   37 	my $indent = -1;
   38 	print "Timing data for PID $pid\n\n";
   39 	my @events = sort { $a->[TIME] <=> $b->[TIME] } @{$processes{$pid}};
   40 	foreach my $event (@events) {
   41 		$indent++ if $event->[DATA] eq "START";
   42 
   43 		print " "x$indent, join(" \t",@$event), "\n";
   44 		$indent-- if $event->[DATA] eq "FINISH";
   45 
   46 	}
   47 	print "\n";
   48 	
   49 }

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9