mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
sys/benchmark: incl irq.h and fixed output
This commit is contained in:
parent
6265da2894
commit
a027a1e608
@ -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
|
* 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
|
* 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 full = (time / runs);
|
||||||
uint32_t div = (time - (full * runs)) / (runs / 1000);
|
uint32_t div = (time - (full * runs)) / (runs / 1000);
|
||||||
|
|
||||||
printf("%11s: %9" PRIu32 "us --- %2" PRIu32 ".%03" PRIu32 "us per call\n",
|
uint32_t per_sec = (uint32_t)(((uint64_t)1000000UL * runs) / time);
|
||||||
name, time, full, div);
|
|
||||||
|
printf("%25s: %9" PRIu32 "us"
|
||||||
|
" --- %2" PRIu32 ".%03" PRIu32 "us per call"
|
||||||
|
" --- %9" PRIu32 " calls per sec\n",
|
||||||
|
name, time, full, div, per_sec);
|
||||||
}
|
}
|
||||||
|
@ -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
|
* 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
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "irq.h"
|
||||||
#include "xtimer.h"
|
#include "xtimer.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user