blob: 96d5eea9f96de64e13f9f0fd198a265a103b6639
1 | /* |
2 | * include/trace/events/meson_atrace.h |
3 | * |
4 | * Copyright (C) 2017 Amlogic, Inc. All rights reserved. |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. |
10 | * |
11 | * This program is distributed in the hope that it will be useful, but WITHOUT |
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
14 | * more details. |
15 | * |
16 | */ |
17 | |
18 | /* |
19 | * This file enables ftrace logging in a way that |
20 | * atrace/systrace would understand |
21 | * without any custom javascript change in chromium-trace |
22 | */ |
23 | #undef TRACE_SYSTEM |
24 | #define TRACE_SYSTEM meson_atrace |
25 | |
26 | #if !defined(_TRACE_MESON_BASE_H) || defined(TRACE_HEADER_MULTI_READ) |
27 | #define _TRACE_MESON_BASE_H |
28 | |
29 | #include <linux/tracepoint.h> |
30 | |
31 | |
32 | #define KERNEL_ATRACE_COUNTER 0 |
33 | #define KERNEL_ATRACE_BEGIN 1 |
34 | #define KERNEL_ATRACE_END 2 |
35 | |
36 | #define print_flags_header(flags) __print_flags(flags, "", \ |
37 | { (1UL << KERNEL_ATRACE_COUNTER), "C" }, \ |
38 | { (1UL << KERNEL_ATRACE_BEGIN), "B" }, \ |
39 | { (1UL << KERNEL_ATRACE_END), "E" }) |
40 | |
41 | |
42 | #define print_flags_delim(flags) __print_flags(flags, "", \ |
43 | { (1UL << KERNEL_ATRACE_COUNTER), "|1|" }, \ |
44 | { (1UL << KERNEL_ATRACE_BEGIN), "|1|" }, \ |
45 | { (1UL << KERNEL_ATRACE_END), "" }) |
46 | |
47 | TRACE_EVENT(tracing_mark_write, |
48 | |
49 | TP_PROTO(const char *name, unsigned int flags, unsigned int value), |
50 | |
51 | TP_ARGS(name, flags, value), |
52 | |
53 | TP_STRUCT__entry( |
54 | __string(name, name) |
55 | __field(unsigned int, flags) |
56 | __field(unsigned int, value) |
57 | ), |
58 | |
59 | TP_fast_assign( |
60 | __assign_str(name, name); |
61 | __entry->flags = flags; |
62 | __entry->value = value; |
63 | ), |
64 | |
65 | TP_printk("%s%s%s|%u", print_flags_header(__entry->flags), |
66 | print_flags_delim(__entry->flags), |
67 | __get_str(name), __entry->value) |
68 | ); |
69 | #ifdef CONFIG_AMLOGIC_DEBUG_ATRACE |
70 | #define ATRACE_COUNTER(name, value) \ |
71 | trace_tracing_mark_write(name, (1 << KERNEL_ATRACE_COUNTER), value) |
72 | #define ATRACE_BEGIN(name) \ |
73 | trace_tracing_mark_write(name, (1 << KERNEL_ATRACE_BEGIN), 0) |
74 | #define ATRACE_END(name) \ |
75 | trace_tracing_mark_write("", (1 << KERNEL_ATRACE_END), 1) |
76 | #else |
77 | #define ATRACE_COUNTER(name, value) |
78 | #define ATRACE_BEGIN(name) |
79 | #define ATRACE_END(name) |
80 | #endif |
81 | |
82 | #endif /* _TRACE_MESON_BASE_H */ |
83 | |
84 | /* This part must be outside protection */ |
85 | #include <trace/define_trace.h> |
86 |