summaryrefslogtreecommitdiff
path: root/nacl/cpucycles/hppapstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'nacl/cpucycles/hppapstat.c')
-rw-r--r--nacl/cpucycles/hppapstat.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/nacl/cpucycles/hppapstat.c b/nacl/cpucycles/hppapstat.c
new file mode 100644
index 00000000..5ae1e843
--- /dev/null
+++ b/nacl/cpucycles/hppapstat.c
@@ -0,0 +1,26 @@
1#include <stdio.h>
2#include <unistd.h>
3#include <sys/types.h>
4#include <sys/param.h>
5#include <sys/pstat.h>
6#include <machine/inline.h>
7
8long long cpucycles_hppapstat(void)
9{
10 register long long result;
11 _MFCTL(16,result);
12 return result;
13}
14
15long long cpucycles_hppapstat_persecond(void)
16{
17 struct pst_processor pst;
18 union pstun pu;
19 double result;
20
21 pu.pst_processor = &pst;
22 if (pstat(PSTAT_PROCESSOR,pu,sizeof(pst),1,0) < 0) return 0;
23 result = pst.psp_iticksperclktick;
24 result *= (double) sysconf(_SC_CLK_TCK);
25 return result;
26}