LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   CPU frequency (http://www.linuxquestions.org/questions/linux-hardware-18/cpu-frequency-925929/)

Edward18 01-27-2012 03:39 AM

CPU frequency
 
Hello everyone. I am trying to figure out how to get current cpu/core frequency. I know that i can use system monitor for that, but i want non-gui program. And i know that in /proc/cpuinfo stored NOT the current CPU frequency. And i need to now my CPU max frequency also. Can anyone help me with that??
P.S. I lately i have found out that not all my computers have /sys/devices/system/cpu*/cpufreq, so looking there is not an option.

Thanks in advance. Ed.

ukiuki 01-27-2012 03:51 AM

Have you tried conky? It also can show cpu usage and many other things.

Regards

catkin 01-27-2012 04:34 AM

Quote:

Originally Posted by Edward18 (Post 4585654)
i know that in /proc/cpuinfo stored NOT the current CPU frequency.

Seems to be on my system (2.6.38.7 kernel). Here's a excerpt from /proc/cpuinfo:
Code:

model name        : Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz
stepping        : 7
cpu MHz                : 1600.000


cascade9 01-27-2012 04:57 AM

lshw (cut down to the CPU bit)-

Quote:

*-cpu
description: CPU
product: AMD Phenom(tm) II X2 550 Processor
vendor: Hynix Semiconductor (Hyundai Electronics)
physical id: 4
bus info: cpu@0
version: AMD Phenom(tm) II X2 550 Processor
slot: Socket M2
size: 800MHz
capacity: 3200MHz
width: 64 bits
clock: 200MHz
capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp x86-64 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt npt lbrv svm_lock nrip_save cpufreq
Its not prefect (it gives me 3200MHz as max sped, really its 3100MHz).

'Size' is the current speed (800MHz in this case)

Quote:

Originally Posted by catkin (Post 4585695)
Seems to be on my system (2.6.38.7 kernel). Here's a excerpt from /proc/cpuinfo:
Code:

model name        : Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz
stepping        : 7
cpu MHz                : 1600.000


Same here-

Quote:

processor : 0
vendor_id : AuthenticAMD
cpu family : 16
model : 4
model name : AMD Phenom(tm) II X2 550 Processor
stepping : 3
microcode : 0x10000af
cpu MHz : 800.000
Doesnt seem to give the max speed though. ;)

Edward18 01-27-2012 07:57 AM

Quote:

Originally Posted by ukiuki (Post 4585663)
Have you tried conky? It also can show cpu usage and many other things.

Regards

Yeah conky is good thing, but unfortunately i can't use it in my case. I need something that i can detect cpu freq of remote computer. I know its kinda difficulte but thats what i want.

Edward18 01-27-2012 08:02 AM

Quote:

Originally Posted by catkin (Post 4585695)
Seems to be on my system (2.6.38.7 kernel). Here's a excerpt from /proc/cpuinfo:
Code:

model name        : Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz
stepping        : 7
cpu MHz                : 1600.000


Yeah right. In model name it says 3.10 GHz, i guess its your max CPU speed right???

linus72 01-27-2012 08:02 AM

cpufrequtils
http://www.thinkwiki.org/wiki/How_to_use_cpufrequtils

should be available for most distros

salasi 01-27-2012 12:53 PM

Quote:

Originally Posted by Edward18 (Post 4585654)
... I know that i can use system monitor for that, but i want non-gui program...

and

Quote:

I need something that i can detect cpu freq of remote computer.
If
  • by system monitor you mean the kde system monitor (also known as kde system guard)
and
  • by remote system you mean a computer that is connected to a LAN and there is data transmission between the LAN and the monitoring computer (ie, not blocked by, eg, a firewall or one of the computers having no network connectivity)

That does not necessarily exclude kde system guard. You can run in a client/server kind of mode, where one computer just runs the display part, and the other computer runs the relatively small monitoring part. Whether this really is a sensible solution for your problem, or better than whatever else you might come up with, I really don't know, but I just wanted to mention that it might still be a possibility.

