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 #ifndef TRACING_PERFETTO_H
18 #define TRACING_PERFETTO_H
19 
20 #include <stdint.h>
21 
22 #include "trace_result.h"
23 
24 namespace tracing_perfetto {
25 
26 void registerWithPerfetto(bool test = false);
27 
28 Result traceBegin(uint64_t category, const char* name);
29 
30 Result traceEnd(uint64_t category);
31 
32 Result traceAsyncBegin(uint64_t category, const char* name, int32_t cookie);
33 
34 Result traceAsyncEnd(uint64_t category, const char* name, int32_t cookie);
35 
36 Result traceAsyncBeginForTrack(uint64_t category, const char* name,
37                                const char* trackName, int32_t cookie);
38 
39 Result traceAsyncEndForTrack(uint64_t category, const char* trackName,
40                              int32_t cookie);
41 
42 Result traceInstant(uint64_t category, const char* name);
43 
44 Result traceInstantForTrack(uint64_t category, const char* trackName,
45                             const char* name);
46 
47 Result traceCounter(uint64_t category, const char* name, int64_t value);
48 
49 bool isTagEnabled(uint64_t category);
50 
51 }  // namespace tracing_perfetto
52 
53 #endif  // TRACING_PERFETTO_H
54