xosview  1.23
About: xosview is an X Windows based system monitor (cpu, memory, swap and network usage; interrupt and serial activities; load average).
  Fossies Dox: xosview-1.23.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

diskmeter.cc
Go to the documentation of this file.
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 
13  parent, 3, "DISK", "READ/WRITE/IDLE")
14 {
15  maxspeed_ = max;
16  getdiskinfo();
17 }
18 
20 {
21 }
22 
23 void DiskMeter::checkResources( void )
24 {
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 
43 {
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_);
56 }
57 
void checkResources(void)
Definition: diskmeter.cc:46
float maxspeed_
Definition: diskmeter.h:24
void checkevent(void)
Definition: diskmeter.cc:58
~DiskMeter(void)
Definition: diskmeter.cc:43
void getdiskinfo(void)
Definition: diskmeter.cc:42
DiskMeter(XOSView *parent, double max)
Definition: diskmeter.cc:19
virtual void checkResources(void)
virtual void drawfields(int mandatory=0)
double total_
Definition: fieldmeter.h:41
void setfieldcolor(int field, const char *color)
Definition: fieldmeter.cc:108
void setUsed(double val, double total)
Definition: fieldmeter.cc:76
void IntervalTimerStart()
Definition: fieldmeter.h:62
double * fields_
Definition: fieldmeter.h:40
void SetUsedFormat(const char *const str)
Definition: fieldmeter.cc:60
int priority_
Definition: meter.h:54
XOSView * parent_
Definition: meter.h:52
static SarMeter * Instance()
Definition: sarmeter.cc:11
DiskInfo * getDiskInfo(void)
Definition: sarmeter.h:54
int isResourceTrue(const char *name)
Definition: xwin.h:89
const char * getResource(const char *name)
Definition: xwin.cc:362
static const int max
Definition: intmeter.cc:17