Skip to content

Commit 01407e6

Browse files
committed
Port benchmarks to align with bodyless-reactions a1c98f6f73e88d0dfecd5dfaf5e24a4439984f34
1 parent d2994c9 commit 01407e6

File tree

16 files changed

+91
-58
lines changed

16 files changed

+91
-58
lines changed

C/Savina/src/concurrency/SleepingBarber.lf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ import BenchmarkRunner from "../BenchmarkRunner.lf";
6262
preamble {=
6363

6464
#include "PseudoRandom.h"
65+
#include "deque.h"
6566

66-
size_t busyWait(size_t limit) {
67+
static size_t busyWait(size_t limit) {
6768
size_t test = 0;
6869
for(size_t k = 0; k < limit; k++) {
6970
// The Java Math.random() is used as workload in the original Akka Savina benchmark suite.
@@ -171,9 +172,6 @@ reactor CustomerFactory(numCustomers:size_t(2000), averageProductionRate:size_t(
171172
* to the customer ID.
172173
*/
173174
reactor WaitingRoom(capacity:size_t(1000), numCustomers:size_t(2000)) {
174-
preamble {=
175-
#include "deque.c"
176-
=}
177175

178176
input reset_state:bool;
179177
input receiveCustomer: size_t;

C/Savina/src/concurrency/SortedList.lf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ preamble {=
4242
access_type type;
4343
int value;
4444
} message_t;
45+
46+
template <typename T>
47+
class SortedLinkedList;
48+
#include "PseudoRandom.h"
4549
=}
4650

4751
reactor Manager(numWorkers: size_t(20)) {

C/Savina/src/micro/Big.lf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ target C{
4040

4141
import BenchmarkRunner from "../BenchmarkRunner.lf";
4242

43+
preamble {=
44+
#include "PseudoRandom.h"
45+
=}
46+
4347
// Despite the name, this only collects "finished" messages from all workers
4448
// and lets the benchmark runner know when all the workers finished
4549
reactor Sink(num_workers:size_t(10)) {

C/Savina/src/micro/Chameneos.lf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ target C {
5555
import BenchmarkRunner from "../BenchmarkRunner.lf";
5656

5757
preamble {=
58-
char const* color_names[] = {"Red", "Yellow", "Blue", "Faded"};
58+
static char const* color_names[] = {"Red", "Yellow", "Blue", "Faded"};
5959

6060
typedef enum {
6161
RED,
@@ -79,7 +79,7 @@ preamble {=
7979
int id;
8080
} msg_t;
8181

82-
color_t complement(const color_t color, const color_t otherColor) {
82+
static color_t complement(const color_t color, const color_t otherColor) {
8383
switch(color) {
8484
case RED:
8585
switch(otherColor) {

C/Savina/src/micro/Counting.lf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,18 @@ target C {
4747
else:
4848
cog.outl("threading: false,")
4949
]]] */
50+
files: ["../include/benchmark_runner.h"],
5051
threading: false,
5152
/// [[[end]]]
5253
fast: true
5354
}
5455

5556
import BenchmarkRunner from "../BenchmarkRunner.lf";
5657

58+
preamble {=
59+
#include "benchmark_runner.h"
60+
=}
61+
5762
reactor ProducerReactor(countTo:int(1000000)) {
5863

5964

C/Savina/src/micro/PingPong.lf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,18 @@ target C {
3131
else:
3232
cog.outl("threading: false,")
3333
]]] */
34+
files: ["../include/benchmark_runner.h"],
3435
threading: false,
3536
/// [[[end]]]
3637
fast: true
3738
};
3839

3940
import BenchmarkRunner from "../BenchmarkRunner.lf";
4041

42+
preamble {=
43+
#include "benchmark_runner.h"
44+
=}
45+
4146
reactor Ping(count:int(1000000)) {
4247
input receive:int;
4348
input start:bool;

C/Savina/src/micro/ThreadRing.lf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ target C {
6060
else:
6161
cog.outl("threading: false,")
6262
]]] */
63+
files: ["../include/benchmark_runner.h"],
6364
threading: false,
6465
/// [[[end]]]
6566
fast: true,
@@ -69,21 +70,22 @@ target C {
6970
import BenchmarkRunner from "../BenchmarkRunner.lf";
7071

7172
preamble {=
72-
int ping;
73+
#include "benchmark_runner.h"
74+
static int ping;
7375

74-
bool hasNext(int ping) {
76+
static bool hasNext(int ping) {
7577
if (ping > 0) {
7678
return true;
7779
} else {
7880
return false;
7981
}
8082
}
8183

82-
int getPingsLeft(int ping) {
84+
static int getPingsLeft(int ping) {
8385
return ping;
8486
}
8587

86-
int ping_next(int ping) {
88+
static int ping_next(int ping) {
8789
return ping - 1;
8890
}
8991
=}

C/Savina/src/micro/Throughput.lf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ target C {
6161
else:
6262
cog.outl("threading: false,")
6363
]]] */
64+
files: ["../include/benchmark_runner.h"],
6465
threading: false,
6566
/// [[[end]]]
6667
flags: "-lm",
@@ -69,6 +70,10 @@ target C {
6970

7071
import BenchmarkRunner from "../BenchmarkRunner.lf";
7172

73+
preamble {=
74+
#include "benchmark_runner.h"
75+
=}
76+
7277
reactor ThroughputReactor(totalMessages:int(10000)) {
7378

7479
preamble {=

C/Savina/src/parallelism/Apsp.lf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,19 @@ target C {
3030
/// [[[end]]]
3131
build-type : RelWithDebInfo,
3232
cmake-include: ["../lib/matrix.cmake"],
33-
files: ["../include/matrix.h", "../lib/matrix.c", "../include/PseudoRandom.h"],
33+
files: ["../include/matrix.h", "../lib/matrix.c", "../include/PseudoRandom.h", "../include/benchmark_runner.h"],
3434
fast: true
3535
};
3636

3737
import BenchmarkRunner from "../BenchmarkRunner.lf";
3838

3939
preamble {=
40+
#include "benchmark_runner.h"
4041
#include "matrix.h"
4142
#include "PseudoRandom.h"
4243
#include <math.h>
4344

44-
long min(long a, long b) {
45+
static long min(long a, long b) {
4546
return a < b ? a : b;
4647
}
4748
=}

C/Savina/src/parallelism/FilterBank.lf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,18 @@ target C {
3838
else:
3939
cog.outl("threading: false,")
4040
]]] */
41+
files: ["../include/benchmark_runner.h"],
4142
threading: false,
4243
/// [[[end]]]
4344
fast: true
4445
};
4546

4647
import BenchmarkRunner from "../BenchmarkRunner.lf";
4748

49+
preamble {=
50+
#include "benchmark_runner.h"
51+
=}
52+
4853
/**
4954
* Send an output every 1 msec.
5055
*/

0 commit comments

Comments
 (0)