All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Prendel <andre_prendel@gmx.de>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [Patch] libsensors: Ignore directories and
Date: Fri, 06 Feb 2009 08:43:35 +0000	[thread overview]
Message-ID: <20090206084334.GA5913@ubuntu> (raw)
In-Reply-To: <20090205090331.GA5150@ubuntu>

On Thu, Feb 05, 2009 at 03:32:22PM +0100, Jean Delvare wrote:
> On Thu, 5 Feb 2009 15:20:17 +0100, Andre Prendel wrote:
> > So I will take a closer look at valgrind. I have used only the
> > memcheck tool so far. After that you will get an updated patch.
> 
> The memcheck tool is very nice indeed. But in this case the tool I had
> in mind is callgrind (with kcachegrind to look at the results.)

Hey,

running sensors under callgrind with (1.) and without (2.) the patch
below, gives me the following result (callgrind_annotate).

1.)

 [...]
 42,709  ???:sensors_read_one_sysfs_chip [/usr/local/lib/libsensors.so.4.0.2]
 ...
 1,925  ???:vsscanf [/lib/tls/i686/cmov/libc-2.8.90.so]
 935  ???:sscanf [/lib/tls/i686/cmov/libc-2.8.90.so]
 [...]

2.)

 [...]
 43,272  ???:sensors_read_one_sysfs_chip [/usr/local/lib/libsensors.so.4.0.2]
 ...
 3,080  ???:vsscanf [/lib/tls/i686/cmov/libc-2.8.90.so]
 1,496  ???:sscanf [/lib/tls/i686/cmov/libc-2.8.90.so]
 [...]

I don't know what the numbers exactly mean. Could you explain please?

In real life of course you can't feel any speed
improvements. Nevertheless, IMO doing useless work (parsing directories
and symlinks) doesn't make sense.

Andre

> -- 
> Jean Delvare

---
--- lm-sensors-dev/lib/sysfs.c	2009-02-05 22:02:25.000000000 +0100
+++ my-sensors-dev/lib/sysfs.c	2009-02-05 22:21:09.000000000 +0100
@@ -357,12 +357,15 @@ static int sensors_read_dynamic_chip(sen
 		sensors_fatal_error(__func__, "Out of memory");
 
 	while ((ent = readdir(dir))) {
-		char *name = ent->d_name;
+		char *name;
 		int nr;
 
-		if (ent->d_name[0] = '.')
+		/* Skip directories and symlinks.  */
+		if (ent->d_type != DT_REG)
 			continue;
 
+		name = ent->d_name;
+
 		sftype = sensors_subfeature_get_type(name, &nr);
 		if (sftype = SENSORS_SUBFEATURE_UNKNOWN)
 			continue;

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  parent reply	other threads:[~2009-02-06  8:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-05  9:03 [lm-sensors] [Patch] libsensors: Ignore directories and symlinks in Andre Prendel
2009-02-05  9:53 ` [lm-sensors] [Patch] libsensors: Ignore directories and Jean Delvare
2009-02-05 10:45 ` Andre Prendel
2009-02-05 13:31 ` Jean Delvare
2009-02-05 14:20 ` Andre Prendel
2009-02-05 14:32 ` Jean Delvare
2009-02-06  8:43 ` Andre Prendel [this message]
2009-02-06 12:59 ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090206084334.GA5913@ubuntu \
    --to=andre_prendel@gmx.de \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.