Changeset e7f9a09 in mainline for uspace/app/hbench/fs/fileread.c


Ignore:
Timestamp:
2019-01-21T13:20:31Z (5 years ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d17cf8c
Parents:
94ebebf
Message:

hbench: less parameters to benchmark runners

Merge stopwatch as well as error message buffer into one structure to
simplify benchmark runner signature.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/hbench/fs/fileread.c

    r94ebebf re7f9a09  
    4545 * corresponding blocks would be cached after first run.
    4646 */
    47 static bool runner(benchmeter_t *meter, uint64_t size,
    48     char *error, size_t error_size)
     47static bool runner(bench_run_t *run, uint64_t size)
    4948{
    5049        const char *path = bench_param_get("filename", "/data/web/helenos.png");
     
    5251        char *buf = malloc(BUFFER_SIZE);
    5352        if (buf == NULL) {
    54                 snprintf(error, error_size, "failed to allocate %dB buffer", BUFFER_SIZE);
    55                 return false;
     53                return bench_run_fail(run, "failed to allocate %dB buffer", BUFFER_SIZE);
    5654        }
    5755
     
    6058        FILE *file = fopen(path, "r");
    6159        if (file == NULL) {
    62                 snprintf(error, error_size, "failed to open %s for reading: %s",
     60                bench_run_fail(run, "failed to open %s for reading: %s",
    6361                    path, str_error(errno));
    6462                ret = false;
     
    6664        }
    6765
    68         benchmeter_start(meter);
     66        bench_run_start(run);
    6967        for (uint64_t i = 0; i < size; i++) {
    7068                int rc = fseek(file, 0, SEEK_SET);
    7169                if (rc != 0) {
    72                         snprintf(error, error_size, "failed to rewind %s: %s",
     70                        bench_run_fail(run, "failed to rewind %s: %s",
    7371                            path, str_error(errno));
    7472                        ret = false;
     
    7876                        fread(buf, 1, BUFFER_SIZE, file);
    7977                        if (ferror(file)) {
    80                                 snprintf(error, error_size, "failed to read from %s: %s",
     78                                bench_run_fail(run, "failed to read from %s: %s",
    8179                                    path, str_error(errno));
    8280                                ret = false;
     
    8583                }
    8684        }
    87         benchmeter_stop(meter);
     85        bench_run_stop(run);
    8886
    8987leave_close:
Note: See TracChangeset for help on using the changeset viewer.