Anyway, cpufreq-info should do what you want. -f gives you just the frequency, rather than giving you several lines, which include the frequency on one of them, and c allows you to specify a core; you may have to specify, eg, core 0 and core 1 alternately, because I can't see a way of specifying *, or something, for 'give me all the cores that you've got'. (Maybe, that's only 1, which would render that point moot.) This will give you a file, and then you'll have to do something with it.

I thought that maybe collectl would do it, because that can be fairly neat, but I can't see from the man page any reference to current cpu clock.

catkin 01-28-2012 02:43 AM

Quote:

Originally Posted by Edward18 (Post 4585818)
Yeah right. In model name it says 3.10 GHz, i guess its your max CPU speed right???

Yes -- I included in the excerpt to show that "cpu MHz" is the current frequency.

Edward18 01-29-2012 05:07 AM

Quote:

Originally Posted by salasi (Post 4586060)
and



If
  • by system monitor you mean the kde system monitor (also known as kde system guard)
and
  • by remote system you mean a computer that is connected to a LAN and there is data transmission between the LAN and the monitoring computer (ie, not blocked by, eg, a firewall or one of the computers having no network connectivity)

That does not necessarily exclude kde system guard. You can run in a client/server kind of mode, where one computer just runs the display part, and the other computer runs the relatively small monitoring part. Whether this really is a sensible solution for your problem, or better than whatever else you might come up with, I really don't know, but I just wanted to mention that it might still be a possibility.

Anyway, cpufreq-info should do what you want. -f gives you just the frequency, rather than giving you several lines, which include the frequency on one of them, and c allows you to specify a core; you may have to specify, eg, core 0 and core 1 alternately, because I can't see a way of specifying *, or something, for 'give me all the cores that you've got'. (Maybe, that's only 1, which would render that point moot.) This will give you a file, and then you'll have to do something with it.

I thought that maybe collectl would do it, because that can be fairly neat, but I can't see from the man page any reference to current cpu clock.

Thanks, i will try this.

Edward18 01-30-2012 02:53 AM

Quote:

Originally Posted by salasi (Post 4586060)
and



If
  • by system monitor you mean the kde system monitor (also known as kde system guard)
and
  • by remote system you mean a computer that is connected to a LAN and there is data transmission between the LAN and the monitoring computer (ie, not blocked by, eg, a firewall or one of the computers having no network connectivity)

That does not necessarily exclude kde system guard. You can run in a client/server kind of mode, where one computer just runs the display part, and the other computer runs the relatively small monitoring part. Whether this really is a sensible solution for your problem, or better than whatever else you might come up with, I really don't know, but I just wanted to mention that it might still be a possibility.

Anyway, cpufreq-info should do what you want. -f gives you just the frequency, rather than giving you several lines, which include the frequency on one of them, and c allows you to specify a core; you may have to specify, eg, core 0 and core 1 alternately, because I can't see a way of specifying *, or something, for 'give me all the cores that you've got'. (Maybe, that's only 1, which would render that point moot.) This will give you a file, and then you'll have to do something with it.

I thought that maybe collectl would do it, because that can be fairly neat, but I can't see from the man page any reference to current cpu clock.

I've tried cpufreq but it says that no or unkown cpufreq driver is active on this CPU. What am i gonna do now, do i need to install proper drivers for my CPU, or i must configure them somehow?

Edward18 01-31-2012 02:57 AM

Quote:

Originally Posted by catkin (Post 4586501)
Yes -- I included in the excerpt to show that "cpu MHz" is the current frequency.

OK if "cpu MHz" is the current frequency, so how i can get max speed??????

Edward18 01-31-2012 03:35 AM

SOLVED !!!!! Now i can find my max and current speed. If anyone is interested: sudo dmidecode -t 4 | grep Max\ Speed this for max cpu speed and for current: sudo dmidecode -t 4 | grep Current\ Speed.

markseger 01-31-2012 12:50 PM

collectl know all! ;)

collectl --import misc
waiting for 1 second sample...
#<------Misc------>
# UTim MHz MT Log
2 2394 0 3

you can even combine with other things:

collectl --import misc -scn
waiting for 1 second sample...
#<--------CPU--------><----------Network----------><------Misc------>
#cpu sys inter ctxsw KBIn PktIn KBOut PktOut UTim MHz MT Log
0 0 26 46 0 1 0 1 2 2394 0 3
2 2 25 31 0 1 0 1 2 2394 0 3


-mark

Edward18 02-01-2012 07:35 AM

Quote:

Originally Posted by markseger (Post 4589520)
collectl know all! ;)

collectl --import misc
waiting for 1 second sample...
#<------Misc------>
# UTim MHz MT Log
2 2394 0 3

you can even combine with other things:

collectl --import misc -scn
waiting for 1 second sample...
#<--------CPU--------><----------Network----------><------Misc------>
#cpu sys inter ctxsw KBIn PktIn KBOut PktOut UTim MHz MT Log
0 0 26 46 0 1 0 1 2 2394 0 3
2 2 25 31 0 1 0 1 2 2394 0 3


-mark


Nice :) Thanks Mark.


All times are GMT -5. The time now is 12:55 PM.