How to read hw.clockrate from a kernel module?

看板DFBSD_kernel作者時間14年前 (2011/10/25 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
Hi all, I've a little question: In platform/pc32/i386/identcpu.c there is the following variable defined: ------------------ static int hw_clockrate; SYSCTL_INT(_hw, OID_AUTO, clockrate, CTLFLAG_RD, &hw_clockrate, 0, "CPU instruction clock rate"); ------------------ I suppose it contains the current cpu speed in Mhz. How can I properly read it's content from a kernel module? Is it correct to do that? -------------- const size_t var_size = sizeof(int); int cpu_mhz; kernel_sysctlbyname("hw.clockrate", &cpu_mhz, &var_size, NULL, 0, NULL); -------------- Thanks for the help, -- -------------------- Maurizio Lombardi
文章代碼(AID): #1EfQVczD (DFBSD_kernel)
文章代碼(AID): #1EfQVczD (DFBSD_kernel)