Test routine for ACPI and PMU procfs

Kay Sievers kay.sievers at vrfy.org
Thu Jan 20 13:01:41 PST 2005


On Thu, 2005-01-20 at 07:34 +0000, Richard Hughes wrote:
> I know, but fgets doesn't have a glib equivalent as far as I can tell:
> http://mail.gnome.org/archives/gtk-devel-list/2000-May/msg00024.html
> If you find a better way, then please tell.
>  
> > * getprocfsvalue opens and searches the given file each time to get one value,
> >   better to parse it into a hash once and pull value's from that for example..
> 
> Yes, I ummed and arred about this one. I figured Linux would cache the
> file, and thus be really, really quick on subsequent lookups.
> 
> I toyed with the idea of passing getprocfsvalues() a linked list of stuff
> to find in each file, and another linked list for its results - but then
> you've got to iterate through each value and set each one with
> hal_set_bool or hal_set_string. Can you think of a better way?

/proc files are only pseudo-files. The values are not cached, for most
of the files you get the values out of the kernel for the price of a few
cheap function and system calls.
This is usually so fast that any magic here is just an optimization for
a problem that doesn't exist. But a measurement in your setup may show
the numbers.

I played around with udev and libsysfs, which reads a lot of sysfs file
for every event, but I couldn't really measure any significiant
difference with an "optimized" version. It was just not worth the
effort.

Kay

_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list