ROSS
i386.c
Go to the documentation of this file.
1 #include <ross.h>
2 
3 #ifndef __GNUC__
4 # error gcc asm extensions required
5 #endif
6 #ifndef __i386__
7 # error only i386 platform supported
8 #endif
9 
10 static const tw_optdef clock_opts [] =
11 {
12  TWOPT_GROUP("ROSS Timing"),
13  TWOPT_ULONGLONG("clock-rate", g_tw_clock_rate, "CPU Clock Rate"),
14  TWOPT_END()
15 };
16 
18 {
19  return clock_opts;
20 }
21 
23 {
24  tw_clock result;
25  do {
26  __asm__ __volatile__("rdtsc" : "=A" (result));
27  } while (__builtin_expect ((int) result == -1, 0));
28  return result;
29 }
30 
31 void
33 {
34  me->clock_time = 0;
36 }
37 
40 {
42  return me->clock_time;
43 }
unsigned long long g_tw_clock_rate
Definition: ross-global.c:98
void tw_clock_init(tw_pe *me)
Definition: i386.c:32
Holds the entire PE state.
Definition: ross-types.h:375
static const tw_optdef clock_opts[]
Definition: i386.c:10
const tw_optdef * tw_clock_setup(void)
Definition: i386.c:17
#define TWOPT_ULONGLONG(n, v, h)
Definition: tw-opts.h:29
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
tw_clock tw_clock_read(void)
Definition: i386.c:22
#define TWOPT_END()
Definition: tw-opts.h:35
tw_clock tw_clock_now(tw_pe *me)
Definition: i386.c:39
uint64_t tw_clock
Definition: aarch64.h:4
#define TWOPT_GROUP(h)
Definition: tw-opts.h:27