@@@ BROKEN wip
[mLib] / test / tvec-main.c
index aa36180..a9cff8f 100644 (file)
@@ -56,9 +56,7 @@ static const struct outform {
   { 0,                 0 }
 };
 
-static struct bench_state benchstate;
-
-const struct tvec_info tvec_adhocinfo =
+const struct tvec_config tvec_adhocconfig =
   { 0, 1, 1, sizeof(struct tvec_reg) };
 
 static const struct outform *find_outform(const char *p)
@@ -101,20 +99,17 @@ Options:\n\
 \n\
   -f, --format=FORMAT  produce output in FORMAT.\n\
   -o, --output=OUTPUT  write output to OUTPUT file.\n\
-  -t, --target=SECS    aim to run benchmarks for SECS.\n\
 ", fp);
 }
 
 void tvec_parseargs(int argc, char *argv[], struct tvec_state *tv_out,
-                   int *argpos_out, const struct tvec_info *info)
+                   int *argpos_out, const struct tvec_config *config)
 {
   FILE *ofp = 0;
   const struct outform *of = 0;
   struct tvec_output *o;
-  struct bench_timer *tm;
-  const char *p; char *q;
+  const char *p;
   int opt;
-  double t;
   unsigned f = 0;
 #define f_bogus 1u
 
@@ -125,15 +120,12 @@ void tvec_parseargs(int argc, char *argv[], struct tvec_state *tv_out,
 
     { "format",                OPTF_ARGREQ,    0,      'f' },
     { "output",                OPTF_ARGREQ,    0,      'o' },
-    { "target",                OPTF_ARGREQ,    0,      't' },
     { 0,               0,              0,      0 }
   };
 
-  tvec_benchstate = &benchstate;
-  tm = bench_createtimer(); bench_init(&benchstate, tm);
   ego(argv[0]);
   for (;;) {
-    opt = mdwopt(argc, argv, "hvu" "f:o:t:", options, 0, 0, 0);
+    opt = mdwopt(argc, argv, "hvu" "f:o:", options, 0, 0, 0);
     if (opt < 0) break;
     switch (opt) {
       case 'h': help(stdout); exit(0);
@@ -148,12 +140,6 @@ void tvec_parseargs(int argc, char *argv[], struct tvec_state *tv_out,
          die(2, "failed to open `%s' for writing: %s",
              optarg, strerror(errno));
        break;
-      case 't':
-       errno = 0; t = strtod(optarg, &q);
-       while (ISSPACE(*q)) q++;
-       if (errno || *q || t < 0) die(2, "invalid time `%s'", optarg);
-       benchstate.target_s = t;
-       break;
 
       default:
        f |= f_bogus;
@@ -169,7 +155,7 @@ void tvec_parseargs(int argc, char *argv[], struct tvec_state *tv_out,
   if (of) o = of->makefn(ofp);
   else o = tvec_dfltout(ofp);
 
-  tvec_begin(tv_out, info, o); *argpos_out = optind;
+  tvec_begin(tv_out, config, o); *argpos_out = optind;
 }
 
 int tvec_readstdin(struct tvec_state *tv)
@@ -237,12 +223,12 @@ int tvec_readargs(int argc, char *argv[], struct tvec_state *tv,
 }
 
 int tvec_main(int argc, char *argv[],
-             const struct tvec_info *info, const char *dflt)
+             const struct tvec_config *config, const char *dflt)
 {
   struct tvec_state tv;
   int argpos;
 
-  tvec_parseargs(argc, argv, &tv, &argpos, info);
+  tvec_parseargs(argc, argv, &tv, &argpos, config);
   tvec_readargs(argc, argv, &tv, &argpos, dflt);
   return (tvec_end(&tv));
 }