2008년 09월 02일
HP에서 장비 CPU 코어 개수 확인하는 프로그램
현철님이 알려준 HP에서 장비 CPU 코어 개수 확인하는 프로그램입니다.
--------------------------------------------------------------
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/pstat.h>
#define CPU_ID 0
#define MAX_ID 100
#define HZ_PER_MHZ 1000000
main() {
struct pst_processor pst;
union pstun pu;
int i, x=0, old_x = 0;
pu.pst_processor = &pst;
old_x = pstat( PSTAT_PROCESSOR, pu,(size_t)sizeof(pst), (size_t)1, i) ;
if (old_x != 1) break;
x= (int)(pst.psp_iticksperclktick * sysconf( _SC_CLK_TCK ) / HZ_PER_MHZ);
}
printf( "%d EA ( %d MHz)", i, x);
}
# by | 2008/09/02 10:27 | C++ | 트랙백



