! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Wrong tooltip on FreeBSD
Status:
RESOLVED: FIXED
Product:
Xfce4-cpugraph-plugin
Component:
General

Comments

Description Florian Rivoal editbugs 2010-06-28 14:54:07 CEST
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)
Comment 1 Florian Rivoal editbugs 2010-06-28 14:56:18 CEST
Mike, was this on 64 bit or 32 bit?
Comment 2 Mike Massonnet editbugs 2010-07-01 09:37:34 CEST
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
Comment 3 Mike Massonnet editbugs 2010-07-01 09:41:10 CEST
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
Comment 4 Florian Rivoal editbugs 2010-07-01 15:42:12 CEST
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.
Comment 5 Mike Massonnet editbugs 2010-07-06 17:02:38 CEST
(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.
Comment 6 Florian Rivoal editbugs 2010-07-24 16:39:50 CEST
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.

Bug #6530

Reported by:
Florian Rivoal
Reported on: 2010-06-28
Last modified on: 2010-10-03

People

Assignee:
Florian Rivoal
CC List:
1 user

Version

Attachments

fix freebsd code patch (1.75 KB, patch)
2010-07-01 09:37 CEST , Mike Massonnet
no flags

Additional information