linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Get the min and max frequency of a processor
@ 2012-08-30 17:48 Marcos Souza
  2012-08-31  8:37 ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Marcos Souza @ 2012-08-30 17:48 UTC (permalink / raw)
  To: linux-kernel

Hi people,

I'm changing an application to get the min and max frequency of a
processor. The device is using cpufreq, and it will show the user  the
min and max frequency that we can overclock.

There is a way to get these values, instead of reading the /sys files,
or is this the solution?

Thanks for your time.

-- 
Att,

Marcos Paulo de Souza
Acadêmico de Ciencia da Computação - FURB - SC
"Uma vida sem desafios é uma vida sem razão"
"A life without challenges, is a non reason life"

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get the min and max frequency of a processor
  2012-08-30 17:48 Get the min and max frequency of a processor Marcos Souza
@ 2012-08-31  8:37 ` Borislav Petkov
  2012-08-31  9:52   ` Marcos Souza
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2012-08-31  8:37 UTC (permalink / raw)
  To: Marcos Souza; +Cc: linux-kernel

On Thu, Aug 30, 2012 at 02:48:33PM -0300, Marcos Souza wrote:
> Hi people,
> 
> I'm changing an application to get the min and max frequency of a
> processor. The device is using cpufreq, and it will show the user  the
> min and max frequency that we can overclock.
> 
> There is a way to get these values, instead of reading the /sys files,
> or is this the solution?

What's wrong with using:

/sys/devices/system/cpu/cpu<N>/cpufreq/scaling_available_frequencies

?

-- 
Regards/Gruss,
    Boris.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get the min and max frequency of a processor
  2012-08-31  8:37 ` Borislav Petkov
@ 2012-08-31  9:52   ` Marcos Souza
  2012-08-31 12:26     ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Marcos Souza @ 2012-08-31  9:52 UTC (permalink / raw)
  To: Borislav Petkov, Marcos Souza, linux-kernel

Hi Borislav,

2012/8/31 Borislav Petkov <bp@alien8.de>:
> On Thu, Aug 30, 2012 at 02:48:33PM -0300, Marcos Souza wrote:
>> Hi people,
>>
>> I'm changing an application to get the min and max frequency of a
>> processor. The device is using cpufreq, and it will show the user  the
>> min and max frequency that we can overclock.
>>
>> There is a way to get these values, instead of reading the /sys files,
>> or is this the solution?
>
> What's wrong with using:
>
> /sys/devices/system/cpu/cpu<N>/cpufreq/scaling_available_frequencies
>
> ?

Nothing is wrong with access /sys, but I thought there was another
way, like an API or something else.

I use your solution Borislav, thanks!

> --
> Regards/Gruss,
>     Boris.



-- 
Att,

Marcos Paulo de Souza
Acadêmico de Ciencia da Computação - FURB - SC
"Uma vida sem desafios é uma vida sem razão"
"A life without challenges, is a non reason life"

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get the min and max frequency of a processor
  2012-08-31  9:52   ` Marcos Souza
@ 2012-08-31 12:26     ` Borislav Petkov
  2012-09-01 20:26       ` Marcos Souza
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2012-08-31 12:26 UTC (permalink / raw)
  To: Marcos Souza; +Cc: linux-kernel

On Fri, Aug 31, 2012 at 06:52:46AM -0300, Marcos Souza wrote:
> Nothing is wrong with access /sys, but I thought there was another
> way, like an API or something else.

Ah, there's no API, AFAICT.

Also, tools/power/cpupower/ uses sysfs too - you could reuse that
code if you don't feel like writing it yourself. The function is
cpufreq_get_hardware_limits()

Ok, technically, there is also a way to query the CPU's MSRs directly
but this is a bit more involved than reading sysfs nodes.

HTH.

-- 
Regards/Gruss,
Boris.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Get the min and max frequency of a processor
  2012-08-31 12:26     ` Borislav Petkov
@ 2012-09-01 20:26       ` Marcos Souza
  0 siblings, 0 replies; 5+ messages in thread
From: Marcos Souza @ 2012-09-01 20:26 UTC (permalink / raw)
  To: Borislav Petkov, linux-kernel

2012/8/31 Borislav Petkov <bp@alien8.de>:
> On Fri, Aug 31, 2012 at 06:52:46AM -0300, Marcos Souza wrote:
>> Nothing is wrong with access /sys, but I thought there was another
>> way, like an API or something else.
>
> Ah, there's no API, AFAICT.
>
> Also, tools/power/cpupower/ uses sysfs too - you could reuse that
> code if you don't feel like writing it yourself. The function is
> cpufreq_get_hardware_limits()

I will take a look in the cpupower.

> Ok, technically, there is also a way to query the CPU's MSRs directly
> but this is a bit more involved than reading sysfs nodes.

My application don't need this complexity. I believe the /sys nodes
ould help me.

> HTH.
>
> --
> Regards/Gruss,
> Boris.

Thanks Borislav for showing to me all available choises to do this job!


-- 
Att,

Marcos Paulo de Souza
Acadêmico de Ciencia da Computação - FURB - SC
"Uma vida sem desafios é uma vida sem razão"
"A life without challenges, is a non reason life"

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-09-01 20:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-30 17:48 Get the min and max frequency of a processor Marcos Souza
2012-08-31  8:37 ` Borislav Petkov
2012-08-31  9:52   ` Marcos Souza
2012-08-31 12:26     ` Borislav Petkov
2012-09-01 20:26       ` Marcos Souza

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).