• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 #include "perfetto/public/abi/producer_abi.h"
18 
19 #include "perfetto/tracing/backend_type.h"
20 #include "perfetto/tracing/tracing.h"
21 #include "src/shared_lib/reset_for_testing.h"
22 #include "src/tracing/internal/tracing_muxer_impl.h"
23 
24 namespace perfetto {
25 namespace shlib {
26 
ResetForTesting()27 void ResetForTesting() {
28   auto* muxer = static_cast<internal::TracingMuxerImpl*>(
29       internal::TracingMuxerImpl::instance_);
30   muxer->AppendResetForTestingCallback(
31       [] { perfetto::shlib::ResetDataSourceTls(); });
32   perfetto::Tracing::ResetForTesting();
33 }
34 
35 }  // namespace shlib
36 }  // namespace perfetto
37 
PerfettoProducerInProcessInit()38 void PerfettoProducerInProcessInit() {
39   perfetto::TracingInitArgs args;
40   args.backends = perfetto::kInProcessBackend;
41   perfetto::Tracing::Initialize(args);
42 }
43 
PerfettoProducerSystemInit()44 void PerfettoProducerSystemInit() {
45   perfetto::TracingInitArgs args;
46   args.backends = perfetto::kSystemBackend;
47   perfetto::Tracing::Initialize(args);
48 }
49