summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--SConstruct2
-rw-r--r--bin/pm_polluter.c40
2 files changed, 41 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index 7d0525d..85deeec 100644
--- a/SConstruct
+++ b/SConstruct
@@ -191,7 +191,7 @@ pmpy.Replace(LINKFLAGS = '')
191# Preemption and migration overhead analysis 191# Preemption and migration overhead analysis
192 192
193pmrt.Program('pm_task', ['bin/pm_task.c', 'bin/pm_common.c']) 193pmrt.Program('pm_task', ['bin/pm_task.c', 'bin/pm_common.c'])
194 194pmrt.Program('pm_polluter', ['bin/pm_polluter.c', 'bin/pm_common.c'])
195# ##################################################################### 195# #####################################################################
196# Additional Help 196# Additional Help
197 197
diff --git a/bin/pm_polluter.c b/bin/pm_polluter.c
new file mode 100644
index 0000000..db63b48
--- /dev/null
+++ b/bin/pm_polluter.c
@@ -0,0 +1,40 @@
1/*
2 * pm_be_polluter.c
3 *
4 * Best Effort Cache Polluter Task
5 */
6#include "pm_common.h"
7#include "pm_arch.h"
8#include "asm.h"
9
10int mem_block[NUMWS][INTS_PER_WSS] __attribute__ ((aligned(CACHEALIGNMENT)));
11
12int main(int argc, char **argv)
13{
14 int read, *loc_ptr;
15
16 memset(&mem_block, 0, sizeof(int) * NUMWS * INTS_PER_WSS);
17
18 /* Initialize random library for read/write ratio enforcement. */
19 srandom(SEEDVAL);
20
21 while(1) {
22 read = (random() % 100) < READRATIO;
23 loc_ptr = &mem_block[random() % NUMWS][0];
24 loc_ptr += (random() % INTS_PER_WSS);
25
26 barrier();
27
28 if (read)
29 read_mem(loc_ptr);
30 else
31 write_mem(loc_ptr);
32
33 /* FIXME is really needed? */
34 usleep(40);
35 }
36
37 /* never reached */
38 return 0;
39}
40