Changes to update Tomato RAF.
[tomato.git] / release / src / router / dnscrypt / src / libnacl / cpucycles / hppapstat.c
blob5ae1e843d333634fbecbbbcb0f3ffab7e1d393f6
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>
8 long long cpucycles_hppapstat(void)
10 register long long result;
11 _MFCTL(16,result);
12 return result;
15 long long cpucycles_hppapstat_persecond(void)
17 struct pst_processor pst;
18 union pstun pu;
19 double result;
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;