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
This commit is contained in:
Jean Delvare committed 2007-08-26 20:34:55 +00:00
1 parent f0f3df8a48
commit 2cc20c4487
1 file changed
+2
+2
View File
@@ -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);