[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: [PATCH] Add CPU speed detection to KPersonalizer for FBSD
From: Adriaan de Groot <adridg () cs ! kun ! nl>
Date: 2003-11-13 19:21:44
[Download RAW message or body]
Attached patch is a first stab at adding CPU-speed detection to
KPersonalizer for FBSD. For the vast majority of FBSD systems out there
the speed will still be detected as 0 [which makes me wonder, why is the
CPU speed detected at all, and what is KPersonalizer doing with it?], but
in some cases (-CURRENT, ACPI enabled) the right speed is returned.
The patch also corrects an indentation mistake and adds a comment that the
CPU speed is expressed in MHz.
OK to commit? Please CC me on replies.
--
Adriaan de Groot adridg@cs.kun.nl Kamer A6020 024-3652272
GPG Key Fingerprint 934E 31AA 80A7 723F 54F9 50ED 76AC EE01 FEA2 A3FE
http://www.cs.kun.nl/~adridg/research/
["kpersonalizer.diff" (TEXT/PLAIN)]
Index: ksysinfo.cpp
===================================================================
RCS file: /home/kde/kdebase/kpersonalizer/ksysinfo.cpp,v
retrieving revision 1.10
diff -r1.10 ksysinfo.cpp
166c166
< #ifdef __linux__
---
> #if defined(Q_OS_LINUX)
209c209
< //#elif __FreeBSD__
---
> #elif defined(Q_OS_FREEBSD)
210a211,212
> #include <sys/types.h>
> #include <sys/sysctl.h>
211a214,233
> void KSysInfo::initHWInfo() {
> size_t size;
> int cpu_speed;
> int r;
>
> // Use the ACPI TSC timer setting as an approximation
> // of the CPU speed. Probably only works on -CURRENT
> // with ACPI enabled.
> size = sizeof(cpu_speed);
> r = sysctlbyname("machdep.tsc_freq",
> (void *)(&cpu_speed),&size,NULL,0);
> if (r<0)
> {
> m_cpu_speed = 0;
> }
> else
> {
> m_cpu_speed = cpu_speed / 1000000;
> }
> }
Index: ksysinfo.h
===================================================================
RCS file: /home/kde/kdebase/kpersonalizer/ksysinfo.h,v
retrieving revision 1.4
diff -r1.4 ksysinfo.h
47c47
< bool m_xfree_inc;
---
> bool m_xfree_inc;
55c55
< int m_cpu_speed;
---
> int m_cpu_speed; // CPU speed in MHz
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic