summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-03-01 11:45:36 +0100
committerGitHub <noreply@github.com>2022-03-01 11:45:36 +0100
commit2821405a69838f8c144620a9a59aff56d51bd761 (patch)
treea4b04cf9c9268e5c378e9847aa9d86e2d0597669 /lib
parentMerge pull request #10584 from donaldsharp/workflow_modification (diff)
parentzebra: Limit speed lookup to at most 4 minutes (diff)
downloadfrr-2821405a69838f8c144620a9a59aff56d51bd761.tar.xz
frr-2821405a69838f8c144620a9a59aff56d51bd761.zip
Merge pull request #10640 from donaldsharp/thread_timers
Diffstat (limited to 'lib')
-rw-r--r--lib/thread.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/thread.c b/lib/thread.c
index bc3bfe89d..6d91ca497 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -498,6 +498,41 @@ DEFUN (clear_thread_cpu,
return CMD_SUCCESS;
}
+static void show_thread_timers_helper(struct vty *vty, struct thread_master *m)
+{
+ const char *name = m->name ? m->name : "main";
+ char underline[strlen(name) + 1];
+ struct thread *thread;
+
+ memset(underline, '-', sizeof(underline));
+ underline[sizeof(underline) - 1] = '\0';
+
+ vty_out(vty, "\nShowing timers for %s\n", name);
+ vty_out(vty, "-------------------%s\n", underline);
+
+ frr_each (thread_timer_list, &m->timer, thread) {
+ vty_out(vty, " %-50s%pTH\n", thread->hist->funcname, thread);
+ }
+}
+
+DEFPY_NOSH (show_thread_timers,
+ show_thread_timers_cmd,
+ "show thread timers",
+ SHOW_STR
+ "Thread information\n"
+ "Show all timers and how long they have in the system\n")
+{
+ struct listnode *node;
+ struct thread_master *m;
+
+ frr_with_mutex (&masters_mtx) {
+ for (ALL_LIST_ELEMENTS_RO(masters, node, m))
+ show_thread_timers_helper(vty, m);
+ }
+
+ return CMD_SUCCESS;
+}
+
void thread_cmd_init(void)
{
install_element(VIEW_NODE, &show_thread_cpu_cmd);
@@ -509,6 +544,8 @@ void thread_cmd_init(void)
install_element(CONFIG_NODE, &no_service_cputime_warning_cmd);
install_element(CONFIG_NODE, &service_walltime_warning_cmd);
install_element(CONFIG_NODE, &no_service_walltime_warning_cmd);
+
+ install_element(VIEW_NODE, &show_thread_timers_cmd);
}
/* CLI end ------------------------------------------------------------------ */