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)  

CPUMeter Class Reference

#include <cpumeter.h>

Inheritance diagram for CPUMeter:
[legend]
Collaboration diagram for CPUMeter:
[legend]

Public Member Functions

 CPUMeter (XOSView *parent, unsigned int nbr)
 
 ~CPUMeter (void)
 
const char * name (void) const
 
void checkevent (void)
 
void checkResources (void)
 
 CPUMeter (XOSView *parent)
 
 ~CPUMeter (void)
 
const char * name (void) const
 
void checkevent (void)
 
void checkResources (void)
 
 CPUMeter (XOSView *parent, const int cpuid=0)
 
 ~CPUMeter (void)
 
const char * name (void) const
 
void checkevent (void)
 
void checkResources (void)
 
 CPUMeter (XOSView *parent, const char *cpuID="cpu")
 
 ~CPUMeter (void)
 
const char * name (void) const
 
void checkevent (void)
 
void checkResources (void)
 
 CPUMeter (XOSView *parent, kstat_ctl_t *kcp, int cpuid=0)
 
 ~CPUMeter (void)
 
const char * name (void) const
 
void checkevent (void)
 
void checkResources (void)
 
- Public Member Functions inherited from FieldMeterGraph
 FieldMeterGraph (XOSView *parent, int numfields, const char *title="", const char *legend="", int docaptions=0, int dolegends=0, int dousedlegends=0)
 
virtual ~FieldMeterGraph (void)
 
virtual void drawfields (int mandatory=0)
 
- Public Member Functions inherited from FieldMeterDecay
 FieldMeterDecay (XOSView *parent, int numfields, const char *title="", const char *legend="", int docaptions=0, int dolegends=0, int dousedlegends=0)
 
virtual ~FieldMeterDecay (void)
 
- Public Member Functions inherited from FieldMeter
 FieldMeter (XOSView *parent, int numfields, const char *title="", const char *legend="", int docaptions=0, int dolegends=0, int dousedlegends=0)
 
virtual ~FieldMeter (void)
 
void setfieldcolor (int field, const char *color)
 
void setfieldcolor (int field, unsigned long color)
 
void docaptions (int val)
 
void dolegends (int val)
 
void dousedlegends (int val)
 
void reset (void)
 
void setUsed (double val, double total)
 
void draw (void)
 
void disableMeter (void)
 
- Public Member Functions inherited from Meter
 Meter (XOSView *parent, const char *title="", const char *legend="", int docaptions=0, int dolegends=0, int dousedlegends=0)
 
virtual ~Meter (void)
 
void resize (int x, int y, int width, int height)
 
void title (const char *title)
 
const char * title (void)
 
void legend (const char *legend)
 
const char * legend (void)
 
void docaptions (int val)
 
void dolegends (int val)
 
void dousedlegends (int val)
 
int requestevent (void)
 
int getX () const
 
int getY () const
 
int getWidth () const
 
int getHeight () const
 

Static Public Member Functions

static int nCPUs ()
 
static const char * cpuStr (int num)
 
static int countCPUs (void)
 
static const char * cpuStr (int num)
 
static int getkernelversion (void)
 
static const char * cpuStr (int num)
 
- Static Public Member Functions inherited from Meter
static double scaleValue (double value, char *scale, bool metric)
 

Protected Member Functions

void getcputime (void)
 
void getcputime (void)
 
void getcputime (void)
 
const char * toUpper (const char *str)
 
void getcputime (void)
 
int findLine (const char *cpuID)
 
const char * toUpper (const char *str)
 
void getcputime (void)
 
- Protected Member Functions inherited from FieldMeterGraph
void setNumCols (int n)
 
- Protected Member Functions inherited from FieldMeter
void SetUsedFormat (const char *const str)
 
void drawlegend (void)
 
void drawused (int mandatory)
 
bool checkX (int x, int width) const
 
void setNumFields (int n)
 
void IntervalTimerStart ()
 
void IntervalTimerStop ()
 
double IntervalTimeInMicrosecs ()
 
double IntervalTimeInSecs ()
 
- Protected Member Functions inherited from Meter
double samplesPerSecond ()
 
double secondsPerSample ()
 

Protected Attributes

float cputime_ [2][5]
 
int cpuindex_
 
time_t cputime_ [2][(CPU_STATES-1)]
 
int _lineNum
 
unsigned long long cputime_ [2][10]
 
int kernel_
 
int statfields_
 
- Protected Attributes inherited from FieldMeterGraph
int useGraph_
 
int graphNumCols_
 
int graphpos_
 
double * heightfield_
 
- Protected Attributes inherited from FieldMeterDecay
int dodecay_
 
int firsttime_
 
double * decay_
 
double * lastDecayval_
 
- Protected Attributes inherited from FieldMeter
int numfields_
 
double * fields_
 
