-
CPU details programmaticaly
Hello everyone,
i'm trying to figure out how to obtain:
- mhz
- cpu usage
- /proc/cpuinfo details
programatically without parsing /proc/* at all.
Some details might be taken via asm, sysinfo...
i am willing to write a small code for my agent that would print those details by using system calls - rather than parsing the files on the fs.
Any idea ?
-
Take a look at the kernel code that generates the info in the /proc directory ...
-
-
Why?
Seriously -- it's trivial to parse these files (especially with something like grep + sed, or perl, or whatever). It's really really hard to figure out this information from userspace. Since the kernel already exports it, just use what you already have!
Unless, of course, it's a homework assignment to do it the other way. (It doesn't sound quite like one, but given the specificity, it might be.) In that case, ask whoever assigned it to you for some help.
-
I agree with bwkaz, something smells like textbook. Expecially when that's what /proc is for.
asm for finding CPU values? Talk about going to the long way!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|