trace.h (968B)
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright 2014, Michael Ellerman, IBM Corp. 4 */ 5 6#ifndef _SELFTESTS_POWERPC_PMU_EBB_TRACE_H 7#define _SELFTESTS_POWERPC_PMU_EBB_TRACE_H 8 9#include "utils.h" 10 11#define TRACE_TYPE_REG 1 12#define TRACE_TYPE_COUNTER 2 13#define TRACE_TYPE_STRING 3 14#define TRACE_TYPE_INDENT 4 15#define TRACE_TYPE_OUTDENT 5 16 17struct trace_entry 18{ 19 u8 type; 20 u8 length; 21 u8 data[]; 22}; 23 24struct trace_buffer 25{ 26 u64 size; 27 bool overflow; 28 void *tail; 29 u8 data[]; 30}; 31 32struct trace_buffer *trace_buffer_allocate(u64 size); 33int trace_log_reg(struct trace_buffer *tb, u64 reg, u64 value); 34int trace_log_counter(struct trace_buffer *tb, u64 value); 35int trace_log_string(struct trace_buffer *tb, char *str); 36int trace_log_indent(struct trace_buffer *tb); 37int trace_log_outdent(struct trace_buffer *tb); 38void trace_buffer_print(struct trace_buffer *tb); 39void trace_print_location(struct trace_buffer *tb); 40 41#endif /* _SELFTESTS_POWERPC_PMU_EBB_TRACE_H */