-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSessionStats.h
70 lines (54 loc) · 1.3 KB
/
SessionStats.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
60
61
62
63
64
65
66
67
68
69
70
#ifndef SESSION_STATS_H
#define SESSION_STATS_H
class SessionStats {
public:
SessionStats(): mNumSamples(20), mCurrNumSamples(0), mTotal(0) {}
void updateTUT(unsigned long time, unsigned int percentMax){
addData(percentMax);
mTUT += time;
if(percentMax>=85){
mTimeOver85Ms += time;
}
}
int getTUTs() {
return (mTUT) / 1000;
}
int getAvgPercentMax() const {
if (mCurrNumSamples != 0)
return mTotal / mCurrNumSamples;
else return 0;
}
float getAvgStrengh2Weight(){
return 0;
}
void incrementRep(){
mTotalRepsCount++;
}
int getTotalNumRep(){
return mTotalRepsCount;
}
int getTimeOver85s(){
return mTimeOver85Ms/1000;
}
float getAvgWeight(){
return 0;
}
protected:
void addData(float val) {
// reduce samples total by one sample value
if (mCurrNumSamples >= mNumSamples) {
mTotal = mTotal * (mNumSamples - 1) / mNumSamples;
}
else
mCurrNumSamples++; // increment the current number
mTotal += val;
}
protected:
unsigned int mNumSamples;
unsigned int mCurrNumSamples;
float mTotal;
unsigned int mTotalRepsCount = 0;
unsigned long mTUT = 0;
unsigned long mTimeOver85Ms = 0;
};
#endif