diff --git a/flight/pios/inc/pios_instrumentation_helper.h b/flight/pios/inc/pios_instrumentation_helper.h index 6a9423a66..277f183fe 100644 --- a/flight/pios/inc/pios_instrumentation_helper.h +++ b/flight/pios/inc/pios_instrumentation_helper.h @@ -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 - *
PERF_INIT_COUNTER(counterUpd, 0xA7710001); - * PERF_INIT_COUNTER(counterAtt, 0xA7710002); - * PERF_INIT_COUNTER(counterPeriod, 0xA7710003); - * PERF_INIT_COUNTER(counterAccelSamples, 0xA7710004);+ * 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"); + * + *
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");* * At this point you can start using the counters as in the following samples * @@ -85,27 +91,27 @@ /** * include the following macro together with modules variable declaration */ -#define PERF_DEFINE_COUNTER(x) static pios_counter_t x +#define PERF_DEFINE_COUNTER(x) static pios_counter_t x /** * 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 */ -#define PERF_TIMED_SECTION_START(x) PIOS_Instrumentation_TimeStart(x) -#define PERF_TIMED_SECTION_END(x) PIOS_Instrumentation_TimeEnd(x) -#define PERF_MEASURE_PERIOD(x) PIOS_Instrumentation_TrackPeriod(x) -#define PERF_TRACK_VALUE(x, y) PIOS_Instrumentation_updateCounter(x, y) -#define PERF_INCREMENT_VALUE(x) PIOS_Instrumentation_incrementCounter(x, 1) -#define PERF_DECREMENT_VALUE(x) PIOS_Instrumentation_incrementCounter(x, -1) +#define PERF_TIMED_SECTION_START(x) PIOS_Instrumentation_TimeStart(x) +#define PERF_TIMED_SECTION_END(x) PIOS_Instrumentation_TimeEnd(x) +#define PERF_MEASURE_PERIOD(x) PIOS_Instrumentation_TrackPeriod(x) +#define PERF_TRACK_VALUE(x, y) PIOS_Instrumentation_updateCounter(x, y) +#define PERF_INCREMENT_VALUE(x) PIOS_Instrumentation_incrementCounter(x, 1) +#define PERF_DECREMENT_VALUE(x) PIOS_Instrumentation_incrementCounter(x, -1) #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)