Closed gerth2 closed 4 years ago
Create a class which will track how long it takes to execute some method call.
Ideally, use java lambda's to specify to the class which function to call. I think this guide may be of help, but this is admittedly java territory I have not traversed yet.
Here's the basic thought process I had:
class OverrunTracker(){
int numOverrun = 0;
OverrunTracker(double limit_sec, string Name){
//Store limit_sec & name
}
public void reset(){
numOverrun = 0;
}
public void runTracked( <method to be timed??>){
double startTime = Timer.getFPGATimestamp();
// <Run the method to be timed>
double endTime = Timer.getFPGATimestamp();
if(endTime - startTime > lim_sec){
numOverrun++;
}
}
public void report(){
CrashTracker.logMessage(Name + " overran its execution time limit " + Integer.toString(numOverrun) + " times.");
reset();
}
}
Done - needs test on robot, but seems reasonable.
TBD Details