aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/threads_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/threads_cli.c')
-rw-r--r--src/vlib/threads_cli.c54
1 files changed, 6 insertions, 48 deletions
diff --git a/src/vlib/threads_cli.c b/src/vlib/threads_cli.c
index bb9ddbc6e3c..a47d86401bc 100644
--- a/src/vlib/threads_cli.c
+++ b/src/vlib/threads_cli.c
@@ -15,7 +15,6 @@
#define _GNU_SOURCE
#include <vppinfra/format.h>
-#include <vppinfra/linux/sysfs.h>
#include <vlib/vlib.h>
#include <vlib/threads.h>
@@ -64,57 +63,16 @@ show_threads_fn (vlib_main_t * vm,
line = format (line, "%-25U", format_sched_policy_and_priority, w->lwp);
- int lcore = -1;
- cpu_set_t cpuset;
- CPU_ZERO (&cpuset);
- int ret = -1;
-
- ret =
- pthread_getaffinity_np (w->thread_id, sizeof (cpu_set_t), &cpuset);
- if (!ret)
- {
- int c;
- for (c = 0; c < CPU_SETSIZE; c++)
- if (CPU_ISSET (c, &cpuset))
- {
- if (lcore > -1)
- {
- lcore = -2;
- break;
- }
- lcore = c;
- }
- }
- else
- {
- lcore = w->lcore_id;
- }
-
- if (lcore > -1)
+ int cpu_id = w->cpu_id;
+ if (cpu_id > -1)
{
- const char *sys_cpu_path = "/sys/devices/system/cpu/cpu";
- int socket_id = -1;
- int core_id = -1;
- u8 *p = 0;
-
- p = format (p, "%s%u/topology/core_id%c", sys_cpu_path, lcore, 0);
- clib_sysfs_read ((char *) p, "%d", &core_id);
-
- vec_reset_length (p);
- p =
- format (p,
- "%s%u/topology/physical_package_id%c",
- sys_cpu_path, lcore, 0);
- clib_sysfs_read ((char *) p, "%d", &socket_id);
- vec_free (p);
-
- line = format (line, "%-7u%-7u%-7u%", lcore, core_id, socket_id);
+ int core_id = w->core_id;
+ int socket_id = w->socket_id;
+ line = format (line, "%-7u%-7u%-7u%", cpu_id, core_id, socket_id);
}
else
{
- line =
- format (line, "%-7s%-7s%-7s%", (lcore == -2) ? "M" : "n/a", "n/a",
- "n/a");
+ line = format (line, "%-7s%-7s%-7s%", "n/a", "n/a", "n/a");
}
vlib_cli_output (vm, "%v", line);