tests/vg_regtest: Always evaluate prerequisite expressions with sh
[valgrind.git] / callgrind / tests / clreq.c
bloba826d69f5fe437ad5f78d5895afe39b68d67b294
2 // Similar to Cachegrind, check if instrumentation works in the presence
3 // of a client request. Uses a Callgrind request to check this.
5 #include "../callgrind.h"
7 int some_work(int sum)
9 int i;
11 for(i=0;i<10;i++) sum += i; /* some dummy work */
13 return sum;
16 int some_callgrind_clreqs()
18 int sum = some_work(0);
20 CALLGRIND_ZERO_STATS;
22 sum += some_work(sum);
24 CALLGRIND_DUMP_STATS;
26 sum += some_work(sum);
28 CALLGRIND_DUMP_STATS_AT("Please dump here");
30 return some_work(sum);
33 int more_callgrind_clreqs()
35 int sum = some_callgrind_clreqs();
37 CALLGRIND_TOGGLE_COLLECT;
39 sum += some_callgrind_clreqs();
41 CALLGRIND_TOGGLE_COLLECT;
43 return sum;
47 int main(void)
49 more_callgrind_clreqs();
51 CALLGRIND_STOP_INSTRUMENTATION;
53 more_callgrind_clreqs();
55 CALLGRIND_START_INSTRUMENTATION;
57 more_callgrind_clreqs();
59 CALLGRIND_STOP_INSTRUMENTATION;
61 more_callgrind_clreqs();
63 CALLGRIND_START_INSTRUMENTATION;
65 return RUNNING_ON_VALGRIND;