IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29119


Ignore:
Timestamp:
Sep 3, 2010, 3:55:23 PM (16 years ago)
Author:
rhenders
Message:

Changes to way log/linear plots are generated

Location:
trunk/tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czarplot.pl

    r29114 r29119  
    88
    99use czartool::CzarDb;
    10 use czartool::Czarplot;
     10use czartool::Plotter;
    1111
    1212my $czarDbName = "czardb";
     
    8585
    8686
    87 # GENE PLOTS my $czarplot = new czartool::Czarplot($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png size 1280,960 font \"/usr/share/fonts/corefonts/arial.ttf\" 12" : "X11", $path, $save_temps);
    88 my $czarplot = new czartool::Czarplot($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8" : "X11", $path, $save_temps);
     87# GENE PLOTS my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png size 1280,960 font \"/usr/share/fonts/corefonts/arial.ttf\" 12" : "X11", $path, $save_temps);
     88my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8" : "X11", $path, $save_temps);
    8989
    9090# sort out times
     
    9292if (!$begin) {
    9393    if ($interval) {$begin = $czarDb->subtractInterval($end, $interval);}
    94     else {$begin =  strftime('%Y-%m-%d 06:30',localtime);}
     94    else {$begin =  strftime('%Y-%m-%d 06:35',localtime);}
    9595}
    9696
    9797my $diskUsage = 1; # TODO
    9898
    99 if (!$nebulous && $timeSeries) {$czarplot->createTimeSeries($label, $stage, $begin, $end, !$log, $log);}
    100 if ($histogram) {$czarplot->createHistogram($label, $begin, $end);}
    101 if ($nebulous && $timeSeries) {$czarplot->plotStorageTimeSeries($begin, $end);}
    102 elsif ($nebulous) {$czarplot->plotDiskUsageHistogram();}
     99if (!$nebulous && $timeSeries) {$plotter->createTimeSeries($label, $stage, $begin, $end, $log);}
     100if ($histogram) {$plotter->createHistogram($label, $begin, $end);}
     101if ($nebulous && $timeSeries) {$plotter->plotStorageTimeSeries($begin, $end);}
     102elsif ($nebulous) {$plotter->plotDiskUsageHistogram();}
    103103
  • trunk/tools/czartool/CzarDb.pm

    r29114 r29119  
    242242###########################################################################
    243243sub createTimeSeriesData {
    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}");
     244    my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff, $dataFile, $isLog) = @_;
     245
     246    ${$dataFile} = "/tmp/czarplot_gnuplot_".$label."_".$stage."_t.dat";
     247
     248    open (GNUDAT, ">${$dataFile}") or print "* Problem opening gnuplot data file for plot for '$label' '$stage'\n";
    250249
    251250    my $query = $self->{_db}->prepare(<<SQL);
     
    264263
    265264    my $minProcessed = undef;
    266 
    267     ($minProcessed, ${$maxY}, ${$minY}, ${$maxX}, ${$minX}, ${$timeDiff}) = $query->fetchrow_array();
     265    my ($_maxY, $_minY, $_timeDiff);
     266    ($minProcessed, $_maxY, $_minY, ${$maxX}, ${$minX}, $_timeDiff) = $query->fetchrow_array();
     267
     268    if ($_maxY > ${$maxY}) {${$maxY} = $_maxY;}
     269    if ($_minY < ${$minY}) {${$minY} = $_minY;}
     270    if ($_timeDiff > ${$timeDiff}) {${$timeDiff} = $timeDiff;}
    268271
    269272    if (!defined $minProcessed) {return 0;}
     
    284287        my ($timestamp, $pending, $faults, $processed) = @row;
    285288
    286         my $processedLog = log($processed + 1);
    287         my $pendingLog = log($pending + 1);
    288         my $faultsLog = log($faults + 1);
    289 
    290     #    print  "'$timestamp' '$pending' '$faults' '$processed'\n";
    291         print GNUDATLIN "$timestamp $pending $faults $processed\n";
    292         print GNUDATLOG "$timestamp $pendingLog $faultsLog $processedLog\n";
    293     }
    294 
    295     close(GNUDATLIN);
    296     close(GNUDATLOG);
     289        if ($isLog) {
     290
     291            $processed = log($processed + 1);
     292            $pending = log($pending + 1);
     293            $faults = log($faults + 1);
     294        }
     295
     296        print GNUDAT "$timestamp $pending $faults $processed\n";
     297    }
     298
     299    close(GNUDAT) or print "* Problem closing gnuplot data file for plot for '$label' '$stage'\n";
    297300
    298301    return 1;
  • trunk/tools/czartool/Plotter.pm

    r29118 r29119  
    288288        # when plotting multiple stages, show only processed
    289289        else {
     290
    290291            print GP "'" . $gnuplotFiles->{$stage} . "' using 1:4 title \"$stage\" with lines lw 2";
    291292        }
  • trunk/tools/roboczar.pl

    r29114 r29119  
    1111use czartool::Pantasks;
    1212use czartool::Nebulous;
    13 use czartool::Czarplot;
     13use czartool::Plotter;
    1414use czartool::Burntool;
    1515
     
    2727my $nebulous = new czartool::Nebulous($czarDb);
    2828my $pantasks = new czartool::Pantasks();
    29 my $czarplot = new czartool::Czarplot($czarDb, "%Y%m%d-%H%M%S", "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8", "/tmp", $save_temps); # TODO hardcoded font path
     29my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8", "/tmp", $save_temps); # TODO hardcoded font path
    3030my $burntool = new czartool::Burntool();
    3131
     
    109109
    110110        # sort out times
    111         $begin =  strftime('%Y-%m-%d 06:30',localtime);
     111        $begin =  strftime('%Y-%m-%d 06:35',localtime);
    112112        $end = $czarDb->getNowTimestamp();
    113113
     
    125125        print "* Checking Nebulous\n";
    126126        $nebulous->updateClusterSpaceInfo();
    127         $czarplot->plotDiskUsageHistogram();
     127        $plotter->plotDiskUsageHistogram();
    128128        updateServerStatus();
    129129
     
    186186
    187187            chomp($label);
    188             $czarplot->createTimeSeries($label,  $stage, $begin, $end, 1, 1);
     188            $plotter->createLogAndLinearTimeSeries($label,  $stage, $begin, $end);
    189189        }
    190190    }
     
    194194        my ($label) = @{$row};
    195195
    196         $czarplot->createTimeSeries($label, undef, $begin, $end, 1, 1);
    197         $czarplot->createHistogram($label, $begin, $end);
     196        $plotter->createLogAndLinearTimeSeries($label, undef, $begin, $end);
     197        $plotter->createHistogram($label, $begin, $end);
    198198
    199199        #routineChecks($label, "1 HOUR");
    200200    }
    201     $czarplot->createTimeSeries("all_".$server."_labels", undef, $begin, $end, 1, 1);
    202     $czarplot->createHistogram("all_".$server."_labels", $begin, $end);
     201    $plotter->createLogAndLinearTimeSeries("all_".$server."_labels", undef, $begin, $end);
     202    $plotter->createHistogram("all_".$server."_labels", $begin, $end);
    203203    foreach $stage (@stages) {
    204204
    205         $czarplot->createTimeSeries("all_".$server."_labels",  $stage, $begin, $end, 1, 1); # TODO must be a neater way...
     205        $plotter->createLogAndLinearTimeSeries("all_".$server."_labels",  $stage, $begin, $end); # TODO must be a neater way...
    206206    }
    207207}
Note: See TracChangeset for help on using the changeset viewer.