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
PAPI_hw_info_t(3)						       PAPI							 PAPI_hw_info_t(3)

NAME
PAPI_hw_info_t - Hardware info structure. SYNOPSIS
Data Fields int ncpu int threads int cores int sockets int nnodes int totalcpus int vendor char vendor_string [128] int model char model_string [128] float revision int cpuid_family int cpuid_model int cpuid_stepping int cpu_max_mhz int cpu_min_mhz PAPI_mh_info_t mem_hierarchy int virtualized char virtual_vendor_string [128] char virtual_vendor_version [128] float mhz int clock_mhz int reserved [8] Field Documentation int PAPI_hw_info_t::clock_mhz Deprecated int PAPI_hw_info_t::cores Number of cores per socket int PAPI_hw_info_t::cpu_max_mhz Maximum supported CPU speed int PAPI_hw_info_t::cpu_min_mhz Minimum supported CPU speed int PAPI_hw_info_t::cpuid_family cpuid family int PAPI_hw_info_t::cpuid_model cpuid model int PAPI_hw_info_t::cpuid_stepping cpuid stepping PAPI_mh_info_t PAPI_hw_info_t::mem_hierarchy PAPI memory heirarchy description float PAPI_hw_info_t::mhz Deprecated int PAPI_hw_info_t::model Model number of CPU char PAPI_hw_info_t::model_string[128] Model string of CPU int PAPI_hw_info_t::ncpu Number of CPUs per NUMA Node int PAPI_hw_info_t::nnodes Total Number of NUMA Nodes float PAPI_hw_info_t::revision Revision of CPU int PAPI_hw_info_t::sockets Number of sockets int PAPI_hw_info_t::threads Number of hdw threads per core int PAPI_hw_info_t::totalcpus Total number of CPUs in the entire system int PAPI_hw_info_t::vendor Vendor number of CPU char PAPI_hw_info_t::vendor_string[128] Vendor string of CPU char PAPI_hw_info_t::virtual_vendor_string[128] Vendor for virtual machine char PAPI_hw_info_t::virtual_vendor_version[128] Version of virtual machine int PAPI_hw_info_t::virtualized Running in virtual machine Author Generated automatically by Doxygen for PAPI from the source code. Version 5.2.0.0 Tue Jun 17 2014 PAPI_hw_info_t(3)