"Fossies" - the Fresh Open Source Software Archive

Member "xosview-1.23/irix65/diskmeter.cc" (11 Jul 2020, 1309 Bytes) of package /linux/misc/xosview-1.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "diskmeter.cc" see the Fossies "Dox" file reference documentation.

    1 //  
    2 //  Initial port performed by Stefan Eilemann (eilemann@gmail.com)
    3 //
    4 
    5 #include "diskmeter.h"
    6 #include "xosview.h"
    7 #include "sarmeter.h"
    8 
    9 #include <stdlib.h>
   10 
   11 
   12 DiskMeter::DiskMeter( XOSView *parent, float max ) : FieldMeterGraph(
   13     parent, 3, "DISK", "READ/WRITE/IDLE")
   14 {
   15     maxspeed_ = max;
   16     getdiskinfo();
   17 }
   18 
   19 DiskMeter::~DiskMeter( void )
   20 {
   21 }
   22 
   23 void DiskMeter::checkResources( void )
   24 {
   25     FieldMeterGraph::checkResources();
   26     
   27     setfieldcolor( 0, parent_->getResource("diskReadColor") );
   28     setfieldcolor( 1, parent_->getResource("diskWriteColor") );
   29     setfieldcolor( 2, parent_->getResource("diskIdleColor") );
   30     priority_ = atoi (parent_->getResource( "diskPriority" ) );
   31     dodecay_ = parent_->isResourceTrue("diskDecay" );
   32     useGraph_ = parent_->isResourceTrue( "diskGraph" );
   33     SetUsedFormat(parent_->getResource("diskUsedFormat"));
   34 }
   35 
   36 void DiskMeter::checkevent( void )
   37 {
   38     getdiskinfo();
   39     drawfields();
   40 }
   41 
   42 void DiskMeter::getdiskinfo( void )
   43 {
   44     SarMeter::DiskInfo *di = SarMeter::Instance()->getDiskInfo();
   45 
   46     // new data
   47     total_ = maxspeed_;
   48 
   49     if (fields_[0] + fields_[1] > total_)
   50         total_ = fields_[0] + fields_[1];
   51 
   52     fields_[2] = total_ - (fields_[0] + fields_[1]);
   53     
   54     setUsed((fields_[0]+fields_[1]), total_);
   55     IntervalTimerStart();
   56 }
   57