Changeset e7f9a09 in mainline for uspace/app/hbench/fs


Ignore:
Timestamp:
2019-01-21T13:20:31Z (7 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.

Location:
uspace/app/hbench/fs
Files:
2 edited

Legend:

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

    r94ebebf re7f9a09  
    4444 * that the corresponding blocks would be cached after first run.
    4545 */
    46 static bool runner(benchmeter_t *meter, uint64_t size,
    47     char *error, size_t error_size)
     46static bool runner(bench_run_t *run, uint64_t size)
    4847{
    4948        const char *path = bench_param_get("dirname", "/");
    5049
    51         benchmeter_start(meter);
     50        bench_run_start(run);
    5251        for (uint64_t i = 0; i < size; i++) {
    5352                DIR *dir = opendir(path);
    5453                if (dir == NULL) {
    55                         snprintf(error, error_size, "failed to open %s for reading: %s",
     54                        return bench_run_fail(run, "failed to open %s for reading: %s",
    5655                            path, str_error(errno));
    57                         return false;
    5856                }
    5957
     
    6563                closedir(dir);
    6664        }
    67         benchmeter_stop(meter);
     65        bench_run_stop(run);
    6866
    6967        return true;
  • 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.