Changeset 5bcdc8c


Ignore:
Timestamp:
Aug 11, 2020, 3:00:21 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
cd02108
Parents:
7f6e9eb
Message:

Upgraded yield benchmark to use new parseargs

Location:
benchmark
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • benchmark/benchcltr.hfa

    r7f6e9eb r5bcdc8c  
    2222        {"procstat",     no_argument      , 0, 'P'}, \
    2323        {"viewhalts",    no_argument      , 0, 'V'},
    24 
    25 #define BENCH_DECL \
    26         double duration = 5; \
    27         int nprocs = 1; \
    28         int nthreads = 1;
    2924
    3025#define BENCH_OPT_CASE \
     
    6055                break;
    6156
     57double duration = 5;
     58int nprocs = 1;
     59int nthreads = 1;
    6260bool silent = false;
     61bool continuous = false;
    6362bool procstats = false;
    6463bool viewhalts = false;
    6564
     65#define BENCH_OPT_CFA \
     66        {'d', "duration",  "Duration of the experiments in seconds", duration }, \
     67        {'t', "nthreads",  "Number of threads to use", nthreads }, \
     68        {'p', "nprocs",    "Number of processors to use", nprocs }, \
     69        {'S', "nostats",   "Don't print statistics", silent, parse_settrue }, \
     70        {'C', "constats",  "Regularly print statistics", continuous, parse_settrue }, \
     71        {'P', "procstat",  "Print statistics for each processors", procstats, parse_settrue }, \
     72        {'V', "viewhalts", "Visualize halts, prints timestamp and Processor id for each halt.", viewhalts, parse_settrue },
     73
    6674#ifdef __cforall
     75#include <parseargs.hfa>
     76
    6777struct cluster * the_benchmark_cluster = 0p;
    6878struct BenchCluster {
  • benchmark/readyQ/yield.cfa

    r7f6e9eb r5bcdc8c  
    4343
    4444int main(int argc, char * argv[]) {
    45         BENCH_DECL
    4645        unsigned num_io = 1;
    4746        io_context_params params;
    4847
    49         for(;;) {
    50                 static struct option options[] = {
    51                         BENCH_OPT_LONG
    52                         {0, 0, 0, 0}
    53                 };
     48        cfa_option opt[] = {
     49                BENCH_OPT_CFA
     50        };
     51        int opt_cnt = sizeof(opt) / sizeof(cfa_option);
    5452
    55                 int idx = 0;
    56                 int opt = getopt_long(argc, argv, BENCH_OPT_SHORT, options, &idx);
    57 
    58                 const char * arg = optarg ? optarg : "";
    59                 char * end;
    60                 switch(opt) {
    61                         case -1:
    62                                 goto run;
    63                         BENCH_OPT_CASE
    64                         default: /* ? */
    65                                 fprintf( stderr, "Unkown option '%c'\n", opt);
    66                         usage:
    67                                 bench_usage( argv );
    68                                 exit(1);
    69                 }
    70         }
    71         run:
     53        char **left;
     54        parse_args( argc, argv, opt, opt_cnt, "[OPTIONS]...\ncforall yield benchmark", left );
    7255
    7356        {
Note: See TracChangeset for help on using the changeset viewer.