get CPU speed use pstat APIs


 
Thread Tools Search this Thread
Operating Systems HP-UX get CPU speed use pstat APIs
# 1  
Old 04-18-2009
get CPU speed use pstat APIs

I get my CPU speed use pstat APIs
use this program serach google and just test it
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/pstat.h>
#define CPU_ID 0
#define HZ_PER_MHZ 1000000
int main()
{
struct pst_processor pst;
union pstun pu;

pu.pst_processor = &pst;
pstat( PSTAT_PROCESSOR, pu, (size_t)sizeof(pst), (size_t)1, CPU_ID);
printf( "%d MHz\n",(int)((double)pst.psp_iticksperclktick * sysconf( _SC_CLK_TCK ) / HZ_PER_MHZ) );

return 0;
}


the resutl shows 399MZ
but I use machinfo command shows 1.59Gz

what's wrong with that code or my machine

my OS is HP UX 11.31 Itanium base
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Rsync quite slow (using very little cpu): how to improve its speed?

I have "inherited" a OmniOS (illumos based) server. I noticed rsync is significantly slower in respect to my reference, FreeBSD 12-CURRENT, running on exactly same hardware. Using same hardware, same command with same source and target disks, OmniOS r151026 gives: test@omniosce:~# time... (11 Replies)
Discussion started by: priyadarshan
11 Replies

2. Solaris

T5140 CPU Speed is 1200 Mhz or 1165 Mhz?

Hi bros, CPU speed of Sun Sparc Enterprise T5140 in data sheet is 1200 Mhz. Why it shows in "prtdiag -v" command each thread just has speed at 1165 Mhz. Thank you, tien86 (4 Replies)
Discussion started by: tien86
4 Replies

3. HP-UX

Help me in finding process name and argument list without using pstat()

Hi everybody, I have an application which displayes the process name and argument list for that each and every process running on the system. For this purpose the application used the pstat_getproc() method which fetches the structure pst_status. By this method we get the programm name up to 15... (0 Replies)
Discussion started by: sardesh3
0 Replies

4. Filesystems, Disks and Memory

data from blktrace: read speed V.S. write speed

I analysed disk performance with blktrace and get some data: read: 8,3 4 2141 2.882115217 3342 Q R 195732187 + 32 8,3 4 2142 2.882116411 3342 G R 195732187 + 32 8,3 4 2144 2.882117647 3342 I R 195732187 + 32 8,3 4 2145 ... (1 Reply)
Discussion started by: W.C.C
1 Replies

5. Solaris

Solaris10 x86 - How to find out the CPU model and speed?

Please let me know if there is any way I can find out (either via command line or SMF) the following: 1.CPU model (eg. Pentium 4,Celeron) 2.CPU speed (eg. 1GHz) for this I could get the output through psrinfo -v, but still is there any other way? 3.Hard disk model (eg. Seagate). When I... (9 Replies)
Discussion started by: saagar
9 Replies

6. Linux

How to find CPU Speed of zLinux

Need to find CPU Speed of zLinux. The commands like cat /proc/cpuinfo and /usr/bin/cpufreq-info does not gave me the expected results. /usr/bin/cpufreq-info prints the .... analyzing CPU 0: no or unknown cpufreq driver is active on this CPU analyzing CPU 1: no or unknown cpufreq... (1 Reply)
Discussion started by: surajb
1 Replies

7. HP-UX

How to find CPU Speed of HP UX

Need to find the CPU speed of HP UX for a non root login. echo "itick_per_usec/D" | adb /stand/vmunix /dev/mem | tail -1 will give the following for non root users ERROR: cannot open `/dev/mem', errno = 13, Permission denied (2 Replies)
Discussion started by: surajb
2 Replies

8. HP-UX

Get CPU speed without root permissions

How can I get the CPUs speed without root permissions? Thanks. (2 Replies)
Discussion started by: psimoes79
2 Replies

9. UNIX for Dummies Questions & Answers

bus speed and CPU info

Hi, Is there a command I can use to find out how many CPU's and what type are on my server? (I was told to use cat /proc/cpuinfo) Also, how do I know what kind of bus speeds are on my server? Thanks in advance:) (3 Replies)
Discussion started by: ihot
3 Replies

10. AIX

cpu speed

how do i determine the speed of a cpu on AIX 4.3.3 or 5.1? (5 Replies)
Discussion started by: csaunders
5 Replies
Login or Register to Ask a Question
cfspeed(3C)															       cfspeed(3C)

NAME
cfgetospeed(), cfsetospeed(), cfgetispeed(), cfsetispeed() - tty baud rate functions SYNOPSIS
DESCRIPTION
These functions set and get the input and output speed codes in the termios structure referenced by termios_p. The termios structure con- tains these speed codes representing input and output baud rates as well as other terminal related parameters. Setting the parameters on a terminal file does not become effective until is successfully called. returns the output speed code from the termios structure referenced by termios_p. sets the output speed code in the termios structure referenced by termios_p to speed. The speed code for a baud rate of zero, is used to termi- nate the connection. If is specified, the modem control lines are no longer asserted, which normally discon- nects the line. returns the input speed code from the termios structure referenced by termios_p. sets the input speed code in the termios structure referenced by termios_p to speed. RETURN VALUE
returns the output speed code from the termios structure referenced by termios_p. returns the input speed code from the termios structure referenced by termios_p. and return zero upon successful completion. Otherwise, they return -1 and set to indicate the error. ERRORS
and fail when the following condition is encountered: [EINVAL] The value of speed is outside the range of possible speed codes as specified in WARNINGS
and can be used to set speed codes in the termios structure that are not supported by the terminal hardware. SEE ALSO
tcattribute(3C), thread_safety(5), termio(7). STANDARDS CONFORMANCE
cfspeed(3C)