-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge release-7.2.0: * New default clock: get-time-of-day (#170) * STime API (#159) * Add ARMv7l arch support to ROSS (#155) * Fix to generate covage stats (#150) * changing damaris submodule/directory to risa * Updated README * Update to the way the build process grabs version number (#148) * simplifying the build of static or shared libraries (#147) * ROSS cleanup: -Wall, -Wextra, and more (#135)
- Loading branch information
Showing
33 changed files
with
416 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
This implementation of an ARM v7 clock reader utilizes the | ||
Performance Monitoring Unit (PMU) on Cortex-A7 chips. | ||
Unfortunately, access to the cycle counter from userspace | ||
is disabled by default. A kernel module that enables access | ||
from userspace is required or the system will fault. | ||
An example kernel module that does just that can be found: | ||
https://github.com/nmcglohon/armv7l-userspace-counter.git | ||
More information can be found: | ||
http://neocontra.blogspot.com/2013/05/user-mode-performance-counters-for.html | ||
*/ | ||
|
||
#include <ross.h> | ||
|
||
#ifndef __GNUC__ | ||
# error gcc asm extensions required | ||
#endif | ||
#if ! (defined(__arm__)) | ||
# error only 32 bit arm platform supported | ||
#endif | ||
|
||
static const tw_optdef clock_opts [] = | ||
{ | ||
TWOPT_GROUP("ROSS Timing"), | ||
TWOPT_STIME("clock-rate", g_tw_clock_rate, "CPU Clock Rate"), | ||
TWOPT_END() | ||
}; | ||
|
||
const tw_optdef *tw_clock_setup(void) | ||
{ | ||
return clock_opts; | ||
} | ||
|
||
|
||
void tw_clock_init(tw_pe * me) | ||
{ | ||
me->clock_time = 0; | ||
me->clock_offset = tw_clock_read(); | ||
} | ||
|
||
|
||
tw_clock tw_clock_now(tw_pe * me) | ||
{ | ||
me->clock_time = tw_clock_read() - me->clock_offset; | ||
return me->clock_time; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
This implementation of an ARM v7 clock reader utilizes the | ||
Performance Monitoring Unit (PMU) on Cortex-A7 chips. | ||
Unfortunately, access to the cycle counter from userspace | ||
is disabled by default. A kernel module that enables access | ||
from userspace is required or the system will fault. | ||
An example kernel module that does just that can be found: | ||
https://github.com/nmcglohon/armv7l-userspace-counter.git | ||
More information can be found: | ||
http://neocontra.blogspot.com/2013/05/user-mode-performance-counters-for.html | ||
*/ | ||
|
||
#ifndef INC_clock_armv7l | ||
#define INC_clock_armv7l | ||
|
||
typedef unsigned int tw_clock; | ||
|
||
static inline tw_clock tw_clock_read(void) | ||
{ | ||
unsigned int result; | ||
#ifdef ROSS_timing | ||
do { | ||
__asm__ __volatile__ ("MRC p15, 0, %0, c9, c13, 0" : "=r"(result)); | ||
} while (__builtin_expect ((int) result == -1, 0)); | ||
#endif | ||
|
||
return result; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include <ross.h> | ||
|
||
extern unsigned long long g_tw_clock_rate; | ||
|
||
static const tw_optdef clock_opts [] = | ||
{ | ||
TWOPT_GROUP("ROSS Timing"), | ||
TWOPT_ULONGLONG("clock-rate", g_tw_clock_rate, "CPU Clock Rate"), | ||
TWOPT_END() | ||
}; | ||
|
||
const tw_optdef *tw_clock_setup(void) | ||
{ | ||
return clock_opts; | ||
} | ||
|
||
tw_clock tw_clock_read(void) | ||
{ | ||
#ifdef ZERO_BASED | ||
static volatile int inited = 0; | ||
static volatile tw_clock base = 0; | ||
#else | ||
const tw_clock base = 0; | ||
#endif | ||
|
||
const tw_clock scale = 1000000; | ||
struct timeval tv; | ||
gettimeofday(&tv,NULL); | ||
|
||
#ifdef ZERO_BASED | ||
if(inited == 0) { | ||
base = ((tw_clock) tv.tv_sec)*scale + (tw_clock) tv.tv_usec; | ||
inited = 1; | ||
} | ||
#endif | ||
|
||
return | ||
(((tw_clock) tv.tv_sec)*scale + (tw_clock) tv.tv_usec) - base; | ||
} | ||
|
||
void | ||
tw_clock_init(tw_pe * me) | ||
{ | ||
me->clock_time = 0; | ||
me->clock_offset = tw_clock_read(); | ||
} | ||
|
||
tw_clock | ||
tw_clock_now(tw_pe * me) | ||
{ | ||
me->clock_time = tw_clock_read() - me->clock_offset; | ||
return me->clock_time; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef INC_clock_gtod | ||
#define INC_clock_gtod | ||
|
||
typedef uint64_t tw_clock; | ||
|
||
#endif |
Oops, something went wrong.