thanks for looking at the post
I am benchmarking some Cilk Plus code and was looking to calculate the time required to complete a "spawn" operation. I am interested in calculating only the time required to do a spawn and not the computational time required by fib(). Is this possible to do ?
Will putting the timer in the following code work as expected ? If my thinking is correct will replacing the "// RRS" with timer_start() and timer_stop(), get the job done ?
#include <stdio.h>
#include <stdlib.h>
int fib(int n)
{
if (n < 2) return n;
else {
// RRS: Start timer t1 here ??
int x = cilk_spawn fib(n-1);
// RRS: Stop timer t1 here ??
int y = fib(n-2);
// RRS: Start timer t2 here ??
cilk_sync;
// RRS: Stop timer t2 here ??
return x + y;
}
}
int main(int argc, char *argv[])
{
int n = atoi(argv[1]);
int result = fib(n);
printf("Fibonacci of %d is %d.\n", n, result);
return 0;
}