IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29711


Ignore:
Timestamp:
Nov 8, 2010, 3:38:59 PM (16 years ago)
Author:
rhenders
Message:

more temp file clean up; now returning whether any non-zero y data is in plot data file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czartool/CzarDb.pm

    r29702 r29711  
    575575    $query->execute;
    576576
    577     my $tmpFile = File::Temp->new( TEMPLATE => "czarplot_gnuplot_".$label."_".$stage."_t.XXXXX", DIR => '/tmp', SUFFIX => '.dat');
     577    my $tmpFile = File::Temp->new( TEMPLATE => "czarplot_gnuplot_".$label."_".$stage."_t.XXXXX", DIR => '/tmp', SUFFIX => 'dat');
    578578    $tmpFile->unlink_on_destroy( 0 );
    579579    ${$dataFile} = $tmpFile->filename;
     
    590590   
    591591    $linearProcessed = 0;
     592    my $someData = 0;
    592593    while (my @row = $query->fetchrow_array()) {
    593594        my ($thisTimestamp, $thisPending, $thisFaults, $thisProcessed) = @row;
     
    640641        else {print GNUDAT "$timestamp $linearPending $linearFaults $linearProcessed\n";}
    641642
     643        if ($linearPending > 0 || $linearFaults > 0 || $linearProcessed > 0) {$someData = 1;}
     644
    642645        $lastProcessed = $thisProcessed;
    643646        $lastPending = $thisPending;
     
    648651    close(GNUDAT) or print "* Problem closing gnuplot data file for plot for '$label' '$stage'\n";
    649652
    650     return 1;
     653    #return $someData;
    651654}
    652655
     
    805808###########################################################################
    806809sub createStorageTimeSeriesData {
    807     my ($self, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff) = @_;
    808 
    809     my $dataFile = "/tmp/czarplot_gnuplot_storage_timeseries.dat";
    810     open (GNUDAT, ">$dataFile");
     810    my ($self, $tmpFile, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff) = @_;
     811
     812    open (GNUDAT, ">".$tmpFile->filename);
    811813
    812814    my $query = $self->{_db}->prepare(<<SQL);
     
    844846
    845847    close(GNUDAT);
    846 
    847     return $dataFile;
    848848}
    849849
     
    870870    open (GNUDAT, ">${$dataFile}") or print "* Problem opening gnuplot data file for plot for '$label' '$stage'\n";
    871871    my $cleanupCarry = 0;
     872    my $someData = 0;
    872873    while(1) {
    873874
     
    878879        print GNUDAT "$timestamp $processed 0 0\n";
    879880
     881        if ($processed > 0 ) {$someData = 1;}
     882
    880883        $startTime = $endTime;
    881884    }
    882885
    883     close(GNUDAT) or print "* Problem closing gnuplot data file for rate plot for '$label' '$stage'\n"
     886    close(GNUDAT) or print "* Problem closing gnuplot data file for rate plot for '$label' '$stage'\n";
     887
     888    #return $someData;
    884889}
    885890
Note: See TracChangeset for help on using the changeset viewer.