Some options have a \fIlist\fP argument. The \fIlist\fP argument is a comma
delimited list of the columns. Currently supported are CPU, Core, Node, Socket,
-Book, Cache, Polarization and Address columns.
+Book, Cache, Polarization, Address and Configured columns.
If the \fIlist\fP argument is given then all requested columns are printed in
the defined order.
int *polarization; /* cpu polarization */
int *addresses; /* physical cpu addresses */
+ int *configured; /* cpu configured */
};
enum {
COL_BOOK,
COL_CACHE,
COL_POLARIZATION,
- COL_ADDRESS
+ COL_ADDRESS,
+ COL_CONFIGURED,
};
static const char *colnames[] =
[COL_BOOK] = "Book",
[COL_CACHE] = "Cache",
[COL_POLARIZATION] = "Polarization",
- [COL_ADDRESS] = "Address"
+ [COL_ADDRESS] = "Address",
+ [COL_CONFIGURED] = "Configured",
};
desc->addresses[num] = path_getnum(_PATH_SYS_CPU "/cpu%d/address", num);
}
+static void
+read_configured(struct lscpu_desc *desc, int num)
+{
+ if (!path_exist(_PATH_SYS_CPU "/cpu%d/configure", num))
+ return;
+ if (!desc->configured)
+ desc->configured = xcalloc(desc->ncpus, sizeof(int));
+ desc->configured[num] = path_getnum(_PATH_SYS_CPU "/cpu%d/configure", num);
+}
+
static int
cachecmp(const void *a, const void *b)
{
if (desc->addresses)
snprintf(buf, bufsz, "%d", desc->addresses[cpu]);
break;
+ case COL_CONFIGURED:
+ if (desc->configured)
+ snprintf(buf, bufsz,
+ desc->configured[cpu] ? _("Y") : _("N"));
+ break;
}
return buf;
}
read_cache(desc, i);
read_polarization(desc, i);
read_address(desc, i);
+ read_configured(desc, i);
}
qsort(desc->caches, desc->ncaches, sizeof(struct cpu_cache), cachecmp);
columns[ncolumns++] = COL_CORE;
if (desc->caches)
columns[ncolumns++] = COL_CACHE;
+ if (desc->configured)
+ columns[ncolumns++] = COL_CONFIGURED;
if (desc->polarization)
columns[ncolumns++] = COL_POLARIZATION;
if (desc->addresses)