From 2cc20c4487518ffb8276e84268c65dbb3a1661ca Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 20:34:55 +0000 Subject: [PATCH] Only consider the main features when computing how much room we need to print the labels. This is both a fix (beforehand we would leave enough room to print possibly long subfeature names, even though we do not actually print subfeature names at all) and a significant performance boost. This change alone shrinks the CPU cost of a sensors run by 4.5%. I am still worried that this feature causes us to allocate each label string twice, but I guess this overhead is now acceptable. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4715 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 583d5fd1..57cec09c 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -175,6 +175,8 @@ static int sensors_get_label_size(const sensors_chip_name *name) i = 0; while ((iter = sensors_get_all_features(name, &i))) { + if (iter->mapping != SENSORS_NO_MAPPING) + continue; if ((label = sensors_get_label(name, iter->number)) && strlen(label) > max_size) max_size = strlen(label);