Changeset 29114
- Timestamp:
- Sep 2, 2010, 3:09:56 PM (16 years ago)
- Location:
- trunk/tools
- Files:
-
- 4 edited
-
czarplot.pl (modified) (6 diffs)
-
czartool/CzarDb.pm (modified) (4 diffs)
-
czartool/Czarplot.pm (modified) (10 diffs)
-
roboczar.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/czarplot.pl
r29057 r29114 23 23 my $nebulous = undef; 24 24 my $savingToFile = undef; 25 my $log = undef; 25 26 26 27 GetOptions ( … … 36 37 "timeseries|t" => \$timeSeries, 37 38 "verbose|v" => \$verbose, 39 "log|g" => \$log, 38 40 ); 39 40 41 41 42 print "\n*******************************************************************************\n"; … … 50 51 if (!$timeSeries) { 51 52 print "* OPTIONAL: plot timeseries -t (default=on)\n";} 53 if (!$log) { 54 $log = 0; 55 print "* OPTIONAL: use log plots -g (default=$log\n";} 52 56 if (!$nebulous) { 53 57 print "* OPTIONAL: plot nebulous disk space -n (default=off)\n";} 54 58 if (!$label) { 55 print "* OPTIONAL: choose a label -l <labellName> (default='all_stdscience_labels')\n";} 59 $label = "all_stdscience_labels"; 60 print "* OPTIONAL: choose a label -l <labellName> (default=$label)\n";} 56 61 if (!$stage) { 57 62 print "* OPTIONAL: choose a stage -s <chip|cam|warp|etc> (default=none)\n";} … … 63 68 print "* OPTIONAL: choose an end time -e <datetime> (default=now)\n";} 64 69 if (!$path) { 65 print "* OPTIONAL: choose an output location -o <path> (default=none)\n";} 70 print "* OPTIONAL: choose an output location -o <path> (default=none)\n"; 71 } 66 72 print "*\n*******************************************************************************\n"; 67 73 … … 69 75 70 76 # default values 71 if (!$label) {$label = "all_stdscience_labels";}72 77 if (!$nebulous && !$histogram && !$timeSeries) {$timeSeries = 1; $histogram = 0;} 73 78 if (!$verbose) {$verbose = 0;} … … 92 97 my $diskUsage = 1; # TODO 93 98 94 if (!$nebulous && $timeSeries) {$czarplot->createTimeSeries($label, $stage, $begin, $end );}99 if (!$nebulous && $timeSeries) {$czarplot->createTimeSeries($label, $stage, $begin, $end, !$log, $log);} 95 100 if ($histogram) {$czarplot->createHistogram($label, $begin, $end);} 96 101 if ($nebulous && $timeSeries) {$czarplot->plotStorageTimeSeries($begin, $end);} -
trunk/tools/czartool/CzarDb.pm
r29078 r29114 242 242 ########################################################################### 243 243 sub createTimeSeriesData { 244 my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff) = @_; 245 246 my $dataFile = "/tmp/czarplot_gnuplot_".$label."_".$stage."_t.dat"; 247 open (GNUDAT, ">$dataFile"); 244 my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff, $dataFileLin, $dataFileLog) = @_; 245 246 ${$dataFileLin} = "/tmp/czarplot_gnuplot_lin_".$label."_".$stage."_t.dat"; 247 ${$dataFileLog} = "/tmp/czarplot_gnuplot_log_".$label."_".$stage."_t.dat"; 248 open (GNUDATLIN, ">${$dataFileLin}"); 249 open (GNUDATLOG, ">${$dataFileLog}"); 248 250 249 251 my $query = $self->{_db}->prepare(<<SQL); … … 259 261 SQL 260 262 261 if (!$query->execute) {return undef;}263 if (!$query->execute) {return 0;} 262 264 263 265 my $minProcessed = undef; … … 265 267 ($minProcessed, ${$maxY}, ${$minY}, ${$maxX}, ${$minX}, ${$timeDiff}) = $query->fetchrow_array(); 266 268 267 if (!defined $minProcessed) {return undef;}269 if (!defined $minProcessed) {return 0;} 268 270 269 271 $query = $self->{_db}->prepare(<<SQL); … … 280 282 # loop round results 281 283 while (my @row = $query->fetchrow_array()) { 282 283 284 my ($timestamp, $pending, $faults, $processed) = @row; 285 286 my $processedLog = log($processed + 1); 287 my $pendingLog = log($pending + 1); 288 my $faultsLog = log($faults + 1); 289 284 290 # print "'$timestamp' '$pending' '$faults' '$processed'\n"; 285 print GNUDAT "$timestamp $pending $faults $processed\n"; 286 } 287 close(GNUDAT); 288 289 return $dataFile; 291 print GNUDATLIN "$timestamp $pending $faults $processed\n"; 292 print GNUDATLOG "$timestamp $pendingLog $faultsLog $processedLog\n"; 293 } 294 295 close(GNUDATLIN); 296 close(GNUDATLOG); 297 298 return 1; 290 299 } 291 300 -
trunk/tools/czartool/Czarplot.pm
r29058 r29114 33 33 ########################################################################### 34 34 sub createImageFileName { 35 my ($self, $label, $stage, $suffix ) = @_;35 my ($self, $label, $stage, $suffix, $isLog) = @_; 36 36 37 37 my $prefix = $self->{_outputPath} ? $self->{_outputPath} : "."; 38 38 my $stagePart = $stage ? $stage : "all_stages"; 39 return $prefix . "/czarplot_" . $label . "_" . $stagePart . "_$suffix.png"; 39 my $type = $isLog ? "log" : "linear"; 40 return $prefix . "/czarplot_" . $type . "_" . $label . "_" . $stagePart . "_$suffix.png"; 40 41 } 41 42 … … 46 47 ########################################################################### 47 48 sub createTimeSeries { 48 my ($self, $label, $selectedStage, $beginTime, $endTime) = @_; 49 50 my $outputFile = createImageFileName($self, $label, $selectedStage, "t"); 49 my ($self, $label, $selectedStage, $beginTime, $endTime, $makeLinear, $makeLog) = @_; 51 50 52 51 my ($minX, $maxX, $minY, $maxY, $timeDiff); … … 61 60 else {$stages = ["$selectedStage"]}; 62 61 63 my %gnuplotFiles; 62 my %gnuplotFilesLin; 63 my %gnuplotFilesLog; 64 64 my $stage = undef; 65 my $gnuplotFile = undef; 65 my $gnuplotFileLin = undef; 66 my $gnuplotFileLog = undef; 66 67 foreach $stage (@{$stages}) { 67 68 68 $gnuplotFile = $self->{_czarDb}->createTimeSeriesData($label, $stage, $beginTime, $endTime, \$minX, \$maxX, \$minY, \$maxY, \$timeDiff); 69 if ($gnuplotFile) {$gnuplotFiles{$stage} = $gnuplotFile;} 69 if($self->{_czarDb}->createTimeSeriesData( 70 $label, 71 $stage, 72 $beginTime, 73 $endTime, 74 \$minX, 75 \$maxX, 76 \$minY, 77 \$maxY, 78 \$timeDiff, 79 \$gnuplotFileLin, 80 \$gnuplotFileLog)) { 81 82 $gnuplotFilesLin{$stage} = $gnuplotFileLin; 83 $gnuplotFilesLog{$stage} = $gnuplotFileLog; 84 } 70 85 71 86 } 72 87 73 my $numOfPlots = keys(%gnuplotFiles );88 my $numOfPlots = keys(%gnuplotFilesLin); 74 89 75 90 if ($numOfPlots == 0 ) { … … 85 100 } 86 101 87 plotTimeSeries($self, \%gnuplotFiles, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff); 102 my $outputFile; 103 if ($makeLinear) { 104 105 $outputFile = createImageFileName($self, $label, $selectedStage, "t", 0); 106 $self->plotTimeSeries(\%gnuplotFilesLin, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff, 0); 107 } 108 if ($makeLog) { 109 110 $outputFile = createImageFileName($self, $label, $selectedStage, "t", 1); 111 $self->plotTimeSeries(\%gnuplotFilesLog, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff, 1); 112 } 88 113 } 89 114 … … 96 121 my ($self, $label, $beginTime, $endTime) = @_; 97 122 98 my $outputFile = createImageFileName($self, $label, undef, "h" );123 my $outputFile = createImageFileName($self, $label, undef, "h", 0); 99 124 100 125 my $inputFile = "/tmp/czarplot_gnuplot_".$label."_h.dat"; # TODO use stage not table 101 open (GNUDAT, ">$inputFile");126 open (GNUDAT, ">$inputFile"); 102 127 103 128 my ($processed, $pending, $faults); … … 216 241 ########################################################################### 217 242 sub plotTimeSeries { 218 my ($self, $gnuplotFiles, $outputFile, $label, $fromTime, $toTime, $maxX, $minX, $maxY, $minY, $timeDiff ) = @_;243 my ($self, $gnuplotFiles, $outputFile, $label, $fromTime, $toTime, $maxX, $minX, $maxY, $minY, $timeDiff, $isLog) = @_; 219 244 220 245 $self->sortOutMaxMinY(\$minY, \$maxY); … … 222 247 my $timeFormat = undef; 223 248 my $divX = undef; 224 249 my $yTitle = undef; 250 if ($isLog) {$yTitle = "Log(Num of Exposures)";} 251 else {$yTitle = "Num of Exposures";} 225 252 $self->getTimeSpacing($timeDiff, \$divX, \$timeFormat); 226 253 … … 245 272 "set xdata time;" . 246 273 "set timefmt \"$self->{_dateFormat}\";" . 247 # "set yrange [\"$minY\":\"$maxY\"];" .274 # "set yrange [\"$minY\":\"$maxY\"];" . 248 275 "set xrange [\"$minX\":\"$maxX\"];" . 249 276 "set format x \"$timeFormat\";" . … … 251 278 "set grid xtics;" . 252 279 "set xlabel \"Time\";" . 253 "set ylabel \" Exposures\";" .280 "set ylabel \"$yTitle\";" . 254 281 "plot "; 255 282 … … 342 369 "set boxwidth;" . 343 370 "set style data histogram;" . 344 "set style histogram rowstacked;" .371 "set style histogram rowstacked;" . 345 372 "set style fill solid border -1;" . 346 373 "set ylabel \"Exposures\";" . -
trunk/tools/roboczar.pl
r29079 r29114 186 186 187 187 chomp($label); 188 $czarplot->createTimeSeries($label, $stage, $begin, $end );188 $czarplot->createTimeSeries($label, $stage, $begin, $end, 1, 1); 189 189 } 190 190 } … … 194 194 my ($label) = @{$row}; 195 195 196 $czarplot->createTimeSeries($label, undef, $begin, $end );196 $czarplot->createTimeSeries($label, undef, $begin, $end, 1, 1); 197 197 $czarplot->createHistogram($label, $begin, $end); 198 198 199 199 #routineChecks($label, "1 HOUR"); 200 200 } 201 $czarplot->createTimeSeries("all_".$server."_labels", undef, $begin, $end );201 $czarplot->createTimeSeries("all_".$server."_labels", undef, $begin, $end, 1, 1); 202 202 $czarplot->createHistogram("all_".$server."_labels", $begin, $end); 203 203 foreach $stage (@stages) { 204 204 205 $czarplot->createTimeSeries("all_".$server."_labels", $stage, $begin, $end ); # TODO must be a neater way...205 $czarplot->createTimeSeries("all_".$server."_labels", $stage, $begin, $end, 1, 1); # TODO must be a neater way... 206 206 } 207 207 }
Note:
See TracChangeset
for help on using the changeset viewer.
