cputime.h 956 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2017-12-23 Bernard first version
  9. */
  10. #ifndef CPUTIME_H__
  11. #define CPUTIME_H__
  12. #include <stdint.h>
  13. #include "cputimer.h"
  14. struct rt_clock_cputime_ops
  15. {
  16. uint64_t (*cputime_getres)(void);
  17. uint64_t (*cputime_gettime)(void);
  18. int (*cputime_settimeout)(uint64_t tick, void (*timeout)(void *param), void *param);
  19. };
  20. uint64_t clock_cpu_getres(void);
  21. uint64_t clock_cpu_gettime(void);
  22. int clock_cpu_settimeout(uint64_t tick, void (*timeout)(void *param), void *param);
  23. int clock_cpu_issettimeout(void);
  24. uint64_t clock_cpu_microsecond(uint64_t cpu_tick);
  25. uint64_t clock_cpu_millisecond(uint64_t cpu_tick);
  26. int clock_cpu_setops(const struct rt_clock_cputime_ops *ops);
  27. #ifdef RT_USING_CPUTIME_RISCV
  28. int riscv_cputime_init(void);
  29. #endif /* RT_USING_CPUTIME_RISCV */
  30. #endif