From 4138208d452b18f3d12926ff9cba9097e926558b Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Mon, 8 Apr 2019 21:31:15 +0200 Subject: exemples d'accès mémoire lents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/monniaux/slow_globals/slow_globals.c | 15 +++++++++++++++ test/monniaux/slow_globals/slow_globals2.c | 2 ++ test/monniaux/volatile/slow_volatile.c | 14 ++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 test/monniaux/slow_globals/slow_globals.c create mode 100644 test/monniaux/slow_globals/slow_globals2.c create mode 100644 test/monniaux/volatile/slow_volatile.c diff --git a/test/monniaux/slow_globals/slow_globals.c b/test/monniaux/slow_globals/slow_globals.c new file mode 100644 index 00000000..636f5861 --- /dev/null +++ b/test/monniaux/slow_globals/slow_globals.c @@ -0,0 +1,15 @@ +#include "../clock.h" + +extern void nothing(void); +int variable; + +int main() { + clock_prepare(); + clock_start(); + for(int i=0; i<1000; i++) { + variable++; + nothing(); + } + clock_stop(); + print_total_clock(); +} diff --git a/test/monniaux/slow_globals/slow_globals2.c b/test/monniaux/slow_globals/slow_globals2.c new file mode 100644 index 00000000..b68a6ebf --- /dev/null +++ b/test/monniaux/slow_globals/slow_globals2.c @@ -0,0 +1,2 @@ +void nothing(void) { +} diff --git a/test/monniaux/volatile/slow_volatile.c b/test/monniaux/volatile/slow_volatile.c new file mode 100644 index 00000000..bbbc6ddf --- /dev/null +++ b/test/monniaux/volatile/slow_volatile.c @@ -0,0 +1,14 @@ +#include "../clock.h" + +volatile int output; + +int main() { + clock_prepare(); + clock_start(); + for(int i=0; i<1000; i++) { + output = 0; + } + clock_stop(); + print_total_clock(); + return 0; +} -- cgit