summaryrefslogtreecommitdiff
path: root/lib/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/thread.c')
-rw-r--r--lib/thread.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/thread.c b/lib/thread.c
index 6669952ff4..649fe500cd 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -109,6 +109,7 @@ static void cpu_record_hash_free(void *a)
XFREE(MTYPE_THREAD_STATS, hist);
}
+#ifndef EXCLUDE_CPU_TIME
static void vty_out_cpu_thread_history(struct vty *vty,
struct cpu_thread_history *a)
{
@@ -219,6 +220,7 @@ static void cpu_record_print(struct vty *vty, uint8_t filter)
if (tmp.total_calls > 0)
vty_out_cpu_thread_history(vty, &tmp);
}
+#endif
static void cpu_record_hash_clear(struct hash_bucket *bucket, void *args[])
{
@@ -288,6 +290,7 @@ static uint8_t parse_filter(const char *filterstr)
return filter;
}
+#ifndef EXCLUDE_CPU_TIME
DEFUN (show_thread_cpu,
show_thread_cpu_cmd,
"show thread cpu [FILTER]",
@@ -313,6 +316,7 @@ DEFUN (show_thread_cpu,
cpu_record_print(vty, filter);
return CMD_SUCCESS;
}
+#endif
static void show_thread_poll_helper(struct vty *vty, struct thread_master *m)
{
@@ -403,7 +407,9 @@ DEFUN (clear_thread_cpu,
void thread_cmd_init(void)
{
+#ifndef EXCLUDE_CPU_TIME
install_element(VIEW_NODE, &show_thread_cpu_cmd);
+#endif
install_element(VIEW_NODE, &show_thread_poll_cmd);
install_element(ENABLE_NODE, &clear_thread_cpu_cmd);
}
@@ -1511,7 +1517,9 @@ void thread_getrusage(RUSAGE_T *r)
#define FRR_RUSAGE RUSAGE_SELF
#endif
monotime(&r->real);
+#ifndef EXCLUDE_CPU_TIME
getrusage(FRR_RUSAGE, &(r->cpu));
+#endif
}
/*
@@ -1527,9 +1535,11 @@ void thread_getrusage(RUSAGE_T *r)
*/
void thread_call(struct thread *thread)
{
+#ifndef EXCLUDE_CPU_TIME
_Atomic unsigned long realtime, cputime;
unsigned long exp;
unsigned long helper;
+#endif
RUSAGE_T before, after;
GETRUSAGE(&before);
@@ -1541,6 +1551,7 @@ void thread_call(struct thread *thread)
GETRUSAGE(&after);
+#ifndef EXCLUDE_CPU_TIME
realtime = thread_consumed_time(&after, &before, &helper);
cputime = helper;
@@ -1585,6 +1596,7 @@ void thread_call(struct thread *thread)
realtime / 1000, cputime / 1000);
}
#endif /* CONSUMED_TIME_CHECK */
+#endif /* Exclude CPU Time */
}
/* Execute thread */