From 70e1e4c4fc031a971d8801903f9d11c3b1dd9bbe Mon Sep 17 00:00:00 2001 From: Vincent Brillault Date: Sat, 18 Apr 2015 10:58:20 +0200 Subject: [PATCH] Turbostat: fix thread max number detection There is no "thread_id" and the value we compute is the direct number. It can only be '1' or '2' and do not start at 0 like other values. --- src/turbostat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/turbostat.c b/src/turbostat.c index 629d7925..5470e6e4 100644 --- a/src/turbostat.c +++ b/src/turbostat.c @@ -1150,8 +1150,8 @@ topology_probe() { unsigned int i; int ret; - unsigned int max_package_id, max_core_id, max_thread_id; - max_package_id = max_core_id = max_thread_id = 0; + unsigned int max_package_id, max_core_id, max_threads; + max_package_id = max_core_id = max_threads = 0; /* Clean topology */ free(topology.cpus); @@ -1220,8 +1220,8 @@ topology_probe() goto err; else num_threads = (unsigned int) ret; - if (num_threads > max_thread_id) - max_thread_id = num_threads; + if (num_threads > max_threads) + max_threads = num_threads; ret = parse_int_file("/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", i); if (ret < 0) goto err; @@ -1234,7 +1234,7 @@ topology_probe() /* Num is max + 1 (need to count 0) */ topology.num_packages = max_package_id + 1; topology.num_cores = max_core_id + 1; - topology.num_threads = max_thread_id + 1; + topology.num_threads = max_threads; return 0; err: -- 2.11.0