On FreeBSD, the tooltip that shows the cpu usage in percent is wrong, it displays a value around one million percent. (Reported by Mike Massonnet)
Mike, was this on 64 bit or 32 bit?
Created attachment 3017 fix freebsd code patch there is no such bug depending on the arch, the truth must be the code was never tested :) patch attached, tested and works fine for me it also closes bug 6531
my mistake, the patch was done on top of remote/master, it includes the fix for s/RETURN1/RETURN, I hope you don't mind merging it at hand
Of course I don't mind. The patch is very welcome. Just a little question. I couldn't manage to find documentation for FreeBSD's "kern.cp_time". sysctl and sysctlbyname, yes, but not this particular value. Where is it documented? I would particularly like to check if an array of gints is fine for cp_time, given that on other BSDs an array of guint64 is what we need.
(In reply to comment #4) > Of course I don't mind. The patch is very welcome. > > Just a little question. I couldn't manage to find documentation for FreeBSD's > "kern.cp_time". sysctl and sysctlbyname, yes, but not this particular value. > Where is it documented? Well, me neither, it's obscurely documented. > I would particularly like to check if an array of gints is fine for cp_time, > given that on other BSDs an array of guint64 is what we need. http://www.google.fr/codesearch/p?hl=fr#xAlgQDHmdnQ/pub/gentoo/distfiles/freebsd-sources-5.3.20050301.tar.bz2|o6ktO9e5_MM/sys/kern/kern_clock.c&q=sys/kern/kern_clock.c&l=478 http://www.google.fr/codesearch/p?hl=fr#xAlgQDHmdnQ/pub/gentoo/distfiles/freebsd-sources-5.3.20050301.tar.bz2|o6ktO9e5_MM/sys/sys/time.h&q=clockinfo&exact_package=http://mirror.arcticnetwork.ca/pub/gentoo/distfiles/freebsd-sources-5.3.20050301.tar.bz2&l=224 The struct cp_time contains ints, but this doesn't keeps you off from assigning them to another type afterwards. The only problem when using guint64 types is when passing them to glibc functions, in this case make sure to assign them to 0 before.
Sorry for taking so long. I didn't apply your patch directly, but used it as a start point. I didn't use the multi core part, as wasn't actually reading data from each core individually. I'll keep trying to find documentation / information about how you are supposed to read the info on multiple cpus. But until then, at least, it should work, even if you don't get detailed information. I still don't have a FreeBSD machine at hand, so I'd very much welcome a bit of testing.