summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-12-13 15:29:23 +0100
committerDaniel Friesel <derf@finalrewind.org>2017-12-13 15:29:23 +0100
commite9bebe253fdecee009414bdce7ccdfba83f980e6 (patch)
tree49330d7108869ddfbe8682fb6f20ff79794f57b5 /include
parent22f2335259594569ba4a95544939ef72f3d1bb9d (diff)
add simple cache benchmark application
Diffstat (limited to 'include')
-rw-r--r--include/esp8266/driver/uptime.h13
-rw-r--r--include/msp430fr5969lp/driver/uptime.h5
-rw-r--r--include/posix/driver/uptime.h4
3 files changed, 19 insertions, 3 deletions
diff --git a/include/esp8266/driver/uptime.h b/include/esp8266/driver/uptime.h
index 7da10cb..21740c9 100644
--- a/include/esp8266/driver/uptime.h
+++ b/include/esp8266/driver/uptime.h
@@ -1,6 +1,10 @@
#ifndef UPTIME_H
#define UPTIME_H
+extern "C" {
+#include "osapi.h"
+#include "user_interface.h"
+}
#include "c_types.h"
class Uptime {
@@ -9,7 +13,14 @@ class Uptime {
public:
Uptime () {}
- uint32_t get();
+ inline uint32_t get_us() { return system_get_time(); }
+
+ inline uint32_t get_cycles()
+ {
+ uint32_t ccount;
+ asm volatile ("esync; rsr %0,ccount":"=a" (ccount));
+ return ccount;
+ }
};
extern Uptime uptime;
diff --git a/include/msp430fr5969lp/driver/uptime.h b/include/msp430fr5969lp/driver/uptime.h
index f18a7fe..eaa7203 100644
--- a/include/msp430fr5969lp/driver/uptime.h
+++ b/include/msp430fr5969lp/driver/uptime.h
@@ -1,6 +1,7 @@
#ifndef UPTIME_H
#define UPTIME_H
+#include <msp430.h>
#include <stdint.h>
class Uptime {
@@ -9,7 +10,9 @@ class Uptime {
public:
Uptime () {}
- uint32_t get();
+ inline uint16_t get_us() { return TA0R; }
+ inline uint16_t get_s() { return 0; }
+ inline uint16_t get_cycles() { return TA2R; }
};
extern Uptime uptime;
diff --git a/include/posix/driver/uptime.h b/include/posix/driver/uptime.h
index c92ccf1..93711b9 100644
--- a/include/posix/driver/uptime.h
+++ b/include/posix/driver/uptime.h
@@ -9,7 +9,9 @@ class Uptime {
public:
Uptime () {}
- uint64_t get();
+ uint64_t get_s();
+ uint64_t get_us();
+ uint64_t get_cycles();
};
extern Uptime uptime;