Changeset ebb0835 in mainline for uspace/app/hbench/hbench.h


Ignore:
Timestamp:
2019-01-07T12:56:22Z (5 years ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c2db02a
Parents:
a787081
Message:

hbench: add tiny wrapper around stopwatch_t

This prepares the harness for future extensions when more than wallclock
time would be prepared. The data would be stored inside the new
structure and the actual benchmarks would not need to be modified at all
(they really should not care which metrics are collected).

File:
1 edited

Legend:

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

    ra787081 rebb0835  
    4141#include <perf.h>
    4242
    43 typedef bool (*benchmark_entry_t)(stopwatch_t *, uint64_t,
     43/*
     44 * So far, a simple wrapper around system stopwatch.
     45 * Eventually, we could collection of hardware counters etc. without
     46 * modifying signatures of any existing benchmark.
     47 */
     48typedef struct {
     49        stopwatch_t stopwatch;
     50} benchmeter_t;
     51
     52static inline void benchmeter_init(benchmeter_t *meter)
     53{
     54        stopwatch_init(&meter->stopwatch);
     55}
     56
     57static inline void benchmeter_start(benchmeter_t *meter)
     58{
     59        stopwatch_start(&meter->stopwatch);
     60}
     61
     62static inline void benchmeter_stop(benchmeter_t *meter)
     63{
     64        stopwatch_stop(&meter->stopwatch);
     65}
     66
     67typedef bool (*benchmark_entry_t)(benchmeter_t *, uint64_t,
    4468    char *, size_t);
    4569typedef bool (*benchmark_helper_t)(char *, size_t);
     
    5781
    5882extern errno_t csv_report_open(const char *);
    59 extern void csv_report_add_entry(stopwatch_t *, int, benchmark_t *, uint64_t);
     83extern void csv_report_add_entry(benchmeter_t *, int, benchmark_t *, uint64_t);
    6084extern void csv_report_close(void);
    6185
Note: See TracChangeset for help on using the changeset viewer.