ROSS
armv7l.c
Go to the documentation of this file.
1 /*
2  This implementation of an ARM v7 clock reader utilizes the
3  Performance Monitoring Unit (PMU) on Cortex-A7 chips.
4  Unfortunately, access to the cycle counter from userspace
5  is disabled by default. A kernel module that enables access
6  from userspace is required or the system will fault.
7 
8  An example kernel module that does just that can be found:
9  https://github.com/nmcglohon/armv7l-userspace-counter.git
10 
11  More information can be found:
12  http://neocontra.blogspot.com/2013/05/user-mode-performance-counters-for.html
13  */
14 
15 #include <ross.h>
16 
17 #ifndef __GNUC__
18 # error gcc asm extensions required
19 #endif
20 #if ! (defined(__arm__))
21 # error only 32 bit arm platform supported
22 #endif
23 
24 static const tw_optdef clock_opts [] =
25 {
26  TWOPT_GROUP("ROSS Timing"),
27  TWOPT_STIME("clock-rate", g_tw_clock_rate, "CPU Clock Rate"),
28  TWOPT_END()
29 };
30 
32 {
33  return clock_opts;
34 }
35 
36 
37 void tw_clock_init(tw_pe * me)
38 {
39  me->clock_time = 0;
41 }
42 
43 
45 {
47  return me->clock_time;
48 }
tw_clock tw_clock_now(tw_pe *me)
Definition: armv7l.c:44
unsigned long long g_tw_clock_rate
Definition: ross-global.c:98
static const tw_optdef clock_opts[]
Definition: armv7l.c:24
const tw_optdef * tw_clock_setup(void)
Definition: armv7l.c:31
static tw_clock tw_clock_read(void)
Definition: aarch64.h:6
Holds the entire PE state.
Definition: ross-types.h:375
#define TWOPT_STIME(n, v, h)
Definition: tw-opts.h:31
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
#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
void tw_clock_init(tw_pe *me)
Definition: armv7l.c:37