summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2021-04-13 20:38:09 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2021-06-24 16:42:59 +0200
commit45f0118832172d71dd19e437112e9907c60331f2 (patch)
treeaf0a4d36c15759b8ad1bf4d3c6450aed492971ec /lib/command.c
parent94a64dab8650bcb017106cbd60d77211da43c815 (diff)
lib: make cputime checks runtime options (v2)
...really no reason to force this into a compile time decision. The only point is avoiding the getrusage() syscall, which can easily be a runtime decision. [v2: also split cputime & walltime limits] Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/command.c b/lib/command.c
index 7be54907ed..e00d84a051 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -434,6 +434,36 @@ static int config_write_host(struct vty *vty)
}
log_config_write(vty);
+ /* print disable always, but enable only if default is flipped
+ * => prep for future removal of compile-time knob
+ */
+ if (!cputime_enabled)
+ vty_out(vty, "no service cputime-stats\n");
+#ifdef EXCLUDE_CPU_TIME
+ else
+ vty_out(vty, "service cputime-stats\n");
+#endif
+
+ if (!cputime_threshold)
+ vty_out(vty, "no service cputime-warning\n");
+#if defined(CONSUMED_TIME_CHECK) && CONSUMED_TIME_CHECK != 5000000
+ else /* again, always print non-default */
+#else
+ else if (cputime_threshold != 5000000)
+#endif
+ vty_out(vty, "service cputime-warning %lu\n",
+ cputime_threshold);
+
+ if (!walltime_threshold)
+ vty_out(vty, "no service walltime-warning\n");
+#if defined(CONSUMED_TIME_CHECK) && CONSUMED_TIME_CHECK != 5000000
+ else /* again, always print non-default */
+#else
+ else if (walltime_threshold != 5000000)
+#endif
+ vty_out(vty, "service walltime-warning %lu\n",
+ walltime_threshold);
+
if (host.advanced)
vty_out(vty, "service advanced-vty\n");