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
CPUSET(3)						   BSD Library Functions Manual 						 CPUSET(3)

NAME
cpuset_create, cpuset_destroy, cpuset_zero, cpuset_set, cpuset_clr, cpuset_isset, cpuset_size -- dynamic CPU sets SYNOPSIS
#include <sched.h> cpuset_t * cpuset_create(void); void cpuset_destroy(cpuset_t *set); void cpuset_zero(cpuset_t *set); int cpuset_set(cpuid_t cpu, cpuset_t *set); int cpuset_clr(cpuid_t cpu, cpuset_t *set); int cpuset_isset(cpuid_t cpu, const cpuset_t *set); size_t cpuset_size(const cpuset_t *set); DESCRIPTION
This section describes the functions used to create, set, use and destroy the dynamic CPU sets. This API can be used with the POSIX threads, see pthread(3) and affinity(3). The ID of the primary CPU in the system is 0. FUNCTIONS
cpuset_create() Allocates and initializes a clean CPU-set. Returns the pointer to the CPU-set, or NULL on failure. cpuset_destroy(set) Destroy the CPU-set specified by set. cpuset_zero(set) Makes the CPU-set specified by set clean, that is, memory is initialized to zero bytes, and none of the CPUs set. cpuset_set(cpu, set) Sets the CPU specified by cpu in set. Returns zero on success, and -1 if cpu is invalid. cpuset_clr(cpu, set) Clears the CPU specified by cpu in the CPU-set set. Returns zero on success, and -1 if cpu is invalid. cpuset_isset(cpu, set) Checks if CPU specified by cpu is set in the CPU-set set. Returns the positive number if set, zero if not set, and -1 if cpu is invalid. cpuset_size(set) Returns the size in bytes of CPU-set specified by set. SEE ALSO
affinity(3), pset(3), sched(3), schedctl(8), kcpuset(9) HISTORY
The dynamic CPU sets appeared in NetBSD 5.0. BSD
November 2, 2011 BSD