Bug 497723 - forgot to restore callgrind output cleanup
[valgrind.git] / dhat / tests / big.c
blob12dd677314f908d034c88e4c4e992e96fd9eb558
1 // This test implements a moderately complex call tree. The layout of these
2 // functions matches the layout of the tree produced by dh_view.js, when
3 // sorted by "total bytes".
5 #include <stdlib.h>
7 #define F(f, parent) void* f(size_t n) { return parent(n); }
9 // Note: don't use j1 -- that is a builtin C function, believe it or not.
10 F(a, malloc)
11 F(b1, a)
12 F(c1, b1)
13 F(d1, c1)
14 F(d2, c1) // insig total-bytes
15 F(c2, b1)
16 F(b2, a)
17 F(b3, a) F(e, b3) F(f, e)
18 F(g, malloc) F(h, g) F(i, h)
19 F(j2, i) F(k, j2) F(l, k)
20 F(j3, i) F(m, j3)
21 F(n1, m)
22 F(n2, m) F(o, n2)
23 F(p, i) F(q, p) // insig total-bytes
24 F(r, i) // insig total-bytes
25 F(s1, malloc) F(s2, s1) F(s3, s2) F(s4, s3) F(s5, s4)
26 F(t, malloc)
27 F(u, malloc)
28 F(v, malloc)
29 F(w, v) // insig total-bytes
30 F(x, v) // insig total-bytes
31 F(y, v) // insig total-bytes
32 F(z, v) // insig total-bytes
34 int main(void)
36 // Call all the leaves in the above tree.
38 int* d1p = d1(706);
39 free(d1p); // So the t-final numbers differ from the t-gmax/total numbers.
41 d2(5);
42 c2(30);
43 b2(20);
44 f(10);
45 l(60);
46 n1(30);
47 o(20);
48 q(7);
49 r(3);
50 s5(30);
51 t(20);
52 u(19);
53 w(9);
54 x(8);
55 y(7);
56 z(5);
57 z(1);
59 // And one allocation directly from main().
60 malloc(10);