@@ -33,7 +33,9 @@ target C {
3333 /// [[[end]]]
3434 files: ["/lib/c/reactor-c/util/deque.h",
3535 "/lib/c/reactor-c/util/deque.c",
36+ "../include/benchmark_runner.h",
3637 "../include/PseudoRandom.h"],
38+ cmake-include: ["../include/deque.cmake"],
3739 flags: "-lm",
3840 logging: "warn",
3941 fast: true
@@ -45,32 +47,33 @@ import BenchmarkRunner from "../BenchmarkRunner.lf";
4547preamble {=
4648 #include "PseudoRandom.h"
4749 #include <math.h>
48-
49- double processItem(double curTerm, size_t cost) {
50- double res = curTerm;
51-
52- PseudoRandom random;
53- random.mValue = cost;
54-
55- if(cost > 0) {
56- for(size_t i = 0; i < cost; i++) {
57- for(size_t j = 0; j < 100; j++) {
58- res += log(fabs(nextDouble(&random)) + 0.01);
59- }
60- }
61- } else {
62- res += log(fabs(nextDouble(&random)) + 0.01);
63- }
64-
65- return res;
66- }
50+ #include "deque.h"
51+ #include "benchmark_runner.h"
52+ double processItem(double curTerm, size_t cost);
6753=}
6854
6955
7056reactor ManagerReactor(bufferSize: size_t(50), numProducers: size_t(40), numConsumers: size_t(40)) {
7157
7258 preamble {=
73- #include "deque.c"
59+ double processItem(double curTerm, size_t cost) {
60+ double res = curTerm;
61+
62+ PseudoRandom random;
63+ random.mValue = cost;
64+
65+ if(cost > 0) {
66+ for(size_t i = 0; i < cost; i++) {
67+ for(size_t j = 0; j < 100; j++) {
68+ res += log(fabs(nextDouble(&random)) + 0.01);
69+ }
70+ }
71+ } else {
72+ res += log(fabs(nextDouble(&random)) + 0.01);
73+ }
74+
75+ return res;
76+ }
7477 =}
7578
7679 input start: bool;
0 commit comments