double total_
 
double used_
 
double lastused_
 
int * lastvals_
 
int * lastx_
 
unsigned long * colors_
 
unsigned long usedcolor_
 
UsedType print_
 
int printedZeroTotalMesg_
 
int numWarnings_
 
bool metric_
 
int usedoffset_
 
- Protected Attributes inherited from Meter
XOSViewparent_
 
int x_
 
int y_
 
int width_
 
int height_
 
int docaptions_
 
int dolegends_
 
int dousedlegends_
 
int priority_
 
int counter_
 
char * title_
 
char * legend_
 
unsigned long textcolor_
 

Private Attributes

uint64_t cputime_ [2][CPUSTATES]
 
unsigned int cpuindex_
 
unsigned int nbr_
 
struct sysinfo tsp
 
int sinfosz
 
int cpuid_
 
KStatListcpustats
 
bool aggregate
 
kstat_ctl_t * kc
 
kstat_t * ksp
 

Additional Inherited Members

- Protected Types inherited from FieldMeter
enum  UsedType {
  INVALID_0 , FLOAT , PERCENT , AUTOSCALE ,
  INVALID_TAIL
}
 

Detailed Description

Definition at line 31 of file cpumeter.h.

Constructor & Destructor Documentation

◆ CPUMeter() [1/5]

CPUMeter::CPUMeter ( XOSView parent,
unsigned int  nbr 
)

Definition at line 23 of file cpumeter.cc.

References BSDCPUInit(), cpuindex_, cputime_, nbr_, and Meter::title().

◆ ~CPUMeter() [1/5]

CPUMeter::~CPUMeter ( void  )

Definition at line 36 of file cpumeter.cc.

◆ CPUMeter() [2/5]

CPUMeter::CPUMeter ( XOSView parent)

Definition at line 12 of file cpumeter.cc.

References cpuindex_, and cputime_.

◆ ~CPUMeter() [2/5]

CPUMeter::~CPUMeter ( void  )

◆ CPUMeter() [3/5]

CPUMeter::CPUMeter ( XOSView parent,
const int  cpuid = 0 
)

Definition at line 12 of file cpumeter.cc.

References cpuid_, cpuindex_, cputime_, XWin::done(), Meter::parent_, sinfosz, and USED_CPU_STATES.

◆ ~CPUMeter() [3/5]

CPUMeter::~CPUMeter ( void  )

◆ CPUMeter() [4/5]

CPUMeter::CPUMeter ( XOSView parent,
const char *  cpuID = "cpu" 
)

Definition at line 22 of file cpumeter.cc.

References _lineNum, cpuindex_, cputime_, findLine(), getkernelversion(), kernel_, and statfields_.

◆ ~CPUMeter() [4/5]

CPUMeter::~CPUMeter ( void  )

◆ CPUMeter() [5/5]

CPUMeter::CPUMeter ( XOSView parent,
kstat_ctl_t *  kcp,
int  cpuid = 0 
)

◆ ~CPUMeter() [5/5]

CPUMeter::~CPUMeter ( void  )

Member Function Documentation

◆ checkevent() [1/5]

void CPUMeter::checkevent ( void  )
virtual

Implements Meter.

Definition at line 53 of file cpumeter.cc.

References FieldMeterGraph::drawfields(), and getcputime().

◆ checkevent() [2/5]

void CPUMeter::checkevent ( void  )
virtual

Reimplemented from FieldMeter.

◆ checkevent() [3/5]

void CPUMeter::checkevent ( void  )
virtual

Reimplemented from FieldMeter.

◆ checkevent() [4/5]

void CPUMeter::checkevent ( void  )
virtual

Reimplemented from FieldMeter.

◆ checkevent() [5/5]

void CPUMeter::checkevent ( void  )
virtual

Reimplemented from FieldMeter.

◆ checkResources() [1/5]

◆ checkResources() [2/5]

void CPUMeter::checkResources ( void  )
virtual

Reimplemented from FieldMeterGraph.

◆ checkResources() [3/5]

void CPUMeter::checkResources ( void  )
virtual

Reimplemented from FieldMeterGraph.

◆ checkResources() [4/5]

void CPUMeter::checkResources ( void  )
virtual

Reimplemented from FieldMeterGraph.

◆ checkResources() [5/5]

void CPUMeter::checkResources ( void  )
virtual

Reimplemented from FieldMeterGraph.

◆ countCPUs()

int CPUMeter::countCPUs ( void  )
static

Definition at line 300 of file cpumeter.cc.

References STATFILENAME.

Referenced by IntMeter::countCPUs().

◆ cpuStr() [1/3]

const char * CPUMeter::cpuStr ( int  num)
static

Definition at line 93 of file cpumeter.cc.

References nCPUs().

◆ cpuStr() [2/3]

