• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_INTERNAL_H
18 #define TRACING_PERFETTO_INTERNAL_H
19 
20 #include <stdint.h>
21 
22 #include "perfetto/public/te_category_macros.h"
23 
24 namespace tracing_perfetto {
25 
26 namespace internal {
27 
28 struct PerfettoTeCategory* toPerfettoCategory(uint64_t category);
29 
30 void registerWithPerfetto(bool test = false);
31 
32 void perfettoTraceBegin(const struct PerfettoTeCategory& category, const char* name);
33 
34 void perfettoTraceEnd(const struct PerfettoTeCategory& category);
35 
36 void perfettoTraceAsyncBegin(const struct PerfettoTeCategory& category, const char* name,
37                                uint64_t cookie);
38 
39 void perfettoTraceAsyncEnd(const struct PerfettoTeCategory& category, const char* name,
40                              uint64_t cookie);
41 
42 void perfettoTraceAsyncBeginForTrack(const struct PerfettoTeCategory& category, const char* name,
43                                        const char* trackName, uint64_t cookie);
44 
45 void perfettoTraceAsyncEndForTrack(const struct PerfettoTeCategory& category,
46                                      const char* trackName, uint64_t cookie);
47 
48 void perfettoTraceInstant(const struct PerfettoTeCategory& category, const char* name);
49 
50 void perfettoTraceInstantForTrack(const struct PerfettoTeCategory& category,
51                                     const char* trackName, const char* name);
52 
53 void perfettoTraceCounter(const struct PerfettoTeCategory& category, const char* name,
54                             int64_t value);
55 
56 bool isPerfettoCategoryEnabled(PerfettoTeCategory *perfettoTeCategory);
57 
58 bool shouldPreferAtrace(PerfettoTeCategory *perfettoTeCategory, uint64_t category);
59 
60 }  // namespace internal
61 
62 }  // namespace tracing_perfetto
63 
64 #endif  // TRACING_PERFETTO_INTERNAL_H
65