Changeset e7f9a09 in mainline for uspace/app/hbench/malloc/malloc2.c


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

    r94ebebf re7f9a09  
    3535#include "../hbench.h"
    3636
    37 static bool runner(benchmeter_t *meter, uint64_t niter,
    38     char *error, size_t error_size)
     37static bool runner(bench_run_t *run, uint64_t niter)
    3938{
    40         benchmeter_start(meter);
     39        bench_run_start(run);
    4140
    4241        void **p = malloc(niter * sizeof(void *));
    4342        if (p == NULL) {
    44                 snprintf(error, error_size,
    45                     "failed to allocate backend array (%" PRIu64 "B)",
     43                return bench_run_fail(run, "failed to allocate backend array (%" PRIu64 "B)",
    4644                    niter * sizeof(void *));
    47                 return false;
    4845        }
    4946
     
    5148                p[count] = malloc(1);
    5249                if (p[count] == NULL) {
    53                         snprintf(error, error_size,
    54                             "failed to allocate 1B in run %" PRIu64 " (out of %" PRIu64 ")",
    55                             count, niter);
    5650                        for (uint64_t j = 0; j < count; j++) {
    5751                                free(p[j]);
    5852                        }
    5953                        free(p);
    60                         return false;
     54                        return bench_run_fail(run,
     55                            "failed to allocate 1B in run %" PRIu64 " (out of %" PRIu64 ")",
     56                            count, niter);
    6157                }
    6258        }
     
    6763        free(p);
    6864
    69         benchmeter_stop(meter);
     65        bench_run_stop(run);
    7066
    7167        return true;
Note: See TracChangeset for help on using the changeset viewer.