summaryrefslogtreecommitdiffstats
path: root/sys-utils/lscpu.c
diff options
context:
space:
mode:
authorHeiko Carstens2011-08-10 10:34:32 +0200
committerHeiko Carstens2011-08-14 17:34:30 +0200
commita0fff77e932b704b3d2ab0ad789d466cb42047ed (patch)
treede940511e67c0324210f9bd5c692a07d468617b7 /sys-utils/lscpu.c
parentlscpu: use hypervisor generated topology information (diff)
downloadkernel-qcow2-util-linux-a0fff77e932b704b3d2ab0ad789d466cb42047ed.tar.gz
kernel-qcow2-util-linux-a0fff77e932b704b3d2ab0ad789d466cb42047ed.tar.xz
kernel-qcow2-util-linux-a0fff77e932b704b3d2ab0ad789d466cb42047ed.zip
lscpu: show dispatching mode
A virtual guest my run in either "horiziontal" or "vertical" mode which is the mode in which the underlying hypervisor schedules the guest cpu. Since this is of interest print this in the readable output. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r--sys-utils/lscpu.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 9e4e1c057..aba7ab8bf 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -97,6 +97,17 @@ struct cpu_cache {
cpu_set_t **sharedmaps;
};
+/* dispatching modes */
+enum {
+ DISP_HORIZONTAL = 0,
+ DISP_VERTICAL = 1
+};
+
+const char *disp_modes[] = {
+ [DISP_HORIZONTAL] = N_("horizontal"),
+ [DISP_VERTICAL] = N_("vertical")
+};
+
/* global description */
struct lscpu_desc {
char *arch;
@@ -110,6 +121,7 @@ struct lscpu_desc {
char *stepping;
char *bogomips;
char *flags;
+ int dispatching; /* none, horizontal or vertical */
int mode; /* rm, lm or/and tm */
int ncpus; /* number of CPUs */
@@ -478,6 +490,12 @@ read_basicinfo(struct lscpu_desc *desc)
desc->online = path_cpulist(_PATH_SYS_SYSTEM "/cpu/online");
desc->nthreads = CPU_COUNT_S(setsize, desc->online);
}
+
+ /* get dispatching mode */
+ if (path_exist(_PATH_SYS_SYSTEM "/cpu/dispatching"))
+ desc->dispatching = path_getnum(_PATH_SYS_SYSTEM "/cpu/dispatching");
+ else
+ desc->dispatching = -1;
}
static int
@@ -1065,6 +1083,8 @@ print_readable(struct lscpu_desc *desc, int hex)
print_s(_("Hypervisor vendor:"), hv_vendors[desc->hyper]);
print_s(_("Virtualization type:"), virt_types[desc->virtype]);
}
+ if (desc->dispatching >= 0)
+ print_s(_("Dispatching mode:"), disp_modes[desc->dispatching]);
if (desc->ncaches) {
char buf[512];
int i;