ROSS
ppc64le.c
Go to the documentation of this file.
1 #include <ross.h>
2 
3 extern unsigned long long g_tw_clock_rate;
4 
5 static const tw_optdef clock_opts [] =
6 {
7  TWOPT_GROUP("ROSS Timing"),
8  TWOPT_ULONGLONG("clock-rate", g_tw_clock_rate, "CPU Clock Rate"),
9  TWOPT_END()
10 };
11 
13 {
14 
15  // reset from default to 512MHz as that's the timebase for the POWER9 system.
16  g_tw_clock_rate = 512000000.0;
17  return clock_opts;
18 }
19 
21 {
22  unsigned int tbl, tbu0, tbu1;
23 
24  do {
25  __asm__ __volatile__ ("mftbu %0" : "=r"(tbu0));
26  __asm__ __volatile__ ("mftb %0" : "=r"(tbl));
27  __asm__ __volatile__ ("mftbu %0" : "=r"(tbu1));
28  } while (tbu0 != tbu1);
29 
30  return (((unsigned long long)tbu0) << 32) | tbl;
31 }
32 
33 void
35 {
36  me->clock_time = 0;
38 }
39 
42 {
44  return me->clock_time;
45 }
tw_clock tw_clock_now(tw_pe *me)
Definition: ppc64le.c:41
const tw_optdef * tw_clock_setup(void)
Definition: ppc64le.c:12
Holds the entire PE state.
Definition: ross-types.h:375
void tw_clock_init(tw_pe *me)
Definition: ppc64le.c:34
#define TWOPT_ULONGLONG(n, v, h)
Definition: tw-opts.h:29
unsigned long long g_tw_clock_rate
Definition: ross-global.c:98
tw_clock clock_offset
Initial clock value for this PE.
Definition: ross-types.h:396
tw_clock clock_time
Most recent clock value for this PE.
Definition: ross-types.h:397
static const tw_optdef clock_opts[]
Definition: ppc64le.c:5
#define TWOPT_END()
Definition: tw-opts.h:35
uint64_t tw_clock
Definition: aarch64.h:4
#define TWOPT_GROUP(h)
Definition: tw-opts.h:27
tw_clock tw_clock_read(void)
Definition: ppc64le.c:20