Re: how to get cpu_khz?

David Fries (dfries@mail.win.org)
Mon, 17 Sep 2001 14:51:30 -0500


On Mon, Sep 17, 2001 at 03:11:26PM -0400, John Weber wrote:
> David Fries wrote:
> >
> > I'm using the TSC of the Pentium processors to get some precise timing
> > delays for writing to a eeprom (bit banging bus operations), and it
> > works just fine, but the cpu_khz variable isn't exported to a kernel
> > module, so I hardcoded in my module. It works fine for that one
> > system, but obviously I don't want to hard code it for the general
> > case. I guess I could write my own routine to figure out what the
> > cpu_khz is, but it is already done, so how do I get access to it?
>
> I don't know of any official way of doing this, but here's some
> code (written by aa) that accomplishes this.

For a user space program you could just read /proc/cpuinfo, I'm
actually writing a kernel driver, maybe I wasn't clear enough. I'm
just frustrated because the variable I'm after, cpu_khz is already
calculated at boot time (that's where /proc/cpuinfo gets its data) and
that variable doesn't appear to be exported to the rest of the kernel,
either that or I'm just missing something, which I would rather be the
case at this point.

-- 
		+---------------------------------+
		|      David Fries                |
		|      dfries@mail.win.org        |
		+---------------------------------+
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/