-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathCPUStatsPrinter.h
59 lines (39 loc) · 1.44 KB
/
CPUStatsPrinter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
// CPUStatsPrinter - object which prints stats extracted by 2 CPUSnapshots.
#include "CPUData.h"
class CPUSnapshot;
class CPUStatsPrinter
{
public:
CPUStatsPrinter(const CPUSnapshot& s1, const CPUSnapshot& s2);
void PrintActivePercentageTotal();
void PrintActivePercentageCPU(unsigned int cpu);
void PrintActivePercentageAll();
void PrintStatePercentageTotal(unsigned int state);
void PrintStatePercentageCPU(unsigned int state, unsigned int cpu);
void PrintStatePercentageAll(unsigned int state);
void PrintFullStatePercentageTotal();
void PrintFullStatePercentageCPU(unsigned int cpu);
void PrintFullStatePercentageAll();
void SetPrecision(unsigned int prec);
void SetVerbose(bool val);
private:
float GetPercActiveTotal();
float GetPercActive(unsigned int cpu);
float GetPercStateTotal(unsigned int state);
float GetPercState(unsigned int state, unsigned int cpu);
void PrintStatePercentageNoLabelTotal(unsigned int state);
void PrintStatePercentageNoLabelCPU(unsigned int state, unsigned int cpu);
private:
static const int CPU_LABEL_W;
static const int STATE_PERC_BASE_W;
static const char * STR_STATES[CPUData::NUM_CPU_STATES];
private:
const CPUSnapshot & mS1;
const CPUSnapshot & mS2;
unsigned int mPrecision;
bool mVerbose;
};
// == INLINE FUNCTIONS ==
inline void CPUStatsPrinter::SetPrecision(unsigned int prec) { mPrecision = prec; }
inline void CPUStatsPrinter::SetVerbose(bool val) { mVerbose = val; }