Changeset 3bd74758 in mainline for uspace/app/perf/perf.h


Ignore:
Timestamp:
2018-12-28T09:32:11Z (5 years ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c7de81b
Parents:
8ee106b
Message:

perf: huge refactoring

The overall aim of this refactoring was to remove duplicate code in all
benchmarks that was responsible (a) for computing proper workload size
and (b) for computing final statistics.

After the refactoring, the actual benchmark code is quite short and
takes care of the actual work only.

The harness code was factored out into perf.c that is now responsible
for computing the workload size and then runs the actual benchmark.

As an extra feature, we pass stopwatch_t into the benchmark code that is
only responsible for starting/stopping. Duration is then queried outside
the benchmark code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/perf/perf.h

    r8ee106b r3bd74758  
    3737
    3838#include <stdbool.h>
     39#include <perf.h>
    3940
    40 typedef const char *(*benchmark_entry_t)(void);
     41typedef bool (*benchmark_entry_t)(stopwatch_t *, uint64_t,
     42    char *, size_t);
     43typedef bool (*benchmark_helper_t)(char *, size_t);
    4144
    4245typedef struct {
     
    4447        const char *desc;
    4548        benchmark_entry_t entry;
     49        benchmark_helper_t setup;
     50        benchmark_helper_t teardown;
    4651} benchmark_t;
    4752
    48 extern const char *bench_malloc1(void);
    49 extern const char *bench_malloc2(void);
    50 extern const char *bench_ns_ping(void);
    51 extern const char *bench_ping_pong(void);
     53extern bool bench_malloc1(stopwatch_t *, uint64_t, char *, size_t);
     54extern bool bench_malloc2(stopwatch_t *, uint64_t, char *, size_t);
     55extern bool bench_ns_ping(stopwatch_t *, uint64_t, char *, size_t);
     56extern bool bench_ping_pong(stopwatch_t *, uint64_t, char *, size_t);
     57extern bool bench_ping_pong_setup(char *, size_t);
     58extern bool bench_ping_pong_teardown(char *, size_t);
    5259
    5360extern benchmark_t benchmarks[];
Note: See TracChangeset for help on using the changeset viewer.