VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
cb77f0d623ff3 (Kamil Rytarowski    2017-05-07 23:25:26 +0200   1) #!/usr/bin/env perl
c2e30119fe887 (Thomas Gleixner     2019-05-31 01:09:49 -0700   2) # SPDX-License-Identifier: GPL-2.0-only
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700   3) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700   4) # Copyright 2008, Intel Corporation
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700   5) #
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700   6) # This file is part of the Linux kernel
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700   7) #
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700   8) # Authors:
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700   9) # 	Arjan van de Ven <arjan@linux.intel.com>
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  10) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  11) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  12) #
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  13) # This script turns a dmesg output into a SVG graphic that shows which
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  14) # functions take how much time. You can view SVG graphics with various
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  15) # programs, including Inkscape, The Gimp and Firefox.
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  16) #
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  17) #
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  18) # For this script to work, the kernel needs to be compiled with the
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  19) # CONFIG_PRINTK_TIME configuration option enabled, and with
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  20) # "initcall_debug" passed on the kernel command line.
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  21) #
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  22) # usage:
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  23) # 	dmesg | perl scripts/bootgraph.pl > output.svg
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  24) #
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  25) 
2a813f8cd8ce9 (Alan Jenkins        2008-10-14 14:18:07 +0100  26) use strict;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  27) use Getopt::Long;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  28) my $header = 0;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  29) 
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  30) sub help {
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  31) 	my $text = << "EOM";
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  32) Usage:
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  33) 1) dmesg | perl scripts/bootgraph.pl [OPTION] > output.svg
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  34) 2) perl scripts/bootgraph.pl -h
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  35) 
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  36) Options:
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  37) 	-header	Insert kernel version and date
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  38) EOM
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  39) 	my $std=shift;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  40) 	if ($std == 1) {
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  41) 		print STDERR $text;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  42) 	} else {
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  43) 		print $text;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  44) 	}
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  45) 	exit;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  46) }
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  47) 
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  48) GetOptions(
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  49) 	'h|help'	=>\&help,
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  50) 	'header'	=>\$header
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  51) );
2a813f8cd8ce9 (Alan Jenkins        2008-10-14 14:18:07 +0100  52) 
2a813f8cd8ce9 (Alan Jenkins        2008-10-14 14:18:07 +0100  53) my %start;
2a813f8cd8ce9 (Alan Jenkins        2008-10-14 14:18:07 +0100  54) my %end;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  55) my %type;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  56) my $done = 0;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  57) my $maxtime = 0;
c443453c6dc88 (Andrew Murray       2011-06-09 22:40:10 +0100  58) my $firsttime = 99999;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  59) my $count = 0;
ddc7a01aad195 (Frederic Weisbecker 2008-10-04 21:35:48 +0200  60) my %pids;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  61) my %pidctr;
ddc7a01aad195 (Frederic Weisbecker 2008-10-04 21:35:48 +0200  62) 
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  63) my $headerstep = 20;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  64) my $xheader = 15;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  65) my $yheader = 25;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  66) my $cyheader = 0;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200  67) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  68) while (<>) {
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  69) 	my $line = $_;
0bb98e2318038 (Michael Neuling     2009-02-15 10:20:30 +0100  70) 	if ($line =~ /([0-9\.]+)\] calling  ([a-zA-Z0-9\_\.]+)\+/) {
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  71) 		my $func = $2;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  72) 		if ($done == 0) {
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  73) 			$start{$func} = $1;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  74) 			$type{$func} = 0;
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700  75) 			if ($1 < $firsttime) {
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700  76) 				$firsttime = $1;
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700  77) 			}
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  78) 		}
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  79) 		if ($line =~ /\@ ([0-9]+)/) {
ddc7a01aad195 (Frederic Weisbecker 2008-10-04 21:35:48 +0200  80) 			$pids{$func} = $1;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  81) 		}
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  82) 		$count = $count + 1;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  83) 	}
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700  84) 
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  85) 	if ($line =~ /([0-9\.]+)\] async_waiting @ ([0-9]+)/) {
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  86) 		my $pid = $2;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  87) 		my $func;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  88) 		if (!defined($pidctr{$pid})) {
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  89) 			$func = "wait_" . $pid . "_1";
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  90) 			$pidctr{$pid} = 1;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  91) 		} else {
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  92) 			$pidctr{$pid} = $pidctr{$pid} + 1;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  93) 			$func = "wait_" . $pid . "_" . $pidctr{$pid};
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  94) 		}
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  95) 		if ($done == 0) {
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  96) 			$start{$func} = $1;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  97) 			$type{$func} = 1;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  98) 			if ($1 < $firsttime) {
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800  99) 				$firsttime = $1;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 100) 			}
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 101) 		}
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 102) 		$pids{$func} = $pid;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 103) 		$count = $count + 1;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 104) 	}
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 105) 
0bb98e2318038 (Michael Neuling     2009-02-15 10:20:30 +0100 106) 	if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_\.]+)\+.*returned/) {
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 107) 		if ($done == 0) {
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 108) 			$end{$2} = $1;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 109) 			$maxtime = $1;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 110) 		}
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 111) 	}
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 112) 
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 113) 	if ($line =~ /([0-9\.]+)\] async_continuing @ ([0-9]+)/) {
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 114) 		my $pid = $2;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 115) 		my $func =  "wait_" . $pid . "_" . $pidctr{$pid};
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 116) 		$end{$func} = $1;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 117) 		$maxtime = $1;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 118) 	}
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 119) 	if ($line =~ /Write protecting the/) {
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 120) 		$done = 1;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 121) 	}
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700 122) 	if ($line =~ /Freeing unused kernel memory/) {
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700 123) 		$done = 1;
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700 124) 	}
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 125) }
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 126) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 127) if ($count == 0) {
d1aaf8cf8afe7 (Stephen Hemminger   2008-11-13 08:33:00 -0800 128)     print STDERR <<END;
d1aaf8cf8afe7 (Stephen Hemminger   2008-11-13 08:33:00 -0800 129) No data found in the dmesg. Make sure that 'printk.time=1' and
d1aaf8cf8afe7 (Stephen Hemminger   2008-11-13 08:33:00 -0800 130) 'initcall_debug' are passed on the kernel command line.
d1aaf8cf8afe7 (Stephen Hemminger   2008-11-13 08:33:00 -0800 131) END
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200 132) 	help(1);
d1aaf8cf8afe7 (Stephen Hemminger   2008-11-13 08:33:00 -0800 133)     exit 1;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 134) }
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 135) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 136) print "<?xml version=\"1.0\" standalone=\"no\"?> \n";
40c8c85a47552 (Arjan van de Ven    2009-01-04 07:16:38 -0800 137) print "<svg width=\"2000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 138) 
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200 139) 
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200 140) if ($header) {
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200 141) 	my $version = `uname -a`;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200 142) 	my $date = `date`;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200 143) 	print "<text transform=\"translate($xheader,$yheader)\">Kernel version: $version</text>\n";
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200 144) 	$cyheader = $yheader+$headerstep;
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200 145) 	print "<text transform=\"translate($xheader,$cyheader)\">Date: $date</text>\n";
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200 146) }
67554faa7614b (Fabian Frederick    2014-04-02 21:39:52 +0200 147) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 148) my @styles;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 149) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 150) $styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 151) $styles[1] = "fill:rgb(0,255,0);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 152) $styles[2] = "fill:rgb(255,0,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 153) $styles[3] = "fill:rgb(255,255,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 154) $styles[4] = "fill:rgb(255,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 155) $styles[5] = "fill:rgb(0,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 156) $styles[6] = "fill:rgb(0,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 157) $styles[7] = "fill:rgb(0,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 158) $styles[8] = "fill:rgb(255,0,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 159) $styles[9] = "fill:rgb(255,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 160) $styles[10] = "fill:rgb(255,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 161) $styles[11] = "fill:rgb(128,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 162) 
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 163) my $style_wait = "fill:rgb(128,128,128);fill-opacity:0.5;stroke-width:0;stroke:rgb(0,0,0)";
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 164) 
40c8c85a47552 (Arjan van de Ven    2009-01-04 07:16:38 -0800 165) my $mult = 1950.0 / ($maxtime - $firsttime);
40c8c85a47552 (Arjan van de Ven    2009-01-04 07:16:38 -0800 166) my $threshold2 = ($maxtime - $firsttime) / 120.0;
40c8c85a47552 (Arjan van de Ven    2009-01-04 07:16:38 -0800 167) my $threshold = $threshold2/10;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 168) my $stylecounter = 0;
ddc7a01aad195 (Frederic Weisbecker 2008-10-04 21:35:48 +0200 169) my %rows;
ddc7a01aad195 (Frederic Weisbecker 2008-10-04 21:35:48 +0200 170) my $rowscount = 1;
06d1cd267ca0a (Alan Jenkins        2008-10-14 14:19:15 +0100 171) my @initcalls = sort { $start{$a} <=> $start{$b} } keys(%start);
68f96c0c889b5 (Stephen Hemminger   2008-11-12 10:21:01 -0800 172) 
68f96c0c889b5 (Stephen Hemminger   2008-11-12 10:21:01 -0800 173) foreach my $key (@initcalls) {
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 174) 	my $duration = $end{$key} - $start{$key};
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 175) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 176) 	if ($duration >= $threshold) {
40c8c85a47552 (Arjan van de Ven    2009-01-04 07:16:38 -0800 177) 		my ($s, $s2, $s3, $e, $w, $y, $y2, $style);
2a813f8cd8ce9 (Alan Jenkins        2008-10-14 14:18:07 +0100 178) 		my $pid = $pids{$key};
07d1890420cce (Frederic Weisbecker 2008-10-04 21:35:48 +0200 179) 
07d1890420cce (Frederic Weisbecker 2008-10-04 21:35:48 +0200 180) 		if (!defined($rows{$pid})) {
07d1890420cce (Frederic Weisbecker 2008-10-04 21:35:48 +0200 181) 			$rows{$pid} = $rowscount;
07d1890420cce (Frederic Weisbecker 2008-10-04 21:35:48 +0200 182) 			$rowscount = $rowscount + 1;
07d1890420cce (Frederic Weisbecker 2008-10-04 21:35:48 +0200 183) 		}
06d1cd267ca0a (Alan Jenkins        2008-10-14 14:19:15 +0100 184) 		$s = ($start{$key} - $firsttime) * $mult;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 185) 		$s2 = $s + 6;
40c8c85a47552 (Arjan van de Ven    2009-01-04 07:16:38 -0800 186) 		$s3 = $s + 1;
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700 187) 		$e = ($end{$key} - $firsttime) * $mult;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 188) 		$w = $e - $s;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 189) 
ddc7a01aad195 (Frederic Weisbecker 2008-10-04 21:35:48 +0200 190) 		$y = $rows{$pid} * 150;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 191) 		$y2 = $y + 4;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 192) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 193) 		$style = $styles[$stylecounter];
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 194) 		$stylecounter = $stylecounter + 1;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 195) 		if ($stylecounter > 11) {
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 196) 			$stylecounter = 0;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 197) 		};
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 198) 
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 199) 		if ($type{$key} == 1) {
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 200) 			$y = $y + 15;
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 201) 			print "<rect x=\"$s\" width=\"$w\" y=\"$y\" height=\"115\" style=\"$style_wait\"/>\n";
40c8c85a47552 (Arjan van de Ven    2009-01-04 07:16:38 -0800 202) 		} else {
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 203) 			print "<rect x=\"$s\" width=\"$w\" y=\"$y\" height=\"145\" style=\"$style\"/>\n";
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 204) 			if ($duration >= $threshold2) {
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 205) 				print "<text transform=\"translate($s2,$y2) rotate(90)\">$key</text>\n";
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 206) 			} else {
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 207) 				print "<text transform=\"translate($s3,$y2) rotate(90)\" font-size=\"3pt\">$key</text>\n";
d3f8ddea444b3 (Arjan van de Ven    2009-01-10 10:03:05 -0800 208) 			}
40c8c85a47552 (Arjan van de Ven    2009-01-04 07:16:38 -0800 209) 		}
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 210) 	}
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 211) }
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 212) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 213) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 214) # print the time line on top
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700 215) my $time = $firsttime;
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700 216) my $step = ($maxtime - $firsttime) / 15;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 217) while ($time < $maxtime) {
2a813f8cd8ce9 (Alan Jenkins        2008-10-14 14:18:07 +0100 218) 	my $s3 = ($time - $firsttime) * $mult;
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700 219) 	my $tm = int($time * 100) / 100.0;
2a813f8cd8ce9 (Alan Jenkins        2008-10-14 14:18:07 +0100 220) 	print "<text transform=\"translate($s3,89) rotate(90)\">$tm</text>\n";
80a398a55d309 (Arjan van de Ven    2008-09-14 15:30:52 -0700 221) 	$time = $time + $step;
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 222) }
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 223) 
aa5d9151f745b (Arjan van de Ven    2008-09-13 09:36:06 -0700 224) print "</svg>\n";