mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-16 08:29:15 +01:00
LP-304 - Allow further info to be added to PERF_INIT_COUNTER for future feature support.
This may allow in future to extract the counters id list with grep to be handled by gcs or other custom tools Proposed usage: PERF_INIT_COUNTER(counterVariable, id, "MODULE NAME","COUNTER DESCRIPTION","UNIT OF MEASURE"); i.e.: PERF_INIT_COUNTER(counterExecutionTime, 0xAC700001, "ACTUATOR", "Actuator update execution time", "uS");
This commit is contained in:
parent
1b254e4182
commit
5156c0c911
@ -52,10 +52,16 @@
|
||||
* The following code needs to be added to a function called at module initialization.
|
||||
* the second parameter is a unique counter Id.
|
||||
* A good pracice is to use the upper half word as module id and lower as counter id
|
||||
* <pre>PERF_INIT_COUNTER(counterUpd, 0xA7710001);
|
||||
* PERF_INIT_COUNTER(counterAtt, 0xA7710002);
|
||||
* PERF_INIT_COUNTER(counterPeriod, 0xA7710003);
|
||||
* PERF_INIT_COUNTER(counterAccelSamples, 0xA7710004);</pre>
|
||||
* Optionally three strings containing Module Name, Counter description and unit of measure can be passed.
|
||||
* Those strings will be used in future to automatically extract the list of counters from code to managed
|
||||
* by GCS or some other custom tool.
|
||||
*
|
||||
* PERF_INIT_COUNTER(counterVariable, id, "MODULE NAME","COUNTER DESCRIPTION","UNIT OF MEASURE");
|
||||
*
|
||||
* <pre>PERF_INIT_COUNTER(counterUpd, 0xA7710001, "ATTITUDE", "Sensor update execution time", "us");
|
||||
* PERF_INIT_COUNTER(counterAtt, 0xA7710002, "ATTITUDE", "Attitude estimation execution time", "us");
|
||||
* PERF_INIT_COUNTER(counterPeriod, 0xA7710003, "ATTITUDE", "Sensor update period", "us");
|
||||
* PERF_INIT_COUNTER(counterAccelSamples, 0xA7710004, "ATTITUDE", "Samples for each sensor cycle", "count");</pre>
|
||||
*
|
||||
* At this point you can start using the counters as in the following samples
|
||||
*
|
||||
@ -90,7 +96,7 @@
|
||||
/**
|
||||
* this mast be called at some module init code
|
||||
*/
|
||||
#define PERF_INIT_COUNTER(x, id) x = PIOS_Instrumentation_CreateCounter(id)
|
||||
#define PERF_INIT_COUNTER(x, id, ...) x = PIOS_Instrumentation_CreateCounter(id)
|
||||
|
||||
/**
|
||||
* those are the monitoring macros
|
||||
@ -105,7 +111,7 @@
|
||||
#else
|
||||
|
||||
#define PERF_DEFINE_COUNTER(x)
|
||||
#define PERF_INIT_COUNTER(x, id)
|
||||
#define PERF_INIT_COUNTER(x, id, ...)
|
||||
#define PERF_TIMED_SECTION_START(x)
|
||||
#define PERF_TIMED_SECTION_END(x)
|
||||
#define PERF_MEASURE_PERIOD(x)
|
||||
|
Loading…
x
Reference in New Issue
Block a user