mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
health: build the instrumentation only when asked for
The counters, the phase hooks in idle() and the "health" command are now behind HEALTH, set from the command line with HEALTH=1. Without it the hooks are empty macros and the command does not exist, so a default build carries none of it: on SWTGW218AS that is 1065 bytes of bank 2, 101 of the common segment and 28 of xdata, plus seven banked calls per main-loop pass. It is a developer's tool. Reading the dump takes knowing the main loop, and a user who needs it for a report can build with the flag on, which is how the kernel treats its lock and latency instrumentation as well.
This commit is contained in:
1 parent
2f872ea08e
commit
fa0eb91586
5 files changed
+31
-2
No files matched your search
+11
-1
@@ -9,7 +9,10 @@ extern __xdata uint8_t cmd_buffer[CMD_BUF_SIZE];
|
||||
extern __xdata uint8_t cmd_available;
|
||||
extern __xdata uint8_t err_status;
|
||||
|
||||
/* Phase ids of the health instrumentation, in main-loop order */
|
||||
/* Health instrumentation, built with HEALTH=1. Without it the hooks below
|
||||
* compile to nothing and the "health" command does not exist. */
|
||||
#ifdef HEALTH
|
||||
/* Phase ids, in main-loop order */
|
||||
#define HEALTH_PH_LINK 0
|
||||
#define HEALTH_PH_SFP 1
|
||||
#define HEALTH_PH_RX 2
|
||||
@@ -19,11 +22,18 @@ extern __xdata uint8_t err_status;
|
||||
#define HEALTH_PHASES 6
|
||||
|
||||
extern __xdata uint16_t health_rx_frames;
|
||||
#define health_rx_frame() health_rx_frames++
|
||||
|
||||
void health_loop_start(void) __banked; /* once per idle() pass, resets the phase baseline */
|
||||
void health_phase(uint8_t id) __banked; /* after each phase; accounts ticks since last checkpoint */
|
||||
void health_stack_paint(void) __banked; /* paint the unused stack area once at boot */
|
||||
void health_show(void) __banked; /* "health" CLI dump */
|
||||
#else
|
||||
#define health_rx_frame()
|
||||
#define health_loop_start()
|
||||
#define health_phase(id)
|
||||
#define health_stack_paint()
|
||||
#endif
|
||||
|
||||
void cmd_tokenize(void) __banked;
|
||||
void cmd_parser(void) __banked;
|
||||
|
||||
Reference in new issue
Block a user