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.h
Go to the documentation of this file.
1 //
2 // Initial port performed by Stefan Eilemann (eilemann@gmail.com)
3 //
4 #ifndef _CPUMETER_H_
5 #define _CPUMETER_H_
6 
7 #include "fieldmetergraph.h"
8 
9 #include <sys/types.h>
10 #include <sys/sysmp.h>
11 #include <sys/sysinfo.h>
12 
13 #define USED_CPU_STATES (CPU_STATES-1) // SXBRK + IDLE merged
14 
15 class CPUMeter : public FieldMeterGraph {
16  public:
17  CPUMeter(XOSView *parent, const int cpuid = 0);
18  ~CPUMeter(void);
19 
20  const char *name(void) const { return "CPUMeter"; }
21  void checkevent(void);
22 
23  void checkResources(void);
24 
25  static int nCPUs();
26  static const char *cpuStr(int num);
27 
28  protected:
30  int cpuindex_;
31 
32  void getcputime(void);
33  const char *toUpper(const char *str);
34 
35  private:
36  struct sysinfo tsp;
37  int sinfosz;
38  int cpuid_;
39 };
40 
41 #endif
void checkevent(void)
CPUMeter(XOSView *parent, unsigned int nbr)
Definition: cpumeter.cc:23
uint64_t cputime_[2][CPUSTATES]
Definition: cpumeter.h:44
int sinfosz
Definition: cpumeter.h:37
void checkResources(void)
~CPUMeter(void)
const char * name(void) const
Definition: cpumeter.h:20
struct sysinfo tsp
Definition: cpumeter.h:36
int cpuid_
Definition: cpumeter.h:38
void getcputime(void)
static const char * cpuStr(int num)
Definition: cpumeter.cc:93
const char * toUpper(const char *str)
Definition: cpumeter.cc:83
static int nCPUs()
Definition: cpumeter.cc:121
unsigned int cpuindex_
Definition: cpumeter.h:45
#define USED_CPU_STATES
Definition: cpumeter.h:13