X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlib%2Fformat.c;h=7de6417be69cda217bfdea22382a3cb05b1c08f6;hb=af2e88d964ff8bd8eca30c182ab00e178213c1d4;hp=ee730bd1c28c62a10e33c9345b4fb60e0554f5de;hpb=362456a9bdc5ffc440bf776c3685ba81b8513f6e;p=vpp.git diff --git a/src/vlib/format.c b/src/vlib/format.c index ee730bd1c28..7de6417be69 100644 --- a/src/vlib/format.c +++ b/src/vlib/format.c @@ -210,6 +210,27 @@ unformat_vlib_tmpfile (unformat_input_t * input, va_list * args) return 1; } +u8 * +format_vlib_thread_name (u8 * s, va_list * args) +{ + u32 thread_index = va_arg (*args, u32); + + if (thread_index == 0) + return format (s, "main"); + + if (thread_index < vec_len (vlib_worker_threads)) + return format (s, "%s", vlib_worker_threads[thread_index].name); + return s; +} + +u8 * +format_vlib_thread_name_and_index (u8 * s, va_list * args) +{ + u32 thread_index = va_arg (*args, u32); + + return format (s, "%U (%u)", format_vlib_thread_name, thread_index, + thread_index); +} /* * fd.io coding-style-patch-verification: ON