Changeset 3fea752 in mainline


Ignore:
Timestamp:
2019-01-28T07:46:58Z (5 years ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
67bcd81
Parents:
182487c6 (diff), 871cff9a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge changes to benchmarking tool (PR #151)

This merges refactoring and other changes to the perf/hbench tool.

The changes include:

  • Factor out all the duplicate code in individual benchmarks into a common harness
  • Properly compute average throughput
    • Added an awful function to compute square root until proper implementation is available (for the precision we need it is quite sufficient) [sqrt is needed to compute standard deviation]
  • Added option to dump data to CSV for further processing
  • Added option to specify minimal duration of a loop and number of runs to execute.
  • Added simple benchmark for fibril mutexes
  • Merged benchmarks from bnchmark application and removed it
    • These benchmarks are FS-related and IMHO are quite badly designed (they really stress only the block cache and not the FS on top of it; but still they might be useful as IPC benchmark of large data volumes)
  • Renamed perf to hbench to stress that it is a benchmarking application rather than a generic performance measurement tool (compared to perf in GNU/Linux)
  • Extended documentation a little bit
  • Added function for measuring wall-clock time (internally pass-through to uptime but available for other applications as the right API for this in HelenOS)
Files:
17 added
13 deleted
6 edited
2 moved

Legend:

Unmodified
Added
Removed
  • .gitignore

    r182487c6 r3fea752  
    9090uspace/app/bithenge/bithenge
    9191uspace/app/blkdump/blkdump
    92 uspace/app/bnchmark/bnchmark
    9392uspace/app/contacts/contacts
    9493uspace/app/corecfg/corecfg
     
    107106uspace/app/getterm/getterm
    108107uspace/app/gunzip/gunzip
     108uspace/app/hbench/hbench
    109109uspace/app/inet/inet
    110110uspace/app/init/init
     
    131131uspace/app/nterm/nterm
    132132uspace/app/pci/pci
    133 uspace/app/perf/perf
    134133uspace/app/ping/ping
    135134uspace/app/ping6/ping6
     
    173172uspace/dist/app/bithenge
    174173uspace/dist/app/blkdump
    175 uspace/dist/app/bnchmark
    176174uspace/dist/app/corecfg
    177175uspace/dist/app/cpptest
  • boot/Makefile.common

    r182487c6 r3fea752  
    181181        bithenge \
    182182        blkdump \
    183         bnchmark \
    184183        contacts \
    185184        corecfg \
     
    192191        fdisk \
    193192        gunzip \
     193        hbench \
    194194        inet \
    195195        kill \
     
    205205        mkmfs \
    206206        nic \
    207         perf \
    208207        sbi \
    209208        sportdmp \
  • uspace/Makefile

    r182487c6 r3fea752  
    3838        app/bithenge \
    3939        app/blkdump \
    40         app/bnchmark \
    4140        app/contacts \
    4241        app/corecfg \
     
    5150        app/getterm \
    5251        app/gunzip \
     52        app/hbench \
    5353        app/init \
    5454        app/inet \
     
    6868        app/nterm \
    6969        app/pci \
    70         app/perf \
    7170        app/redir \
    7271        app/sbi \
  • uspace/app/hbench/Makefile

    r182487c6 r3fea752  
    3131LIBS = math
    3232
    33 BINARY = perf
     33BINARY = hbench
    3434
    3535SOURCES = \
    36         perf.c \
     36        benchlist.c \
     37        csv.c \
     38        env.c \
     39        main.c \
     40        utils.c \
     41        fs/dirread.c \
     42        fs/fileread.c \
    3743        ipc/ns_ping.c \
    3844        ipc/ping_pong.c \
    3945        malloc/malloc1.c \
    40         malloc/malloc2.c
     46        malloc/malloc2.c \
     47        synch/fibril_mutex.c
    4148
    4249include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/hbench/benchlist.c

    r182487c6 r3fea752  
    11/*
    22 * Copyright (c) 2018 Jiri Svoboda
     3 * Copyright (c) 2018 Vojtech Horky
    34 * All rights reserved.
    45 *
     
    2728 */
    2829
    29 /** @addtogroup perf
     30/** @addtogroup hbench
    3031 * @{
    3132 */
    32 /** @file
     33/**
     34 * @file
    3335 */
    3436
    35 #ifndef PERF_H_
    36 #define PERF_H_
     37#include <stdlib.h>
     38#include "hbench.h"
    3739
    38 #include <stdbool.h>
     40benchmark_t *benchmarks[] = {
     41        &benchmark_dir_read,
     42        &benchmark_fibril_mutex,
     43        &benchmark_file_read,
     44        &benchmark_malloc1,
     45        &benchmark_malloc2,
     46        &benchmark_ns_ping,
     47        &benchmark_ping_pong
     48};
    3949
    40 typedef const char *(*benchmark_entry_t)(void);
    41 
    42 typedef struct {
    43         const char *name;
    44         const char *desc;
    45         benchmark_entry_t entry;
    46 } benchmark_t;
    47 
    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);
    52 
    53 extern benchmark_t benchmarks[];
    54 
    55 #endif
     50size_t benchmark_count = sizeof(benchmarks) / sizeof(benchmarks[0]);
    5651
    5752/** @}
  • uspace/app/tester/tester.c

    r182487c6 r3fea752  
    3535 */
    3636
     37#include <assert.h>
    3738#include <stdio.h>
    3839#include <stddef.h>
     
    4041#include <str.h>
    4142#include <io/log.h>
     43#include <types/casting.h>
    4244#include "tester.h"
    4345
     
    144146        }
    145147
    146         unsigned int _len = (unsigned int) len;
    147         if ((_len != len) || (((int) _len) < 0)) {
    148                 printf("Command length overflow\n");
    149                 return;
    150         }
     148        assert(can_cast_size_t_to_int(len) && "test name length overflow");
    151149
    152150        for (test = tests; test->name != NULL; test++)
    153                 printf("%-*s %s%s\n", _len, test->name, test->desc,
     151                printf("%-*s %s%s\n", (int) len, test->name, test->desc,
    154152                    (test->safe ? "" : " (unsafe)"));
    155153
    156         printf("%-*s Run all safe tests\n", _len, "*");
     154        printf("%-*s Run all safe tests\n", (int) len, "*");
    157155}
    158156
  • uspace/lib/c/Makefile

    r182487c6 r3fea752  
    189189TEST_SOURCES = \
    190190        test/adt/circ_buf.c \
     191        test/casting.c \
    191192        test/fibril/timer.c \
    192193        test/main.c \
     
    196197        test/stdio/scanf.c \
    197198        test/odict.c \
     199        test/perf.c \
    198200        test/perm.c \
    199201        test/qsort.c \
  • uspace/lib/c/test/main.c

    r182487c6 r3fea752  
    3232PCUT_INIT;
    3333
     34PCUT_IMPORT(casting);
    3435PCUT_IMPORT(circ_buf);
    3536PCUT_IMPORT(fibril_timer);
     
    3738PCUT_IMPORT(mem);
    3839PCUT_IMPORT(odict);
     40PCUT_IMPORT(perf);
    3941PCUT_IMPORT(perm);
    4042PCUT_IMPORT(qsort);
Note: See TracChangeset for help on using the changeset viewer.