| [0d10090] | 1 | #include <stdio.h> | 
|---|
| [309be81] | 2 | #include "bench.h" | 
|---|
|  | 3 | #include "cfa-stack.h" | 
|---|
| [c87cd93] | 4 | #include "cfa-pair.h" | 
|---|
| [0d10090] | 5 | #include "cfa-print.h" | 
|---|
| [309be81] | 6 |  | 
|---|
| [79b8dc3] | 7 | int main( int argc, char *argv[] ) { | 
|---|
| [6a8ac0b] | 8 | FILE * out = fopen( "/dev/null", "w" ); | 
|---|
| [c87cd93] | 9 | int maxi = 0, vali = 42; | 
|---|
|  | 10 | stack(int) si, ti; | 
|---|
| [a381b46] | 11 |  | 
|---|
| [c87cd93] | 12 | REPEAT_TIMED( "push_int", N, push( &si, vali ); ) | 
|---|
|  | 13 | TIMED( "copy_int", ti = si; ) | 
|---|
|  | 14 | TIMED( "clear_int", clear( &si ); ) | 
|---|
|  | 15 | REPEAT_TIMED( "pop_int", N, | 
|---|
|  | 16 | int xi = pop( &ti ); | 
|---|
|  | 17 | if ( xi > maxi ) { maxi = xi; } ) | 
|---|
|  | 18 | REPEAT_TIMED( "print_int", N/2, print( out, vali, ":", vali, "\n" ); ) | 
|---|
| [79b8dc3] | 19 |  | 
|---|
| [c87cd93] | 20 | pair(_Bool, char) maxp = { (_Bool)0, '\0' }, valp = { (_Bool)1, 'a' }; | 
|---|
|  | 21 | stack(pair(_Bool, char)) sp, tp; | 
|---|
| [a381b46] | 22 |  | 
|---|
| [c87cd93] | 23 | REPEAT_TIMED( "push_pair", N, push( &sp, valp ); ) | 
|---|
|  | 24 | TIMED( "copy_pair", tp = sp; ) | 
|---|
|  | 25 | TIMED( "clear_pair", clear( &sp ); ) | 
|---|
|  | 26 | REPEAT_TIMED( "pop_pair", N, | 
|---|
|  | 27 | pair(_Bool, char) xp = pop( &tp ); | 
|---|
|  | 28 | if ( xp > maxp ) { maxp = xp; } ) | 
|---|
|  | 29 | REPEAT_TIMED( "print_pair", N/2, print( out, valp, ":", valp, "\n" ); ) | 
|---|
| [0d10090] | 30 | fclose(out); | 
|---|
| [6a8ac0b] | 31 | } | 
|---|