sys_clock: make public some timing utilities
Make these public: - SECONDS(x): macro that gives the number of ticks in x seconds - MSEC(x): macro that gives the number of ticks in x milliseconds - MSEC_PER_SEC: number of milliseconds per second - USEC_PER_MSEC: number of microseconds per millisecond Change-Id: Ic5dbf9349651a477b066edb0c6b6721da2b7e5bb Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
parent
4dca2dfad3
commit
2d12752637
5 changed files with 15 additions and 7 deletions
|
@ -68,6 +68,12 @@ extern int sys_clock_hw_cycles_per_tick;
|
||||||
/* number of nsec per usec */
|
/* number of nsec per usec */
|
||||||
#define NSEC_PER_USEC 1000
|
#define NSEC_PER_USEC 1000
|
||||||
|
|
||||||
|
/* number of microseconds per millisecond */
|
||||||
|
#define USEC_PER_MSEC 1000
|
||||||
|
|
||||||
|
/* number of milliseconds per second */
|
||||||
|
#define MSEC_PER_SEC 1000
|
||||||
|
|
||||||
/* SYS_CLOCK_HW_CYCLES_TO_NS64 converts CPU clock cycles to nanoseconds */
|
/* SYS_CLOCK_HW_CYCLES_TO_NS64 converts CPU clock cycles to nanoseconds */
|
||||||
#define SYS_CLOCK_HW_CYCLES_TO_NS64(X) \
|
#define SYS_CLOCK_HW_CYCLES_TO_NS64(X) \
|
||||||
(((uint64_t)(X) * sys_clock_us_per_tick * NSEC_PER_USEC) / \
|
(((uint64_t)(X) * sys_clock_us_per_tick * NSEC_PER_USEC) / \
|
||||||
|
@ -85,6 +91,14 @@ extern int sys_clock_hw_cycles_per_tick;
|
||||||
extern int64_t _nano_ticks;
|
extern int64_t _nano_ticks;
|
||||||
extern struct nano_timer *_nano_timer_list;
|
extern struct nano_timer *_nano_timer_list;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Number of ticks for x seconds. NOTE: With MSEC(), since it does an integer
|
||||||
|
* division, x must be greater or equal to 1000/sys_clock_ticks_per_sec to get
|
||||||
|
* a non-zero value.
|
||||||
|
*/
|
||||||
|
#define SECONDS(x) ((x) * sys_clock_ticks_per_sec)
|
||||||
|
#define MSEC(x) (SECONDS(x) / 1000)
|
||||||
|
|
||||||
#endif /* !_ASMLANGUAGE */
|
#endif /* !_ASMLANGUAGE */
|
||||||
|
|
||||||
#endif /* _SYS_CLOCK__H_ */
|
#endif /* _SYS_CLOCK__H_ */
|
||||||
|
|
|
@ -64,8 +64,6 @@ static volatile unsigned int _k_workload_end_time = 0x0;
|
||||||
static extern uint32_t _k_workload_scale;
|
static extern uint32_t _k_workload_scale;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MSEC_PER_SEC 1000
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @brief Shared code between workload calibration and monitoring
|
* @brief Shared code between workload calibration and monitoring
|
||||||
|
|
|
@ -39,7 +39,6 @@ Common utility-type macros for use in the sample projects.
|
||||||
#ifndef _UTIL_TEST_COMMON__H_
|
#ifndef _UTIL_TEST_COMMON__H_
|
||||||
#define _UTIL_TEST_COMMON__H_
|
#define _UTIL_TEST_COMMON__H_
|
||||||
|
|
||||||
#define SECONDS(x) ((x) * sys_clock_ticks_per_sec)
|
/* nothing currently */
|
||||||
#define MSEC(x) (((x) * sys_clock_ticks_per_sec) / 1000)
|
|
||||||
|
|
||||||
#endif /* _UTIL_TEST_COMMON__H_ */
|
#endif /* _UTIL_TEST_COMMON__H_ */
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#define UART1_IRQ COM2_INT_LVL
|
#define UART1_IRQ COM2_INT_LVL
|
||||||
#define UART1_INT_PRI COM2_INT_PRI
|
#define UART1_INT_PRI COM2_INT_PRI
|
||||||
#define BUF_MAXSIZE 256
|
#define BUF_MAXSIZE 256
|
||||||
#define MSEC(_ms) ((_ms) * sys_clock_ticks_per_sec / 1000)
|
|
||||||
|
|
||||||
#define D(fmt, args...) \
|
#define D(fmt, args...) \
|
||||||
do { \
|
do { \
|
||||||
|
|
|
@ -41,8 +41,6 @@
|
||||||
|
|
||||||
#include "master.h"
|
#include "master.h"
|
||||||
|
|
||||||
#define SECONDS(x) ((x) * sys_clock_ticks_per_sec)
|
|
||||||
|
|
||||||
char Msg[MAX_MSG];
|
char Msg[MAX_MSG];
|
||||||
char data_bench[OCTET_TO_SIZEOFUNIT(MESSAGE_SIZE)];
|
char data_bench[OCTET_TO_SIZEOFUNIT(MESSAGE_SIZE)];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue