Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
5efd9599
Commit
5efd9599
authored
7 years ago
by
Kaspar Schleiser
Browse files
Options
Downloads
Patches
Plain Diff
sys/benchmark: remove BENCHMARK_SETUP()
parent
26ad044e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sys/include/benchmark.h
+11
-18
11 additions, 18 deletions
sys/include/benchmark.h
tests/periph_gpio/main.c
+0
-1
0 additions, 1 deletion
tests/periph_gpio/main.c
with
11 additions
and
19 deletions
sys/include/benchmark.h
+
11
−
18
View file @
5efd9599
...
...
@@ -29,13 +29,6 @@
extern
"C"
{
#endif
/**
* @brief Prepare the current scope for running BENCHMARK_x() macros
*/
#define BENCHMARK_SETUP() \
unsigned state; \
unsigned time
/**
* @brief Measure the runtime of a given function call
*
...
...
@@ -43,21 +36,21 @@ extern "C" {
* using a preprocessor function, as going with a function pointer or similar
* would influence the measured runtime...
*
* @note BENCHMARK_SETUP() needs to be called in the same scope
*
* @param[in] name name for labeling the output
* @param[in] runs number of times to run @p func
* @param[in] func function call to benchmark
*/
#define BENCHMARK_FUNC(name, runs, func) \
state = irq_disable(); \
time = xtimer_now_usec(); \
for (unsigned long i = 0; i < runs; i++) { \
func; \
} \
time = (xtimer_now_usec() - time); \
irq_restore(state); \
benchmark_print_time(time, runs, name)
#define BENCHMARK_FUNC(name, runs, func) \
{ \
unsigned _benchmark_irqstate = irq_disable(); \
uint32_t _benchmark_time = xtimer_now_usec(); \
for (unsigned long i = 0; i < runs; i++) { \
func; \
} \
_benchmark_time = (xtimer_now_usec() - _benchmark_time);\
irq_restore(_benchmark_irqstate); \
benchmark_print_time(_benchmark_time, runs, name); \
}
/**
* @brief Output the given time as well as the time per run on STDIO
...
...
This diff is collapsed.
Click to expand it.
tests/periph_gpio/main.c
+
0
−
1
View file @
5efd9599
...
...
@@ -221,7 +221,6 @@ static int bench(int argc, char **argv)
}
puts
(
"
\n
GPIO driver run-time performance benchmark
\n
"
);
BENCHMARK_SETUP
();
BENCHMARK_FUNC
(
"nop loop"
,
runs
,
__asm__
volatile
(
"nop"
));
BENCHMARK_FUNC
(
"gpio_set"
,
runs
,
gpio_set
(
pin
));
BENCHMARK_FUNC
(
"gpio_clear"
,
runs
,
gpio_clear
(
pin
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment