zephyr/subsys/debug/tracing/include/tracing_cpu_stats.h
Marek Pieta 788210816d debug: tracing: Add CPU stats module
Change adds CPU stats module for tracing hooks. Module provides
information about percent of CPU usage based on tracing hooks
for threads switching in and out, interrupts enters and exits.
cpu_stats only distinguishes between idle thread, non idle
thread and scheduler.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2018-11-30 11:01:32 -08:00

44 lines
1.0 KiB
C

/*
* Copyright (c) 2018 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _TRACE_CPU_STATS_H
#define _TRACE_CPU_STATS_H
#include <kernel.h>
#include <kernel_structs.h>
#include <init.h>
struct cpu_stats {
u64_t idle;
u64_t non_idle;
u64_t sched;
};
void sys_trace_thread_switched_in(void);
void sys_trace_thread_switched_out(void);
void sys_trace_isr_enter(void);
void sys_trace_isr_exit(void);
void sys_trace_idle(void);
void cpu_stats_get_ns(struct cpu_stats *cpu_stats_ns);
u32_t cpu_stats_non_idle_and_sched_get_percent(void);
void cpu_stats_reset_counters(void);
#define sys_trace_isr_exit_to_scheduler()
#define sys_trace_thread_priority_set(thread)
#define sys_trace_thread_info(thread)
#define sys_trace_thread_create(thread)
#define sys_trace_thread_abort(thread)
#define sys_trace_thread_suspend(thread)
#define sys_trace_thread_resume(thread)
#define sys_trace_thread_ready(thread)
#define sys_trace_thread_pend(thread)
#define sys_trace_void(id)
#define sys_trace_end_call(id)
#endif /* _TRACE_CPU_STATS_H */