rt/include/rt/cycle.h

41 lines
701 B
C

#ifndef RT_CYCLE_H
#define RT_CYCLE_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef RT_CYCLE_ENABLE
#define RT_CYCLE_ENABLE 0
#endif
/*
* Initialize any hardware necessary for cycle counting.
*/
void rt_cycle_init(void);
/*
* Get the current CPU cycle.
*/
uint32_t rt_cycle(void);
/*
* Pause attributing CPU cycles to the current task.
* NOTE: currently this can only be safely used from the syscall handler.
*/
void rt_task_cycle_pause(void);
/*
* Resume attributing CPU cycles to the current task.
* NOTE: currently this can only be safely used from the syscall handler.
*/
void rt_task_cycle_resume(void);
#ifdef __cplusplus
}
#endif
#endif /* RT_CYCLE_H */