1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/benchmark: incl irq.h and fixed output

This commit is contained in:
Hauke Petersen 2018-06-14 13:24:50 +02:00
parent 6265da2894
commit a027a1e608
2 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Freie Universität Berlin
* Copyright (C) 2017,2018 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
@ -27,6 +27,10 @@ void benchmark_print_time(uint32_t time, unsigned long runs, const char *name)
uint32_t full = (time / runs);
uint32_t div = (time - (full * runs)) / (runs / 1000);
printf("%11s: %9" PRIu32 "us --- %2" PRIu32 ".%03" PRIu32 "us per call\n",
name, time, full, div);
uint32_t per_sec = (uint32_t)(((uint64_t)1000000UL * runs) / time);
printf("%25s: %9" PRIu32 "us"
" --- %2" PRIu32 ".%03" PRIu32 "us per call"
" --- %9" PRIu32 " calls per sec\n",
name, time, full, div, per_sec);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Freie Universität Berlin
* Copyright (C) 2017,2018 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -23,6 +23,7 @@
#include <stdint.h>
#include "irq.h"
#include "xtimer.h"
#ifdef __cplusplus