Zephyr Scientific Library (zscilib)
instrumentation.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Kevin Townsend
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_INCLUDE_ZSL_INSTRUMENTATION_H__
8 #define ZEPHYR_INCLUDE_ZSL_INSTRUMENTATION_H__
9 
10 #include <zephyr/kernel.h>
11 #include <zephyr/sys/printk.h>
12 #include <zsl/zsl.h>
13 
17 #define ZSL_INSTR_START(t) do { \
18  t = k_cycle_get_32(); \
19 } while (0);
20 
25 #define ZSL_INSTR_STOP(t) do { \
26  uint32_t end = k_cycle_get_32(); \
27  t = end < t ? 0xFFFFFFFF - t + end : end - t; \
28  t = k_cyc_to_ns_floor32(t); \
29 } while (0);
30 
31 #endif /* ZEPHYR_INCLUDE_ZSL_INSTRUMENTATION_H_ */
zsl.h
API header file for zscilib.