serval-dna/nacl/nacl-20110221/cpucycles/hppapstat.c
Daniel O'Connor bf9710fd5a Unpacked nacl-20110221 after processing by nacl-prepare-sources.
This only affects build_android, if nacl-gcc-prep is run then build/`uname -s` will be created.
2012-02-27 12:40:14 +10:30

27 lines
546 B
C

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/pstat.h>
#include <machine/inline.h>
long long cpucycles_hppapstat(void)
{
register long long result;
_MFCTL(16,result);
return result;
}
long long cpucycles_hppapstat_persecond(void)
{
struct pst_processor pst;
union pstun pu;
double result;
pu.pst_processor = &pst;
if (pstat(PSTAT_PROCESSOR,pu,sizeof(pst),1,0) < 0) return 0;
result = pst.psp_iticksperclktick;
result *= (double) sysconf(_SC_CLK_TCK);
return result;
}