|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
realtime runtime code throughput margin monitoring
I'm wondering how many teams add runtime throughput and scheduling monitoring in each thread (or parallel loop) of their practice or even competition deployed code. Something like the following Code:
* thread start * t0=system_microseconds(); if (t0-t1)>TBD1 err1++; //scheduling monitor t1=t0; * put thread code here * if (system_microseconds()-t0)>TBD2 err2++; //thread throughput margin monitor * thread end * |
|
#2
|
|||||
|
|||||
|
Re: realtime runtime code throughput margin monitoring
Quote:
As far as I see it's the next step toward system stability after we work out a few more of our selective failure cases. |
|
#3
|
|||||
|
|||||
|
Re: realtime runtime code throughput margin monitoring
We had this in our code, to a certain extent. We sent loop execution times to our custom dashboard, where they would be monitored and used to check that everything was running okay. If our main loop ever ran much over 20 ms per iteration, then we'd be worried (the vision loop ideally would be at about 100 ms). Code for reference.
|
|
#4
|
||||
|
||||
|
Re: realtime runtime code throughput margin monitoring
Quote:
|
|
#5
|
|||
|
|||
|
Re: realtime runtime code throughput margin monitoring
The LV template project contains a folder called Support Code. In it is a VI called Elapsed TImes.vi. Placing it into any loop or recurring code will result in a table of elapsed times being updated to calculate and show the period of the calls. The easiest way to view the times is to open the Elapsed Times panel. This is typically used for debugging and later deleted, but could be transmitted back to dashboard if a team wanted. I have no idea how many times it was used.
Greg McKaskle |
|
#6
|
||||
|
||||
|
Re: realtime runtime code throughput margin monitoring
Quote:
|
|
#7
|
|||||
|
|||||
|
Re: realtime runtime code throughput margin monitoring
Quote:
The biggest cause of CPU usage while not permanently deployed seems to be updating VI front panels. If you have enough inclusions of Elapsed Times, it seems to update the front panel array every time it changes (Every tick of every loop). If you create a slower loop somewhere (we ran ours at 75ms I think) to read the array of times from Elapsed Times, it is significantly less CPU hungry than simply opening Elapsed Times. We used the same loop to read the CPU load cluster and print it to the same debug screen, and that information (CPU usage by thread priority) was also extremely useful. It was a very useful VI. We had it in about 10 or so tasks. |
|
#8
|
|||
|
|||
|
Re: realtime runtime code throughput margin monitoring
Quote:
Thanks. Greg McKaskle |
|
#9
|
|||||
|
|||||
|
Re: realtime runtime code throughput margin monitoring
Quote:
Thankfully, it was never necessary to actively monitor these, although having software do it is a good idea for next year. |
|
#10
|
||||
|
||||
|
Re: realtime runtime code throughput margin monitoring
Quote:
|
|
#11
|
|||||
|
|||||
|
Re: realtime runtime code throughput margin monitoring
Not all that often (I don't remember, but maybe ~200 ms). Which, of course, now that I think about it, doesn't really help catch situations like you're thinking of... Anyway, it's a good idea to implement next year.
|
|
#12
|
|||
|
|||
|
Re: realtime runtime code throughput margin monitoring
I don't have an overhead number, but I have seen it raise the CPU. The code is in about six loops in the Driver Station and I saw no need to delete it. I decided not to leave it in the default robot code loops and chose to let teams do it for themselves. I hope to get around to adding some high-water mark and stats to it and perhaps I can find a way to leave it in all loops. Time will tell.
Greg McKaskle |
|
#13
|
||||
|
||||
|
Re: realtime runtime code throughput margin monitoring
Quote:
I've taken a low-tech solution to this type of task... where I use printf statements that can be turned on by ftp of lua script... I get roughly 10-11ms iterations of a single thread (I cannot see the need for any more). All functions work with a delta time (double dTime_s) parameter to deal with uneven slices of time... this way I need not do anything fancy with the Sleep(10). For the numbers I find interesting I use a separate homemade app to read the text and translate into a bmp file graph. So it's paritally real-time... partially post process. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|