Changeset 79b8dc3 for doc/generic_types/evaluation/cfa-bench.c
- Timestamp:
- Apr 14, 2017, 6:24:35 PM (7 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:
- 17f27d40, 1c38f5b, 6eb4398
- Parents:
- 4570131
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/cfa-bench.c
r4570131 r79b8dc3 1 1 #include <stdlib> 2 #include <stdlib.h>3 2 #include <stdio.h> 4 3 #include "pair" … … 7 6 #include "cfa-print.h" 8 7 9 int main(int argc, char** argv) { 10 FILE* out = fopen("cfa-out.txt", "w"); 11 srand(20171025); 8 int main( int argc, char *argv[] ) { 9 FILE * out = fopen( "cfa-out.txt", "w" ); 10 int max = 0; 11 stack(int) s, t; 12 REPEAT_TIMED( "push_int", push( &s, _i ); ) 13 TIMED( "copy_int", t = s; ) 14 TIMED( "clear_int", clear( &s ); ) 15 REPEAT_TIMED( "pop_int", max = max( max, pop( &t ) ); ) 16 REPEAT_TIMED( "print_int", print( out, _i, ":", _i, "\n" ); ) 12 17 13 stack(int) s; 14 REPEAT_TIMED( "push_int", 15 push( &s, rand() ); 16 ) 17 18 stack(int) t; 19 TIMED( "copy_int", 20 t = s; 21 ) 22 23 TIMED( "clear_int", 24 clear( &s ); 25 ) 26 27 int max = 0; 28 REPEAT_TIMED( "pop_int", 29 max = max( max, pop( &t ) ); 30 ) 31 print( out, max, "\n" ); 32 33 REPEAT_N_TIMED( "print_int", N/2, 34 print( out, rand(), ":", rand(), "\n" ); 35 ) 36 37 stack(pair(_Bool, char)) s2; 38 REPEAT_TIMED( "push_bool_char", 39 push( &s2, (pair(_Bool, char)){ rand() & 0x1, rand() & 0x7F } ); 40 ) 41 42 stack(pair(_Bool, char)) t2; 43 TIMED( "copy_bool_char", 44 t2 = s2; 45 ) 46 47 TIMED( "clear_bool_char", 48 clear( &s2 ); 49 ) 50 51 pair(_Bool, char) max2 = { (_Bool)0, '\0' }; 52 REPEAT_TIMED( "pop_bool_char", 53 max2 = max( max2, pop( &t2 ) ); 54 ) 55 print( out, max2, "\n" ); 56 57 REPEAT_N_TIMED( "print_pair", N/2, 58 print( out, (pair(_Bool, char)){ rand() & 0x1, rand() & 0x7F }, ":", 59 (pair(_Bool, char)){ rand() & 0x1, rand() & 0x7F }, "\n" ); 60 ) 18 stack(pair(_Bool, char)) s1, t1; 19 pair(_Bool, char) max = { (_Bool)0, '\0' }; 20 REPEAT_TIMED( "push_pair", push( &s1, (pair(_Bool, char)){ _i & 1, _i &0x7F } ); ) 21 TIMED( "copy_pair", t1 = s1; ) 22 TIMED( "clear_pair", clear( &s1 ); ) 23 REPEAT_TIMED( "pop_pair", max = max( max, pop( &t1 ) ); ) 24 REPEAT_TIMED( "print_pair", 25 print( out, (pair(_Bool, char)){ _i & 1, _i &0x7F }, ":", (pair(_Bool, char)){ _i & 1, _i &0x7F }, "\n" ); ) 61 26 fclose(out); 62 27 }
Note: See TracChangeset
for help on using the changeset viewer.