Index: /trunk/tools/roboczar.pl
===================================================================
--- /trunk/tools/roboczar.pl	(revision 29755)
+++ /trunk/tools/roboczar.pl	(revision 29756)
@@ -13,4 +13,5 @@
 use czartool::Plotter;
 use czartool::Burntool;
+use czartool::StageMetrics;
 
 my $czarDbName = "czardb"; # TODO variables for other Db stuff, host etc
@@ -89,32 +90,14 @@
     my $stage;
     foreach $stage (@stages) {
-        my ($started, $finished, $stuck, $processed, $pending, $faults, $totalTime);
-        $czarDb->runAnalysis(
-                "all_stdscience_labels", 
-                $stage, 
-                $begin, 
-                $end, 
-                \$started, 
-                \$finished, 
-                \$stuck, 
-                \$processed, 
-                \$pending, 
-                \$faults, 
-                \$totalTime);
 
-        print "*     $stage $end $begin:\n";
-        if (defined $started) {print "* Processing started at $started\n";}
-        if (defined $finished) {print "* Processing finished at $finished and took $totalTime\n";}
-        else {print "* Processing has not finished\n";}
-        if (defined $stuck) {print "* Processing has been stuck since $stuck\n";}
-        print "* $processed exposures have been processed, with $pending pending and $faults faults\n";
+    my $stageMetrics = new czartool::StageMetrics($stage, "all_stdscience_labels", $begin, $end);
 
-        print "*******************************************************************************\n";
+    if ($czarDb->runAnalysis($stageMetrics)) {$stageMetrics->printMe();}
 
-        if ($stuck && $stage eq "burntool" && !$worryAboutBurntool) {next;}
+        if ($stageMetrics->getStuck() && $stage eq "burntool" && !$worryAboutBurntool) {next;}
 
-        if ($stuck) {
+        if ($stageMetrics->getStuck()) {
         
-            ${$message} = ${$message} ."\n - '$stage' is stuck with $pending pending exposures (and $faults faults)";
+            ${$message} = ${$message} ."\n - '$stage' is stuck with ".$stageMetrics->getFinalPending()." pending exposures (and ".$stageMetrics->getFaults()." faults)";
             $anyStuckStages = 1;
         }
