Index: /trunk/tools/czarplot.pl
===================================================================
--- /trunk/tools/czarplot.pl	(revision 29113)
+++ /trunk/tools/czarplot.pl	(revision 29114)
@@ -23,4 +23,5 @@
 my $nebulous = undef;
 my $savingToFile = undef;
+my $log = undef;
 
 GetOptions (
@@ -36,6 +37,6 @@
         "timeseries|t" => \$timeSeries,
         "verbose|v" => \$verbose,
+        "log|g" => \$log,
         );
-
 
 print "\n*******************************************************************************\n";
@@ -50,8 +51,12 @@
 if (!$timeSeries) {
     print "* OPTIONAL: plot timeseries                 -t                          (default=on)\n";} 
+if (!$log) {
+    $log = 0;
+    print "* OPTIONAL: use log plots                   -g                          (default=$log\n";}
 if (!$nebulous) {
     print "* OPTIONAL: plot nebulous disk space        -n                          (default=off)\n";} 
 if (!$label) {
-    print "* OPTIONAL: choose a label                  -l <labellName>             (default='all_stdscience_labels')\n";}
+    $label = "all_stdscience_labels";
+    print "* OPTIONAL: choose a label                  -l <labellName>             (default=$label)\n";}
 if (!$stage) {
     print "* OPTIONAL: choose a stage                  -s <chip|cam|warp|etc>      (default=none)\n";}
@@ -63,5 +68,6 @@
     print "* OPTIONAL: choose an end time              -e <datetime>               (default=now)\n";} 
 if (!$path) {
-    print "* OPTIONAL: choose an output location       -o <path>                   (default=none)\n";} 
+    print "* OPTIONAL: choose an output location       -o <path>                   (default=none)\n";
+} 
 print "*\n*******************************************************************************\n";
 
@@ -69,5 +75,4 @@
 
 # default values
-if (!$label) {$label = "all_stdscience_labels";}
 if (!$nebulous && !$histogram && !$timeSeries) {$timeSeries = 1; $histogram = 0;}
 if (!$verbose) {$verbose = 0;}
@@ -92,5 +97,5 @@
 my $diskUsage = 1; # TODO
 
-if (!$nebulous && $timeSeries) {$czarplot->createTimeSeries($label, $stage, $begin, $end);}
+if (!$nebulous && $timeSeries) {$czarplot->createTimeSeries($label, $stage, $begin, $end, !$log, $log);}
 if ($histogram) {$czarplot->createHistogram($label, $begin, $end);}
 if ($nebulous && $timeSeries) {$czarplot->plotStorageTimeSeries($begin, $end);}
Index: /trunk/tools/czartool/CzarDb.pm
===================================================================
--- /trunk/tools/czartool/CzarDb.pm	(revision 29113)
+++ /trunk/tools/czartool/CzarDb.pm	(revision 29114)
@@ -242,8 +242,10 @@
 ###########################################################################
 sub createTimeSeriesData {
-    my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff) = @_;
-
-    my $dataFile = "/tmp/czarplot_gnuplot_".$label."_".$stage."_t.dat";
-    open (GNUDAT, ">$dataFile");
+    my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff, $dataFileLin, $dataFileLog) = @_;
+
+    ${$dataFileLin} = "/tmp/czarplot_gnuplot_lin_".$label."_".$stage."_t.dat";
+    ${$dataFileLog} = "/tmp/czarplot_gnuplot_log_".$label."_".$stage."_t.dat";
+    open (GNUDATLIN, ">${$dataFileLin}");
+    open (GNUDATLOG, ">${$dataFileLog}");
 
     my $query = $self->{_db}->prepare(<<SQL);
@@ -259,5 +261,5 @@
 SQL
 
-    if (!$query->execute) {return undef;}
+    if (!$query->execute) {return 0;}
 
     my $minProcessed = undef;
@@ -265,5 +267,5 @@
     ($minProcessed, ${$maxY}, ${$minY}, ${$maxX}, ${$minX}, ${$timeDiff}) = $query->fetchrow_array();
 
