Changeset f85546d in mainline


Ignore:
Timestamp:
2019-01-04T15:00:21Z (6 years ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
13b1b48
Parents:
a362c16
Message:

perf: add benchmark parameters

Added API for extra benchmark parameters that could modify their
behaviour. The API is not used by any of the existing benchmarks (new
benchmarks coming in next commits).

Location:
uspace/app/perf
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/perf/Makefile

    ra362c16 rf85546d  
    3636        benchlist.c \
    3737        csv.c \
     38        params.c \
    3839        perf.c \
    3940        ipc/ns_ping.c \
  • uspace/app/perf/perf.c

    ra362c16 rf85546d  
    4949#include "benchlist.h"
    5050#include "csv.h"
     51#include "params.h"
    5152#include "perf.h"
    5253
     
    299300        printf("-o, --output filename.csv  "
    300301            "Store machine-readable data in filename.csv\n");
     302        printf("-p, --param KEY=VALUE      "
     303            "Additional parameters for the benchmark\n");
    301304        printf("<benchmark> is one of the following:\n");
    302305        list_benchmarks();
    303306}
    304307
     308static void handle_param_arg(char *arg)
     309{
     310        char *value = NULL;
     311        char *key = str_tok(arg, "=", &value);
     312        bench_param_set(key, value);
     313}
     314
    305315int main(int argc, char *argv[])
    306316{
    307         const char *short_options = "ho:";
     317        errno_t rc = bench_param_init();
     318        if (rc != EOK) {
     319                fprintf(stderr, "Failed to initialize internal params structure: %s\n",
     320                    str_error(rc));
     321                return -5;
     322        }
     323
     324        const char *short_options = "ho:p:";
    308325        struct option long_options[] = {
    309326                { "help", optional_argument, NULL, 'h' },
     327                { "param", required_argument, NULL, 'p' },
    310328                { "output", required_argument, NULL, 'o' },
    311329                { 0, 0, NULL, 0 }
     
    322340                case 'o':
    323341                        csv_output_filename = optarg;
     342                        break;
     343                case 'p':
     344                        handle_param_arg(optarg);
    324345                        break;
    325346                case -1:
     
    366387
    367388        csv_report_close();
     389        bench_param_cleanup();
    368390
    369391        return exit_code;
Note: See TracChangeset for help on using the changeset viewer.