Skip to content

Commit

Permalink
lstopo/draw: display core/package OS index by default
Browse files Browse the repository at this point in the history
Hiding other object indexes by default is fine.
But core/package indexes are a good way to count the number of objects,
and it doesn't make boxes larger in the vast majority of cases.

Improves commit 7e750b9

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Mar 21, 2019
1 parent 4c7e527 commit dbcb71b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion NEWS
Expand Up @@ -49,7 +49,8 @@ Version 2.1.0
+ Improve support for new kinds of dax devices on Linux.
* Tools
+ lstopo
- Both logical and OS/physical indexes are now displayed by default.
- Both logical and OS/physical indexes are now displayed by default
for PU and NUMA nodes.
- The X11 interactive output has additional keyboard shortcuts to
dynamically change the displaying of indexes, attributes and text.
- Add --linespacing and change default margins and linespacing.
Expand Down
14 changes: 10 additions & 4 deletions utils/lstopo/lstopo-draw.c
Expand Up @@ -689,13 +689,17 @@ lstopo_obj_snprintf(struct lstopo_output *loutput, char *text, size_t textlen, h
hwloc_obj_type_snprintf(typestr, sizeof(typestr), obj, 0);
}

if (index_type == LSTOPO_INDEX_TYPE_DEFAULT ) {
if (index_type == LSTOPO_INDEX_TYPE_DEFAULT) {
if (obj->type == HWLOC_OBJ_PU || obj->type == HWLOC_OBJ_NUMANODE) {
/* by default we show logical+physical for PU/NUMA */
idx = obj->logical_index;
indexprefix = " L#";
} else if (obj->type == HWLOC_OBJ_PACKAGE || obj->type == HWLOC_OBJ_CORE) {
/* logical only for package+core (so that we see easily how many packages/cores there are */
idx = obj->logical_index;
indexprefix = " L#";
} else {
/* by default we show nothing for others */
/* nothing for others */
idx = HWLOC_UNKNOWN_INDEX;
indexprefix = "";
}
Expand All @@ -713,9 +717,9 @@ lstopo_obj_snprintf(struct lstopo_output *loutput, char *text, size_t textlen, h
&& (obj->type != HWLOC_OBJ_BRIDGE || obj->attr->bridge.upstream_type == HWLOC_OBJ_BRIDGE_HOST))
snprintf(indexstr, sizeof(indexstr), "%s%u", indexprefix, idx);

if (index_type == LSTOPO_INDEX_TYPE_DEFAULT && obj->type == HWLOC_OBJ_NUMANODE && loutput->show_indexes[obj->type]) {
if (index_type == LSTOPO_INDEX_TYPE_DEFAULT && obj->type == HWLOC_OBJ_NUMANODE && loutput->show_indexes[obj->type])
/* NUMA have both P# and L# on the same line (PU is split on 2 lines) */
snprintf(index2str, sizeof(index2str), " P#%u", obj->os_index);
}

if (loutput->show_attrs[obj->type]) {
attrlen = hwloc_obj_attr_snprintf(attrstr, sizeof(attrstr), obj, " ", 0);
Expand Down Expand Up @@ -927,7 +931,9 @@ prepare_text(struct lstopo_output *loutput, hwloc_obj_t obj)
lud->ntext = 1;

/* additional lines of text */

if (HWLOC_OBJ_PU == obj->type && loutput->index_type == LSTOPO_INDEX_TYPE_DEFAULT && loutput->show_indexes[obj->type]) {
/* PU P# is on second line */
snprintf(lud->text[lud->ntext++].text, sizeof(lud->text[0].text), "P#%u", obj->os_index);
}

Expand Down
6 changes: 4 additions & 2 deletions utils/lstopo/lstopo-no-graphics.1in
Expand Up @@ -89,12 +89,14 @@ If the destination file already exists, overwrite it.
\fB\-l\fR \fB\-\-logical\fR
Display hwloc logical indexes of all objects, with prefix "L#".
.
By default, both logical and physical/OS indexes are displayed, but only for PUs and NUMA nodes.
By default, both logical and physical/OS indexes are displayed for PUs and NUMA nodes,
logical only for cores and packages, and no index for other types.
.TP
\fB\-p\fR \fB\-\-physical\fR
Display OS/physical indexes of all objects, with prefix "P#".
.
By default, both logical and physical/OS indexes are displayed, but only for PUs and NUMA nodes.
By default, both logical and physical/OS indexes are displayed for PUs and NUMA nodes,
logical only for cores and packages, and no index for other types.
.TP
\fB\-c\fR \fB\-\-cpuset\fR
Display the cpuset of each object.
Expand Down

0 comments on commit dbcb71b

Please sign in to comment.