-    if (!defined $minProcessed) {return undef;}
+    if (!defined $minProcessed) {return 0;}
 
     $query = $self->{_db}->prepare(<<SQL);
@@ -280,12 +282,19 @@
     # loop round results
     while (my @row = $query->fetchrow_array()) {
-
         my ($timestamp, $pending, $faults, $processed) = @row;
+
+        my $processedLog = log($processed + 1);
+        my $pendingLog = log($pending + 1);
+        my $faultsLog = log($faults + 1);
+
     #    print  "'$timestamp' '$pending' '$faults' '$processed'\n";
-        print GNUDAT "$timestamp $pending $faults $processed\n";
-    }
-    close(GNUDAT);
-
-    return $dataFile;
+        print GNUDATLIN "$timestamp $pending $faults $processed\n";
+        print GNUDATLOG "$timestamp $pendingLog $faultsLog $processedLog\n";
+    }
+
+    close(GNUDATLIN);
+    close(GNUDATLOG);
+
+    return 1;
 }
 
Index: /trunk/tools/czartool/Czarplot.pm
===================================================================
--- /trunk/tools/czartool/Czarplot.pm	(revision 29113)
+++ /trunk/tools/czartool/Czarplot.pm	(revision 29114)
@@ -33,9 +33,10 @@
 ###########################################################################
 sub createImageFileName {
-    my ($self, $label, $stage, $suffix) = @_;
+    my ($self, $label, $stage, $suffix, $isLog) = @_;
 
     my $prefix = $self->{_outputPath} ? $self->{_outputPath} : ".";
     my $stagePart = $stage ? $stage : "all_stages";
-    return $prefix . "/czarplot_" . $label . "_" . $stagePart . "_$suffix.png";
+    my $type = $isLog ? "log" : "linear";
+    return $prefix . "/czarplot_" . $type . "_" . $label . "_" . $stagePart . "_$suffix.png";
 }
 
@@ -46,7 +47,5 @@
 ###########################################################################
 sub createTimeSeries {
-    my ($self, $label, $selectedStage, $beginTime, $endTime) = @_;
-
-    my $outputFile = createImageFileName($self, $label, $selectedStage, "t");
+    my ($self, $label, $selectedStage, $beginTime, $endTime, $makeLinear, $makeLog) = @_;
 
     my ($minX, $maxX, $minY, $maxY, $timeDiff);
@@ -61,15 +60,31 @@
     else {$stages = ["$selectedStage"]};        
 
-    my %gnuplotFiles;
+    my %gnuplotFilesLin;
+    my %gnuplotFilesLog;
     my $stage = undef;
-    my $gnuplotFile = undef;
+    my $gnuplotFileLin = undef;
+    my $gnuplotFileLog = undef;
     foreach $stage (@{$stages}) {
 
-        $gnuplotFile = $self->{_czarDb}->createTimeSeriesData($label, $stage, $beginTime, $endTime, \$minX, \$maxX, \$minY, \$maxY, \$timeDiff);
-        if ($gnuplotFile) {$gnuplotFiles{$stage} = $gnuplotFile;}
+        if($self->{_czarDb}->createTimeSeriesData(
+                    $label, 
+                    $stage, 
+                    $beginTime, 
+                    $endTime, 
+                    \$minX, 
+                    \$maxX, 
+                    \$minY, 
+                    \$maxY, 
+                    \$timeDiff, 
+                    \$gnuplotFileLin,
+                    \$gnuplotFileLog)) {
+
+            $gnuplotFilesLin{$stage} = $gnuplotFileLin;
+            $gnuplotFilesLog{$stage} = $gnuplotFileLog;
+        }
 
     }                                                           
 
-    my $numOfPlots =  keys(%gnuplotFiles);
+    my $numOfPlots =  keys(%gnuplotFilesLin);
 
     if ($numOfPlots == 0 ) {
@@ -85,5 +100,15 @@
     }
 
-    plotTimeSeries($self, \%gnuplotFiles, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff);
+    my $outputFile;
+    if ($makeLinear) {
+
+        $outputFile = createImageFileName($self, $label, $selectedStage, "t", 0);
+        $self->plotTimeSeries(\%gnuplotFilesLin, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff, 0);
+    }
+    if ($makeLog) {
+
+        $outputFile = createImageFileName($self, $label, $selectedStage, "t", 1);
+        $self->plotTimeSeries(\%gnuplotFilesLog, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff, 1);
+    }
 }                                                    
 
