Stefan Seyfried wrote:
Hi,

i am currently overhauling getCPULoad and friends:
 - getCPULoad
 - getCPULoadConsiderNice
 - getCPULoadSMP

IMO, all but the last can go. UP is just a special case of SMP for us so
why have the code duplicated?
getCPULoad is only there for compatibility and there is not one single
known user of it, so i'd drop it.
getCPULoadConsiderNice is also only used by powersaved and i have
already converted my "bleeding edge"-tree to use getCPULoadSMP always
and it works better than before, since the old code was just plain wrong
and evaluated the CPU load much more often than necessary.

To lower the overhead and improve performance, i would call the
getCPULoadSMP() with cpu number -1 to update the "load array" for all
CPUs, if getCPULoadSMP() is called with a positive number, it just
returns the pre-calculated cpu load for that particular processor. This
also saves us from opening, parsing and closing /proc/stat 8 times on a
8-way machine (yes, right now it is done like that :-). An additional
benefit would be that this will integrate nicely with the glib-mainloop
since we can set an independent timer for the update of the CPU load,
which will actually let the throttling code work correctly again, even
with ondemand.

Long story short: if nobody has some violent complaints, i'll add this
to the unstable HEAD branch. I can also send a patch to review if
someone really wants to look at it first.

Go ahead.
I like to have a look at the code, but I will search for the commit...

Yes, code is duplicated because of historical reasons. SMP support was requested and I did not want to break library API and remove any functions.

Maybe considering siblings (Hyperthreading/Dualcore, could be implemented down there and be cached in some kind of CPU core/socket static array?).
Just an idea, currently all is done in higher C++ functions, maybe this is not
necessary.

Or can we even use some cpufreq-utils functions for that? Sorry, I didn't have a look at that package for a longer time...

      Thomas
_______________________________________________
powersave-devel mailing list
[email protected]
http://forge.novell.com/mailman/listinfo/powersave-devel

Reply via email to