xref: /aosp_15_r20/frameworks/native/libs/tracing_perfetto/include/tracing_perfetto.h (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1 /*
2  * Copyright 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <stdint.h>
20 
21 namespace tracing_perfetto {
22 
23 void registerWithPerfetto(bool test = false);
24 
25 void traceBegin(uint64_t category, const char* name);
26 
27 void traceEnd(uint64_t category);
28 
29 void traceAsyncBegin(uint64_t category, const char* name, int32_t cookie);
30 
31 void traceFormatBegin(uint64_t category, const char* fmt, ...);
32 
33 void traceAsyncEnd(uint64_t category, const char* name, int32_t cookie);
34 
35 void traceAsyncBeginForTrack(uint64_t category, const char* name,
36                                const char* trackName, int32_t cookie);
37 
38 void traceAsyncEndForTrack(uint64_t category, const char* trackName,
39                              int32_t cookie);
40 
41 void traceInstant(uint64_t category, const char* name);
42 
43 void traceFormatInstant(uint64_t category, const char* fmt, ...);
44 
45 void traceInstantForTrack(uint64_t category, const char* trackName,
46                             const char* name);
47 
48 void traceCounter(uint64_t category, const char* name, int64_t value);
49 
50 void traceCounter32(uint64_t category, const char* name, int32_t value);
51 
52 bool isTagEnabled(uint64_t category);
53 }  // namespace tracing_perfetto
54