@@ -96,8 +121,8 @@
     my ($self, $label, $beginTime, $endTime) = @_;
 
-    my $outputFile = createImageFileName($self, $label, undef, "h");
+    my $outputFile = createImageFileName($self, $label, undef, "h", 0);
 
     my $inputFile = "/tmp/czarplot_gnuplot_".$label."_h.dat"; # TODO use stage not table
-    open (GNUDAT, ">$inputFile");
+        open (GNUDAT, ">$inputFile");
 
     my ($processed, $pending, $faults);
@@ -216,5 +241,5 @@
 ###########################################################################
 sub plotTimeSeries {
-    my ($self, $gnuplotFiles, $outputFile, $label, $fromTime, $toTime, $maxX, $minX, $maxY, $minY, $timeDiff) = @_;
+    my ($self, $gnuplotFiles, $outputFile, $label, $fromTime, $toTime, $maxX, $minX, $maxY, $minY, $timeDiff, $isLog) = @_;
 
     $self->sortOutMaxMinY(\$minY, \$maxY);
@@ -222,5 +247,7 @@
     my $timeFormat = undef;
     my $divX = undef;
-
+    my $yTitle = undef;
+    if ($isLog) {$yTitle = "Log(Num of Exposures)";}
+    else {$yTitle = "Num of Exposures";}
     $self->getTimeSpacing($timeDiff, \$divX, \$timeFormat);
 
@@ -245,5 +272,5 @@
         "set xdata time;" .
         "set timefmt \"$self->{_dateFormat}\";" .
-    #    "set yrange [\"$minY\":\"$maxY\"];" .
+        #    "set yrange [\"$minY\":\"$maxY\"];" .
         "set xrange [\"$minX\":\"$maxX\"];" .
         "set format x \"$timeFormat\";" .
@@ -251,5 +278,5 @@
         "set grid xtics;" .
         "set xlabel \"Time\";" .
-        "set ylabel \"Exposures\";" .
+        "set ylabel \"$yTitle\";" .
         "plot ";
 
@@ -342,5 +369,5 @@
         "set boxwidth;" .
         "set style data histogram;" .
- "set style histogram rowstacked;" .
+        "set style histogram rowstacked;" .
         "set style fill solid border -1;" .
         "set ylabel \"Exposures\";" .
Index: /trunk/tools/roboczar.pl
===================================================================
--- /trunk/tools/roboczar.pl	(revision 29113)
+++ /trunk/tools/roboczar.pl	(revision 29114)
@@ -186,5 +186,5 @@
 
             chomp($label);
-            $czarplot->createTimeSeries($label,  $stage, $begin, $end);
+            $czarplot->createTimeSeries($label,  $stage, $begin, $end, 1, 1);
         }
     }
@@ -194,14 +194,14 @@
         my ($label) = @{$row};
 
-        $czarplot->createTimeSeries($label, undef, $begin, $end);
+        $czarplot->createTimeSeries($label, undef, $begin, $end, 1, 1);
         $czarplot->createHistogram($label, $begin, $end);
 
         #routineChecks($label, "1 HOUR");
     }
-    $czarplot->createTimeSeries("all_".$server."_labels", undef, $begin, $end);
+    $czarplot->createTimeSeries("all_".$server."_labels", undef, $begin, $end, 1, 1);
     $czarplot->createHistogram("all_".$server."_labels", $begin, $end);
     foreach $stage (@stages) {
 
-        $czarplot->createTimeSeries("all_".$server."_labels",  $stage, $begin, $end); # TODO must be a neater way...
+        $czarplot->createTimeSeries("all_".$server."_labels",  $stage, $begin, $end, 1, 1); # TODO must be a neater way...
     }
 }
