24 #include <rte_config.h> 25 #include <rte_common.h> 27 #include <rte_launch.h> 28 #include <rte_lcore.h> 34 long i = va_arg (*args,
long);
35 struct sched_param sched_param;
38 switch (sched_getscheduler (i))
40 #define _(v,f,str) case SCHED_POLICY_##f: t = (u8 *) str; break; 44 if (sched_getparam (i, &sched_param) == 0)
45 return format (s,
"%s (%d)", t, sched_param.sched_priority);
47 return format (s,
"%s (n/a)", t);
58 "ID",
"Name",
"Type",
"LWP",
"Sched Policy (Priority)",
59 "lcore",
"Core",
"Socket",
"State");
61 #if !defined(__powerpc64__) 67 line =
format (line,
"%-7d%-20s%-12s%-8d",
80 pthread_getaffinity_np (w->
thread_id, sizeof (cpu_set_t), &cpuset);
84 for (c = 0; c < CPU_SETSIZE; c++)
85 if (CPU_ISSET (c, &cpuset))
102 const char *sys_cpu_path =
"/sys/devices/system/cpu/cpu";
107 p =
format (p,
"%s%u/topology/core_id%c", sys_cpu_path, lcore, 0);
113 "%s%u/topology/physical_package_id%c",
114 sys_cpu_path, lcore, 0);
118 line =
format (line,
"%-7u%-7u%-7u%", lcore, core_id, socket_id);
120 ASSERT (lcore <= RTE_MAX_LCORE);
124 line =
format (line,
"wait");
127 line =
format (line,
"running");
130 line =
format (line,
"finished");
133 line =
format (line,
"unknown");
140 format (line,
"%-7s%-7s%-7s%", (lcore == -2) ?
"M" :
"n/a",
"n/a",
155 .path =
"show threads",
156 .short_help =
"Show threads",
186 else if (
unformat (line_input,
"off"))
188 else if (
unformat (line_input,
"index %u"), &index)
205 "expecting valid worker handoff queue index");
222 for (fqix = 0; fqix < num_fq; fqix++)
229 memset (fqh, 0,
sizeof (*fqh));
237 .path =
"trace frame-queue",
238 .short_help =
"trace frame-queue (on|off)",
258 return (((two_counters[0] + two_counters[1]) * 100) +
259 (total - 1)) / total;
286 "16-17 18-19 20-21 22-23 24-25 26-27 28-29 30-31\n");
289 for (fqix = 0; fqix < num_fq; fqix++)
310 total += fqh->
count[nelt];
321 "%3d%% %3d%% %3d%% %3d%% %3d%% %3d%% %3d%% %3d%% " 322 "%3d%% %3d%% %3d%% %3d%% %3d%% %3d%% %3d%% %3d%%\n",
343 " vector-threshold %d ring size %d in use %d\n",
348 " %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d\n",
361 " %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d\n",
387 vlib_cli_output (vm,
"Worker handoff queue index %u (next node '%U'):",
407 vlib_cli_output (vm,
"Worker handoff queue index %u (next node '%U'):",
419 .path =
"show frame-queue",
420 .short_help =
"show frame-queue trace",
427 .path =
"show frame-queue histogram",
428 .short_help =
"show frame-queue histogram",
455 if (
unformat (line_input,
"nelts %u", &nelts))
457 else if (
unformat (line_input,
"index %u", &index))
468 "expecting valid worker handoff queue index");
472 if ((nelts != 4) && (nelts != 8) && (nelts != 16) && (nelts != 32))
484 for (fqix = 0; fqix < num_fq; fqix++)
494 .path =
"test frame-queue nelts",
495 .short_help =
"test frame-queue nelts (4,8,16,32)",
522 if (
unformat (line_input,
"threshold %u", &threshold))
524 else if (
unformat (line_input,
"index %u", &index))
535 "expecting valid worker handoff queue index");
540 if (threshold == ~(
u32) 0)
556 for (fqix = 0; fqix < num_fq; fqix++)
566 .path =
"test frame-queue threshold",
567 .short_help =
"test frame-queue threshold N (0=no limit)",
static u32 compute_percent(u64 *two_counters, u64 total)
static u8 * format_sched_policy_and_priority(u8 *s, va_list *args)
sll srl srl sll sra u16x4 i
format_function_t format_vlib_node_name
frame_queue_trace_t * frame_queue_traces
static clib_error_t * show_frame_queue_trace(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static clib_error_t * test_frame_queue_nelts(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
u64 count[FRAME_QUEUE_MAX_NELTS]
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vlib_worker_thread_t * vlib_worker_threads
struct lcore_config lcore_config[]
#define FRAME_QUEUE_MAX_NELTS
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static clib_error_t * show_frame_queue_internal(vlib_main_t *vm, vlib_frame_queue_main_t *fqm, u32 histogram)
i32 n_vectors[FRAME_QUEUE_MAX_NELTS]
vlib_frame_queue_t ** vlib_frame_queues
static clib_error_t * show_threads_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_free(V)
Free vector's memory (no header).
static vlib_thread_main_t * vlib_get_thread_main()
frame_queue_nelt_counter_t * frame_queue_histogram
static clib_error_t * show_frame_queue_histogram(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * trace_frame_queue(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_error_t * vlib_sysfs_read(char *file_name, char *fmt,...)
vlib_frame_queue_main_t * frame_queue_mains
vhost_vring_state_t state
static clib_error_t * test_frame_queue_threshold(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_foreach(var, vec)
Vector iterator.
#define foreach_sched_policy
#define clib_error_return(e, args...)
#define CLIB_CACHE_LINE_BYTES
vlib_thread_registration_t * registration