#include #include #include #include #include #include #include int usage() { printf("measure multi-thread work scheduling overhead\n"); printf("-nworkitems N (number of work items, default 1)\n"); printf("-usleeptime N (work time, default 100)\n"); printf("-ntests N (number of test iterations, default 1)\n"); return 1; } typedef struct workitem *WORKITEM; struct workitem { int usleeptime; }; cilk void do_work(WORKITEM wi) { #if 0 // sleep for usleeptime microseconds usleep(wi->usleeptime); #else // busy wait for usleeptime loop interations int n = wi->usleeptime; volatile int i; for (i=0; i