Ignore:
Timestamp:
Apr 12, 2017, 9:36:33 PM (4 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
50b7e8c, d9dd3d1
Parents:
ff178ee
Message:

Add printing code to benchmark

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/generic_types/evaluation/c-bench.c

    rff178ee r0d10090  
     1#include <stdio.h>
    12#include <stdlib.h>
    23#include "bench.h"
    34#include "c-pair.h"
    45#include "c-stack.h"
     6#include "c-print.h"
    57
    68_Bool* new_bool( _Bool b ) {
     
    8991        )
    9092        free_pair_bool_char( max2 );
     93
     94        FILE* out = fopen("c-out.txt", "w");
     95        REPEAT_TIMED( "print_int",
     96                print( out, "dsds", rand(), ":", rand(), "\n" );
     97        )
     98
     99        REPEAT_TIMED( "print_pair",
     100                struct pair p1 = ((struct pair){ new_bool(rand() & 0x1), new_char(rand() & 0x7F) });
     101                struct pair p2 = ((struct pair){ new_bool(rand() & 0x1), new_char(rand() & 0x7F) });
     102                print( out, "pbcspbcs", p1, ":", p2, "\n" );
     103                free(p1.first); free(p1.second);
     104                free(p2.first); free(p2.second);
     105        )
     106        fclose(out);
    91107}
Note: See TracChangeset for help on using the changeset viewer.