Mercurial > hg > Members > nobuyasu > CbC
annotate benchmark/binary-trees/binary-trees.c @ 33:3946f8d26710 draft default tip
add benchmarck/binary-trees
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 09 Apr 2013 16:41:30 +0900 |
parents | |
children |
rev | line source |
---|---|
33
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 /* The Computer Language Benchmarks Game |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 * http://benchmarksgame.alioth.debian.org/ |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 * |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 * contributed by Francesco Abbate |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 */ |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 #include <stdlib.h> |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 #include <stdio.h> |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 typedef off_t off64_t; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 #include <apr_pools.h> |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 const size_t LINE_SIZE = 64; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 struct node |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 int i; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 struct node *left; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 struct node *right; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 }; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 int |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 node_check(const struct node *n) |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 if (n->left) |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 int lc = node_check (n->left); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 int rc = node_check (n->right); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 return lc + n->i - rc; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 } |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 return n->i; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 } |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 struct node * |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 node_get_avail (apr_pool_t *pool) |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 return apr_palloc (pool, sizeof(struct node)); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 } |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 struct node * |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 make (int i, int depth, apr_pool_t *pool) |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45 struct node *curr = node_get_avail (pool); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 curr->i = i; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 if (depth > 0) |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 curr->left = make (2*i-1, depth - 1, pool); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 curr->right = make (2*i , depth - 1, pool); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 } |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 else |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56 curr->left = NULL; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
57 curr->right = NULL; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58 } |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
59 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60 return curr; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 } |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
62 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 int |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 main(int argc, char *argv[]) |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66 apr_pool_t *long_lived_pool; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 int min_depth = 4; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68 int req_depth = (argc == 2 ? atoi(argv[1]) : 10); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 int max_depth = (req_depth > min_depth + 2 ? req_depth : min_depth + 2); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 int stretch_depth = max_depth+1; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 apr_initialize(); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74 /* Alloc then dealloc stretchdepth tree */ |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
75 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
76 apr_pool_t *store; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
77 struct node *curr; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
78 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
79 apr_pool_create (&store, NULL); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80 curr = make (0, stretch_depth, store); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
81 printf ("stretch tree of depth %i\t check: %i\n", stretch_depth, |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 node_check (curr)); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 apr_pool_destroy (store); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
84 } |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
85 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
86 apr_pool_create (&long_lived_pool, NULL); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
87 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
88 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
89 struct node *long_lived_tree = make(0, max_depth, long_lived_pool); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 /* buffer to store output of each thread */ |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
92 char *outputstr = (char*) malloc(LINE_SIZE * (max_depth +1) * sizeof(char)); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
93 int d; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
94 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
95 #pragma omp parallel for |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
96 for (d = min_depth; d <= max_depth; d += 2) |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
97 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
98 int iterations = 1 << (max_depth - d + min_depth); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
99 apr_pool_t *store; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
100 int c = 0, i; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
101 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
102 apr_pool_create (&store, NULL); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
103 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
104 for (i = 1; i <= iterations; ++i) |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
105 { |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
106 struct node *a, *b; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
107 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
108 a = make ( i, d, store); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
109 b = make (-i, d, store); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
110 c += node_check (a) + node_check (b); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
111 apr_pool_clear (store); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
112 } |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
113 apr_pool_destroy (store); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
114 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
115 /* each thread write to separate location */ |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
116 sprintf(outputstr + LINE_SIZE * d, "%d\t trees of depth %d\t check: %d\n", (2 * iterations), d, c); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
117 } |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
118 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
119 /* print all results */ |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
120 for (d = min_depth; d <= max_depth; d += 2) |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
121 printf("%s", outputstr + (d * LINE_SIZE) ); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
122 free(outputstr); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
123 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
124 printf ("long lived tree of depth %i\t check: %i\n", max_depth, |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
125 node_check (long_lived_tree)); |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
126 |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
127 return 0; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
128 } |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
129 } |