rt/include/rt/cycle.h

30 lines
629 B
C

#pragma once
#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