Skip to contentSkip to conversation

Getting cpu frequency

DISCUSSION Nico Golde 3 participants 6 messages Feb 11, 2006 – Feb 12, 2006

lore
Share & tools
lore

Nico Golde

author
#0 lore raw

Hi,
at the moment I try to get the current cpu frequency via using the cpufreq_get() function defined in linux/cpufreq.h. Can someone point me to the headers I have to include to let this work because just doing #include <linux/cpufreq.h> results in a bunch of errors:
[...]
In file included from /usr/include/linux/cpu.h:22,

                 from cpu.c:2:

/usr/include/linux/sysdev.h:31: error: field 'drivers' has incomplete type /usr/include/linux/sysdev.h:35: error: syntax error before 'pm_message_t' /usr/include/linux/sysdev.h:37: error: field 'kset' has incomplete type /usr/include/linux/sysdev.h:50: error: field 'entry' has incomplete type /usr/include/linux/sysdev.h:54: error: syntax error before 'pm_message_t' /usr/include/linux/sysdev.h:69: error: syntax error before 'u32' /usr/include/linux/sysdev.h:72: error: syntax error before '}' token /usr/include/linux/sysdev.h:79: error: field 'attr' has incomplete type /usr/include/linux/sysdev.h:80: error: syntax error before 'ssize_ [...]
Using 2.6.14.
Regards Nico
P.S. Please CC me, I am not subsribed, thanks

Signature · 4 lines
Nico Golde - JAB: [email protected] | GPG: 0x73647CFF
http://www.ngolde.de | http://www.muttng.org | http://grml.org
Forget about that mouse with 3/4/5 buttons -
gimme a keyboard with 103/104/105 keys!
#1 lore raw
Quoted 9 lines · Nico Golde

Hi,
at the moment I try to get the current cpu frequency via using the cpufreq_get() function defined in linux/cpufreq.h. Can someone point me to the headers I have to include to let this work because just doing #include <linux/cpufreq.h> results in a bunch of errors:
[...]
In file included from /usr/include/linux/cpu.h:22,

                 from cpu.c:2:
Quoted 13 lines

/usr/include/linux/sysdev.h:31: error: field 'drivers' has incomplete type /usr/include/linux/sysdev.h:35: error: syntax error before 'pm_message_t' /usr/include/linux/sysdev.h:37: error: field 'kset' has incomplete type /usr/include/linux/sysdev.h:50: error: field 'entry' has incomplete type /usr/include/linux/sysdev.h:54: error: syntax error before 'pm_message_t' /usr/include/linux/sysdev.h:69: error: syntax error before 'u32' /usr/include/linux/sysdev.h:72: error: syntax error before '}' token /usr/include/linux/sysdev.h:79: error: field 'attr' has incomplete type /usr/include/linux/sysdev.h:80: error: syntax error before 'ssize_ [...]
Using 2.6.14.
Regards Nico
P.S. Please CC me, I am not subsribed, thanks

Are you trying to do this from a userspace program ? If so, this isn't going to work.

Dave

author
#2 lore raw

Hallo Dave,

Quoted 24 lines · Dave Jones
Quoted 9 lines · Nico Golde

Hi,
at the moment I try to get the current cpu frequency via using the cpufreq_get() function defined in linux/cpufreq.h. Can someone point me to the headers I have to include to let this work because just doing #include <linux/cpufreq.h> results in a bunch of errors:
[...]
In file included from /usr/include/linux/cpu.h:22,

                 from cpu.c:2:
Quoted 13 lines

/usr/include/linux/sysdev.h:31: error: field 'drivers' has incomplete type /usr/include/linux/sysdev.h:35: error: syntax error before 'pm_message_t' /usr/include/linux/sysdev.h:37: error: field 'kset' has incomplete type /usr/include/linux/sysdev.h:50: error: field 'entry' has incomplete type /usr/include/linux/sysdev.h:54: error: syntax error before 'pm_message_t' /usr/include/linux/sysdev.h:69: error: syntax error before 'u32' /usr/include/linux/sysdev.h:72: error: syntax error before '}' token /usr/include/linux/sysdev.h:79: error: field 'attr' has incomplete type /usr/include/linux/sysdev.h:80: error: syntax error before 'ssize_ [...]
Using 2.6.14.
Regards Nico
P.S. Please CC me, I am not subsribed, thanks

Quoted 2 lines

Are you trying to do this from a userspace program ? If so, this isn't going to work.

Yes I am.
Regards Nico

Signature · 4 lines
Nico Golde - JAB: [email protected] | GPG: 0x73647CFF
http://www.ngolde.de | http://www.muttng.org | http://grml.org
Forget about that mouse with 3/4/5 buttons -
gimme a keyboard with 103/104/105 keys!
#3 lore raw
Quoted 8 lines · Nico Golde

Hallo Dave,

Quoted 5 lines · Dave Jones
Quoted 3 lines · Nico Golde

Hi,
at the moment I try to get the current cpu frequency P.S. Please CC me, I am not subsribed, thanks

Quoted 4 lines
Quoted 2 lines

Are you trying to do this from a userspace program ? If so, this isn't going to work.

Yes I am.

Read it from sysfs or /proc/cpuinfo.
But, why does your app care ?
If it's to set up some sort of timing loop, it's going to fail miserably.

Dave

author
#4 lore raw
Quoted 9 lines · Dave Jones
Quoted 8 lines · Nico Golde

Hallo Dave,

Quoted 5 lines · Dave Jones
Quoted 3 lines · Nico Golde

Hi,
at the moment I try to get the current cpu frequency P.S. Please CC me, I am not subsribed, thanks

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Are you trying to do this from a userspace program ? If so, this isn't going to work.

Yes I am.

Read it from sysfs or /proc/cpuinfo.

Thats exactly what I dont wanted to do and thought its possible without reading a file. So it seems to be not, thank you will use sysfs to get the information. Regards Nico

Signature · 4 lines
Nico Golde - JAB: [email protected] | GPG: 0x73647CFF
http://www.ngolde.de | http://www.muttng.org | http://grml.org
Forget about that mouse with 3/4/5 buttons -
gimme a keyboard with 103/104/105 keys!
#5 lore raw
Quoted 13 lines · Nico Golde
Quoted 12 lines · Dave Jones
Quoted 11 lines · Nico Golde

Hallo Dave,

Quoted 7 lines · Dave Jones
Quoted 3 lines · Nico Golde

Hi,
at the moment I try to get the current cpu frequency P.S. Please CC me, I am not subsribed, thanks

Are you trying to do this from a userspace program ? If so, this isn't going to work.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Yes I am.

Read it from sysfs or /proc/cpuinfo.

Thats exactly what I dont wanted to do and thought its possible without reading a file. So it seems to be not, thank you will use sysfs to get the information. Regards Nico

there's still libcpufreq from cpufrequtils if you wish some kind of abstraction over reading a file.

Signature · 2 lines
mattia
:wq!