X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vlib%2Fvlib%2Fthreads_cli.c;h=e788b04b795ab8e280eb8c136309b4dba03676d6;hb=2fdaece0876465d6980ac6922099502a84e1e029;hp=9ab4edcd357d8b30461ded662f43564ac34e4d0a;hpb=b2a6e25067a41def7d5795df6d07231b55051ab2;p=vpp.git diff --git a/vlib/vlib/threads_cli.c b/vlib/vlib/threads_cli.c index 9ab4edcd357..e788b04b795 100644 --- a/vlib/vlib/threads_cli.c +++ b/vlib/vlib/threads_cli.c @@ -17,6 +17,26 @@ #include #include +#include + +static u8 * +format_sched_policy_and_priority (u8 * s, va_list * args) +{ + long i = va_arg (*args, long); + struct sched_param sched_param; + u8 *t = 0; + + switch (sched_getscheduler (i)) + { +#define _(v,f,str) case SCHED_POLICY_##f: t = (u8 *) str; break; + foreach_sched_policy +#undef _ + } + if (sched_getparam (i, &sched_param) == 0) + return format (s, "%s (%d)", t, sched_param.sched_priority); + else + return format (s, "%s (n/a)", t); +} static clib_error_t * show_threads_fn (vlib_main_t * vm, @@ -25,8 +45,8 @@ show_threads_fn (vlib_main_t * vm, vlib_worker_thread_t *w; int i; - vlib_cli_output (vm, "%-7s%-20s%-12s%-8s%-7s%-7s%-7s%-10s", - "ID", "Name", "Type", "LWP", + vlib_cli_output (vm, "%-7s%-20s%-12s%-8s%-25s%-7s%-7s%-7s%-10s", + "ID", "Name", "Type", "LWP", "Sched Policy (Priority)", "lcore", "Core", "Socket", "State"); #if !defined(__powerpc64__) @@ -40,6 +60,8 @@ show_threads_fn (vlib_main_t * vm, w->name ? w->name : (u8 *) "", w->registration ? w->registration->name : "", w->lwp); + line = format (line, "%-25U", format_sched_policy_and_priority, w->lwp); + #if DPDK==1 int lcore = w->dpdk_lcore_id; if (lcore > -1)