Quote:
Originally Posted by titouzb
Hi all,
There's a easier way to get CPU frequency on HP-UX 11 :
echo "itick_per_usec/D" | /usr/bin/adb -k /stand/vmunix /dev/mem
Cheers.
Interesting. That works on HP-UX 10.20 as well. itick_per_usec is a new one on me. I knew about itick_per_tick but you need to multiply that by hz and then divide by 1,000,000. itick_per_tick is really what the pstat system call is returning. Since hz has been 100 forever, PxT is effectively doing the same calculation.
Even though the variable you mention avoids the need for arithmetic, adb is doing a fair amount of work to extract that data (as it must to extract any data). pstat is a single system call. That is not a real big deal here, but in a program to, say, monitor free memory on a busy system, it can start to matter. Also using adb requires read permission on /dev/mem and there are security concerns in making all of /dev/mem available. pstat() can be invoked by a any user.
I have several korn scripts that use adb to extract data from the kernel. I am in the process of rewriting them in perl using pstat(). They are faster and I can run them without special privileges. The real problem I am encountering is that pstat() does not have everything. I have been able to get some more stuff with the sysinfo() call, but I still have not found everything. So some scripts may still need adb.