static const char* CPUMeter::cpuStr ( int  num)
static

◆ cpuStr() [3/3]

static const char* CPUMeter::cpuStr ( int  num)
static

◆ findLine()

int CPUMeter::findLine ( const char *  cpuID)
protected

Definition at line 277 of file cpumeter.cc.

References STATFILENAME.

Referenced by CPUMeter().

◆ getcputime() [1/5]

void CPUMeter::getcputime ( void  )
protected

◆ getcputime() [2/5]

void CPUMeter::getcputime ( void  )
protected

◆ getcputime() [3/5]

void CPUMeter::getcputime ( void  )
protected

◆ getcputime() [4/5]

void CPUMeter::getcputime ( void  )
protected

◆ getcputime() [5/5]

void CPUMeter::getcputime ( void  )
protected

◆ getkernelversion()

int CPUMeter::getkernelversion ( void  )
static

Definition at line 337 of file cpumeter.cc.

Referenced by CPUMeter().

◆ name() [1/5]

const char* CPUMeter::name ( void  ) const
inlinevirtual

Reimplemented from Meter.

Definition at line 36 of file cpumeter.h.

◆ name() [2/5]

const char* CPUMeter::name ( void  ) const
inlinevirtual

Reimplemented from Meter.

Definition at line 17 of file cpumeter.h.

◆ name() [3/5]

const char* CPUMeter::name ( void  ) const
inlinevirtual

Reimplemented from Meter.

Definition at line 20 of file cpumeter.h.

◆ name() [4/5]

const char* CPUMeter::name ( void  ) const
inlinevirtual

Reimplemented from Meter.

Definition at line 19 of file cpumeter.h.

◆ name() [5/5]

const char* CPUMeter::name ( void  ) const
inlinevirtual

Reimplemented from Meter.

Definition at line 19 of file cpumeter.h.

◆ nCPUs()

int CPUMeter::nCPUs ( )
static

Definition at line 121 of file cpumeter.cc.

Referenced by cpuStr().

◆ toUpper() [1/2]

const char * CPUMeter::toUpper ( const char *  str)
protected

Definition at line 83 of file cpumeter.cc.

◆ toUpper() [2/2]

const char* CPUMeter::toUpper ( const char *  str)
protected

Member Data Documentation

◆ _lineNum

int CPUMeter::_lineNum
protected

Definition at line 28 of file cpumeter.h.

Referenced by CPUMeter().

◆ aggregate

bool CPUMeter::aggregate
private

Definition at line 32 of file cpumeter.h.

Referenced by CPUMeter().

◆ cpuid_

int CPUMeter::cpuid_
private

Definition at line 38 of file cpumeter.h.

Referenced by CPUMeter().

◆ cpuindex_ [1/2]

int CPUMeter::cpuindex_
private

Definition at line 45 of file cpumeter.h.

Referenced by CPUMeter(), and getcputime().

◆ cpuindex_ [2/2]

int CPUMeter::cpuindex_
protected

Definition at line 23 of file cpumeter.h.

◆ cpustats

KStatList* CPUMeter::cpustats
private

Definition at line 31 of file cpumeter.h.

Referenced by CPUMeter().

◆ cputime_ [1/4]

time_t CPUMeter::cputime_[2][(CPU_STATES-1)]
protected

Definition at line 29 of file cpumeter.h.

◆ cputime_ [2/4]

unsigned long long CPUMeter::cputime_[2][10]
protected

Definition at line 29 of file cpumeter.h.

◆ cputime_ [3/4]

float CPUMeter::cputime_[2][CPU_STATES]
protected

Definition at line 22 of file cpumeter.h.

◆ cputime_ [4/4]

float CPUMeter::cputime_
private

Definition at line 44 of file cpumeter.h.

Referenced by CPUMeter(), and getcputime().

◆ kc

kstat_ctl_t* CPUMeter::kc
private

Definition at line 33 of file cpumeter.h.

Referenced by CPUMeter().

◆ kernel_

int CPUMeter::kernel_
protected

Definition at line 31 of file cpumeter.h.

Referenced by CPUMeter().

◆ ksp

kstat_t* CPUMeter::ksp
private

Definition at line 34 of file cpumeter.h.

Referenced by CPUMeter().

◆ nbr_

unsigned int CPUMeter::nbr_
private

Definition at line 45 of file cpumeter.h.

Referenced by CPUMeter(), and getcputime().

◆ sinfosz

int CPUMeter::sinfosz
private

Definition at line 37 of file cpumeter.h.

Referenced by CPUMeter().

◆ statfields_

int CPUMeter::statfields_
protected

Definition at line 32 of file cpumeter.h.

Referenced by CPUMeter().

◆ tsp

struct sysinfo CPUMeter::tsp
private

Definition at line 33 of file cpumeter.h.


The documentation for this class was generated from the following files: