I\'ve got a piece of userspace code which is parsing /proc/PID/task/TID/stat to get the cpu usage. I can use HZ to get the jiffies per second but this code could move to an
Source of "ps" command include file to get value of HZ.
They also look for an "ELF note" with number 17 to find value of HZ (sysinfo.c):
//extern char** environ;
/* for ELF executables, notes are pushed before environment and args */
static unsigned long find_elf_note(unsigned long findme){
unsigned long *ep = (unsigned long *)environ;
while(*ep++);
while(*ep){
if(ep[0]==findme) return ep[1];
ep+=2;
}
return NOTE_NOT_FOUND;
}
[...]
hz = find_elf_note(17);
I have to admit it look weird for me since ELF notes is a section defined during compilation.