Changeset c87cd93 for doc/generic_types/evaluation/cfa-bench.c
- Timestamp:
- Apr 17, 2017, 3:47:07 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 4ae83a4b
- Parents:
- 33e22da
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/cfa-bench.c
r33e22da rc87cd93 1 1 #include <stdlib> 2 2 #include <stdio.h> 3 #include "pair"4 3 #include "bench.h" 5 4 #include "cfa-stack.h" 5 #include "cfa-pair.h" 6 6 #include "cfa-print.h" 7 7 8 8 int main( int argc, char *argv[] ) { 9 9 FILE * out = fopen( "cfa-out.txt", "w" ); 10 int max = 0;11 stack(int) s , t;10 int maxi = 0, vali = 42; 11 stack(int) si, ti; 12 12 13 REPEAT_TIMED( "push_int", push( &s, _i ); )14 TIMED( "copy_int", t = s; )15 TIMED( "clear_int", clear( &s ); )16 REPEAT_TIMED( "pop_int", 17 int x = pop(&t);18 if ( x > max ) { max = x; } )19 REPEAT_TIMED( "print_int", print( out, _i, ":", _i, "\n" ); )13 REPEAT_TIMED( "push_int", N, push( &si, vali ); ) 14 TIMED( "copy_int", ti = si; ) 15 TIMED( "clear_int", clear( &si ); ) 16 REPEAT_TIMED( "pop_int", N, 17 int xi = pop( &ti ); 18 if ( xi > maxi ) { maxi = xi; } ) 19 REPEAT_TIMED( "print_int", N/2, print( out, vali, ":", vali, "\n" ); ) 20 20 21 stack(pair(_Bool, char)) s1, t1;22 pair(_Bool, char) max = { (_Bool)0, '\0' };21 pair(_Bool, char) maxp = { (_Bool)0, '\0' }, valp = { (_Bool)1, 'a' }; 22 stack(pair(_Bool, char)) sp, tp; 23 23 24 REPEAT_TIMED( "push_pair", push( &s1, (pair(_Bool, char)){ _i & 1, _i &0x7F } ); ) 25 TIMED( "copy_pair", t1 = s1; ) 26 TIMED( "clear_pair", clear( &s1 ); ) 27 REPEAT_TIMED( "pop_pair", 28 pair(_Bool, char) x = pop(&t1); 29 if ( x > max ) { max = x; } ) 30 REPEAT_TIMED( "print_pair", 31 print( out, (pair(_Bool, char)){ _i & 1, _i &0x7F }, ":", 32 (pair(_Bool, char)){ _i & 1, _i &0x7F }, "\n" ); ) 24 REPEAT_TIMED( "push_pair", N, push( &sp, valp ); ) 25 TIMED( "copy_pair", tp = sp; ) 26 TIMED( "clear_pair", clear( &sp ); ) 27 REPEAT_TIMED( "pop_pair", N, 28 pair(_Bool, char) xp = pop( &tp ); 29 if ( xp > maxp ) { maxp = xp; } ) 30 REPEAT_TIMED( "print_pair", N/2, print( out, valp, ":", valp, "\n" ); ) 33 31 fclose(out); 34 32 }
Note: See TracChangeset
for help on using the changeset viewer.