Skip to content

Commit 9ed9bdc

Browse files
author
Elliot Kim
committed
fixes sh file to run c api throughput tests
1 parent 5cd6fd1 commit 9ed9bdc

File tree

3 files changed

+38
-55
lines changed

3 files changed

+38
-55
lines changed

test-vine-task-chaining.c

Lines changed: 0 additions & 53 deletions
This file was deleted.

test-vine-task-throughput-capi.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
#!/bin/sh
3+
4+
# Build the sources from github
5+
. ./install-github.sh
6+
7+
# Compile C API test using environment
8+
gcc test-vine-task-throughput.c -o test-vine-task-throughput -I $PREFIX/include/cctools/ -L $PREFIX/lib -ltaskvine -ldttools -lm -lcrypto -lssl -lz
9+
10+
./test-vine-task-throughput &
11+
12+
vine_worker localhost 9123 --single-shot

test-vine-task-throughput.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ int main(int argc, char *argv[])
1414
int tasksC = 5000;
1515

1616
m = vine_create(VINE_DEFAULT_PORT);
17-
printf("%d", VINE_DEFAULT_PORT);
17+
1818
if(!m) {
1919
printf("couldn't create manager: %s\n", strerror(errno));
2020
return 1;
@@ -44,10 +44,34 @@ int main(int argc, char *argv[])
4444
double throughtput_time = ((double)(end - start)) / CLOCKS_PER_SEC;
4545

4646
double throughput = tasksC / throughtput_time;
47+
48+
start_timer = true;
49+
start = 0;
50+
for(i=0;i<tasksC;i++) {
51+
struct vine_task *t = vine_task_create(":");
52+
vine_task_set_cores(t, 1);
53+
if (start_timer){
54+
start = clock();
55+
start_timer = false;
56+
}
57+
int task_id = vine_submit(m, t);
58+
while(!vine_empty(m)) {
59+
t = vine_wait(m, 5);
60+
if(t) {
61+
vine_task_delete(t);
62+
}
63+
}
64+
}
65+
end = clock();
66+
double chaining_time = ((double)(end - start)) / CLOCKS_PER_SEC;
67+
double chaining = tasksC / chaining_time;
4768

4869
printf("Throughput was %f tasks per second\n", throughput);
49-
printf("all tasks complete!\n");
5070
assert(throughput > 1000);
71+
72+
printf("Chaining was %f tasks per second\n", chaining);
73+
printf("all tasks complete!\n");
74+
assert(chaining > 1000);
5175
vine_delete(m);
5276

5377
return 0;

0 commit comments

Comments
 (0)