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:
d00f authored and DrDoof committed 2026-09-21 22:25:32 +02:00
1 parent 2f872ea08e
commit fa0eb91586
5 files changed
+31 -2

No files matched your search

+4
View File
@@ -1849,8 +1849,10 @@ void cmd_parser(void) __banked
}
} else if (cmd_compare(0, "stp")) {
stp_parse();
#ifdef HEALTH
} else if (cmd_compare(0, "health")) {
health_show();
#endif
} else if (cmd_compare(0, "pvid")) {
if (cmd_words_len == 3 && cmd_parse_port_separator(cmd_words_b[1]) != 0
&& atoi_short(cmd_words_b[2]) && atoi_results_short && atoi_results_short <= 4094)
@@ -2050,6 +2052,7 @@ void execute_commands(__xdata uint8_t *p) __banked {
};
}
#ifdef HEALTH
/*
* Health instrumentation. The counters live in xdata and are fed from the
* main loop through the banked entry points below; the "health" command
@@ -2205,3 +2208,4 @@ void health_show(void) __banked
print_short(management_vlan);
write_char('\n');
}
#endif