diff options
author | Heiko Carstens | 2016-07-29 14:13:34 +0200 |
---|---|---|
committer | Karel Zak | 2016-08-03 13:35:05 +0200 |
commit | 0002704ebe998d70af87d4385cc243baae7b2059 (patch) | |
tree | d869517b09f3deb640ffb198053ea42bffa0bbcb /sys-utils/lscpu.c | |
parent | lscpu: add parsable testcase with the --physical option (diff) | |
download | kernel-qcow2-util-linux-0002704ebe998d70af87d4385cc243baae7b2059.tar.gz kernel-qcow2-util-linux-0002704ebe998d70af87d4385cc243baae7b2059.tar.xz kernel-qcow2-util-linux-0002704ebe998d70af87d4385cc243baae7b2059.zip |
lscpu: only try to read sysfs attributes of present CPUs
lscpu can skip all CPUs which are possible but not present. For
configurations where a lot of CPUs are possible but only few CPUs are
present this saves a lot of pointless glibc/system calls.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r-- | sys-utils/lscpu.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index dbb639c2f..1da595b3d 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -2059,6 +2059,10 @@ int main(int argc, char *argv[]) read_basicinfo(desc, mod); for (i = 0; i < desc->ncpuspos; i++) { + /* only consider present CPUs */ + if (desc->present && + !CPU_ISSET(real_cpu_num(desc, i), desc->present)) + continue; read_topology(desc, i); read_cache(desc, i); read_polarization(desc, i); |