columns are not printed at all.
The \fIlist\fP argument is comma delimited list of the columns. Currently
-supported are CPU, Core, Node, Socket, Book and Cache columns. If the
+supported are CPU, Core, Node, Socket, Book, Cache and Polarization columns. If the
\fIlist\fP argument is given then always all requested columns are printed in
the defined order. The Cache columns are separated by ':'.
[DISP_VERTICAL] = N_("vertical")
};
+/* cpu polarization */
+enum {
+ POLAR_UNKNOWN = 0,
+ POLAR_VLOW,
+ POLAR_VMEDIUM,
+ POLAR_VHIGH,
+ POLAR_HORIZONTAL
+};
+
+const char *polar_modes[] = {
+ [POLAR_UNKNOWN] = "U",
+ [POLAR_VLOW] = "VL",
+ [POLAR_VMEDIUM] = "VM",
+ [POLAR_VHIGH] = "VH",
+ [POLAR_HORIZONTAL] = "H"
+};
+
/* global description */
struct lscpu_desc {
char *arch;
int ncaches;
struct cpu_cache *caches;
+
+ int *polarization; /* cpu polarization */
};
static size_t sysrootlen;
COL_SOCKET,
COL_NODE,
COL_BOOK,
- COL_CACHE
+ COL_CACHE,
+ COL_POLARIZATION
};
static const char *colnames[] =
[COL_SOCKET] = "Socket",
[COL_NODE] = "Node",
[COL_BOOK] = "Book",
- [COL_CACHE] = "Cache"
+ [COL_CACHE] = "Cache",
+ [COL_POLARIZATION] = "Polarization"
};
if (book_siblings)
add_cpuset_to_array(desc->bookmaps, &desc->nbooks, book_siblings);
}
+static void
+read_polarization(struct lscpu_desc *desc, int num)
+{
+ char mode[64];
+
+ if (desc->dispatching < 0)
+ return;
+ if (!path_exist(_PATH_SYS_CPU "/cpu%d/polarization", num))
+ return;
+ if (!desc->polarization)
+ desc->polarization = xcalloc(desc->ncpus, sizeof(int));
+ path_getstr(mode, sizeof(mode), _PATH_SYS_CPU "/cpu%d/polarization", num);
+ if (strncmp(mode, "vertical:low", sizeof(mode)) == 0)
+ desc->polarization[num] = POLAR_VLOW;
+ else if (strncmp(mode, "vertical:medium", sizeof(mode)) == 0)
+ desc->polarization[num] = POLAR_VMEDIUM;
+ else if (strncmp(mode, "vertical:high", sizeof(mode)) == 0)
+ desc->polarization[num] = POLAR_VHIGH;
+ else if (strncmp(mode, "horizontal", sizeof(mode)) == 0)
+ desc->polarization[num] = POLAR_HORIZONTAL;
+ else
+ desc->polarization[num] = POLAR_UNKNOWN;
+}
static int
cachecmp(const void *a, const void *b)
putchar(',');
}
break;
+ case COL_POLARIZATION:
+ if (desc->polarization)
+ printf("%s", polar_modes[desc->polarization[i]]);
+ break;
}
}
continue;
read_topology(desc, i);
read_cache(desc, i);
+ read_polarization(desc, i);
}
qsort(desc->caches, desc->ncaches, sizeof(struct cpu_cache), cachecmp);