aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/error.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-03-26 11:38:01 +0100
committerDamjan Marion <damarion@cisco.com>2021-03-26 16:35:22 +0100
commit92ccf9bcd2692b4b415f31044560c735d639a35c (patch)
treef5308e25329d6853921b7ea4a74d5c3b6f149b25 /src/vlib/error.c
parentfd8deb48c7ad63b47c5d7465ceefcadef0316f93 (diff)
vlib: convert foreach_vlib_main macro to be more gdb and clang-format friendly
Type: improvement Change-Id: I1152e58d7bfcb3c4347147f87a834d45ad51cdfe Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/error.c')
-rw-r--r--src/vlib/error.c79
1 files changed, 38 insertions, 41 deletions
diff --git a/src/vlib/error.c b/src/vlib/error.c
index 7d502d777a3..99664c618a9 100644
--- a/src/vlib/error.c
+++ b/src/vlib/error.c
@@ -252,42 +252,40 @@ show_errors (vlib_main_t * vm,
vlib_cli_output (vm, "%=10s%=35s%=35s%=10s", "Count", "Node", "Reason",
"Severity");
+ foreach_vlib_main ()
+ {
+ em = &this_vlib_main->error_main;
+
+ if (verbose)
+ vlib_cli_output (vm, "Thread %u (%v):", index,
+ vlib_worker_threads[index].name);
- /* *INDENT-OFF* */
- foreach_vlib_main(({
- em = &this_vlib_main->error_main;
+ for (ni = 0; ni < vec_len (this_vlib_main->node_main.nodes); ni++)
+ {
+ n = vlib_get_node (this_vlib_main, ni);
+ for (code = 0; code < n->n_errors; code++)
+ {
+ i = n->error_heap_index + code;
+ c = em->counters[i];
+ if (i < vec_len (em->counters_last_clear))
+ c -= em->counters_last_clear[i];
+ sums[i] += c;
- if (verbose)
- vlib_cli_output(vm, "Thread %u (%v):", index,
- vlib_worker_threads[index].name);
+ if (c == 0 && verbose < 2)
+ continue;
- for (ni = 0; ni < vec_len (this_vlib_main->node_main.nodes); ni++)
- {
- n = vlib_get_node (this_vlib_main, ni);
- for (code = 0; code < n->n_errors; code++)
- {
- i = n->error_heap_index + code;
- c = em->counters[i];
- if (i < vec_len (em->counters_last_clear))
- c -= em->counters_last_clear[i];
- sums[i] += c;
-
- if (c == 0 && verbose < 2)
- continue;
-
- if (verbose)
- vlib_cli_output (vm, "%10lu%=35v%=35s%=10s%=6d", c, n->name,
- em->counters_heap[i].name,
- sev2str(em->counters_heap[i].severity), i);
- else
- vlib_cli_output (vm, "%10lu%=35v%=35s%=10s", c, n->name,
- em->counters_heap[i].name,
- sev2str(em->counters_heap[i].severity));
- }
- }
- index++;
- }));
- /* *INDENT-ON* */
+ if (verbose)
+ vlib_cli_output (vm, "%10lu%=35v%=35s%=10s%=6d", c, n->name,
+ em->counters_heap[i].name,
+ sev2str (em->counters_heap[i].severity), i);
+ else
+ vlib_cli_output (vm, "%10lu%=35v%=35s%=10s", c, n->name,
+ em->counters_heap[i].name,
+ sev2str (em->counters_heap[i].severity));
+ }
+ }
+ index++;
+ }
if (verbose)
vlib_cli_output (vm, "Total:");
@@ -335,14 +333,13 @@ clear_error_counters (vlib_main_t * vm,
vlib_error_main_t *em;
u32 i;
- /* *INDENT-OFF* */
- foreach_vlib_main(({
- em = &this_vlib_main->error_main;
- vec_validate (em->counters_last_clear, vec_len (em->counters) - 1);
- for (i = 0; i < vec_len (em->counters); i++)
- em->counters_last_clear[i] = em->counters[i];
- }));
- /* *INDENT-ON* */
+ foreach_vlib_main ()
+ {
+ em = &this_vlib_main->error_main;
+ vec_validate (em->counters_last_clear, vec_len (em->counters) - 1);
+ for (i = 0; i < vec_len (em->counters); i++)
+ em->counters_last_clear[i] = em->counters[i];
+ }
return 0;
}