diff options
author | Karel Zak | 2014-01-14 13:56:27 +0100 |
---|---|---|
committer | Karel Zak | 2014-01-14 13:59:34 +0100 |
commit | 39c758d140602e635b1943080834df41fa7c9ac1 (patch) | |
tree | 5d2dc24d0f5870969053120dcfe32d7559a25e35 /sys-utils/lscpu.c | |
parent | docs: add lslogins(1) to TODO (diff) | |
download | kernel-qcow2-util-linux-39c758d140602e635b1943080834df41fa7c9ac1.tar.gz kernel-qcow2-util-linux-39c758d140602e635b1943080834df41fa7c9ac1.tar.xz kernel-qcow2-util-linux-39c758d140602e635b1943080834df41fa7c9ac1.zip |
lscpu: sort NUMA nodes to keep output human readable
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r-- | sys-utils/lscpu.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 0e937e1cd..b8840ef90 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -925,6 +925,13 @@ static inline int is_node_dirent(struct dirent *d) isdigit_string(d->d_name + 4); } +static int +nodecmp(const void *ap, const void *bp) +{ + int *a = (int *) ap, *b = (int *) bp; + return *a - *b; +} + static void read_nodes(struct lscpu_desc *desc) { @@ -960,6 +967,7 @@ read_nodes(struct lscpu_desc *desc) _("Failed to extract the node number")); } closedir(dir); + qsort(desc->idx2nodenum, desc->nnodes, sizeof(int), nodecmp); } /* information about how nodes share different CPUs */ |