summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/powerpc/pmu/ebb/trace.h
blob: 926458e28c8bb162f784a49f13ccdb21b7e75456 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * Copyright 2014, Michael Ellerman, IBM Corp.
 * Licensed under GPLv2.
 */

#ifndef _SELFTESTS_POWERPC_PMU_EBB_TRACE_H
#define _SELFTESTS_POWERPC_PMU_EBB_TRACE_H

#include "utils.h"

#define TRACE_TYPE_REG		1
#define TRACE_TYPE_COUNTER	2
#define TRACE_TYPE_STRING	3
#define TRACE_TYPE_INDENT	4
#define TRACE_TYPE_OUTDENT	5

struct trace_entry
{
	u8 type;
	u8 length;
	u8 data[0];
};

struct trace_buffer
{
	u64  size;
	bool overflow;
	void *tail;
	u8   data[0];
};

struct trace_buffer *trace_buffer_allocate(u64 size);
int trace_log_reg(struct trace_buffer *tb, u64 reg, u64 value);
int trace_log_counter(struct trace_buffer *tb, u64 value);
int trace_log_string(struct trace_buffer *tb, char *str);
int trace_log_indent(struct trace_buffer *tb);
int trace_log_outdent(struct trace_buffer *tb);
void trace_buffer_print(struct trace_buffer *tb);
void trace_print_location(struct trace_buffer *tb);

#endif /* _SELFTESTS_POWERPC_PMU_EBB_TRACE_H */