-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathscaler.h
52 lines (37 loc) · 941 Bytes
/
scaler.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
#include <stdio.h>
#include <stdlib.h>
#include "Processor.h"
#include "MSRObject.h"
#include "PerformanceCounter.h"
#include "Signal.h"
#define POLICY_ROCKET 0
#define POLICY_STEP 1
#define DEFAULT_SAMPLING_RATE 1000 //Default sampling rate in milliseconds
class Scaler {
private:
int samplingRate;
int policy;
int upperThreshold;
int lowerThreshold;
int midUpperThreshold;
int midLowerThreshold;
Processor *processor;
unsigned char slowestPowerState;
PerformanceCounter *perfCounter;
MSRObject *tscCounter;
uint64_t *prevPerfCounters;
uint64_t *prevTSCCounters;
uint64_t *raiseTable;
uint64_t *reduceTable;
int initializeCounters ();
void loopPolicyRocket ();
void loopPolicyStep ();
void createPerformanceTables ();
public:
void setSamplingFrequency (int);
void setPolicy (int);
void setUpperThreshold (int);
void setLowerThreshold (int);
Scaler (class Processor *);
void beginScaling ();
};