Quote:
Originally Posted by virtuald
One reason I can think of is because if you artificially inflate the load to 100%, then when you have an *actual* load problem you won't notice it.
|
Certainly, if you've got the CPU pegged you have to look at some other metric to measure your performance. We just put everything together in one loop and used something like this:
Code:
class Perf_mon{
Time start,last,worst_case_;
unsigned iterations;
public:
Perf_mon():start(-1),last(-1),worst_case(0),iterations(0){}
void update(Time t){
if(last==-1){
start=t;
}else{
auto elapsed=t-last;
worst_case_=max(worst_case_,elapsed);
}
last=t;
iterations++;
}
Time average()const{ return iterations/(.0001+start-last); }
Time worst_case()const{ return worst_case_; }
};
And this was kind of overkill since we could just look at the worst case, notice it was much faster than the driver station data updated, and be done.