/* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef INCLUDE_PERFETTO_TRACING_INTERNAL_DATA_SOURCE_INTERNAL_H_ #define INCLUDE_PERFETTO_TRACING_INTERNAL_DATA_SOURCE_INTERNAL_H_ #include <stddef.h> #include <stdint.h> #include <array> #include <atomic> #include <functional> #include <memory> #include <mutex> // No perfetto headers (other than tracing/api and protozero) should be here. #include "perfetto/tracing/buffer_exhausted_policy.h" #include "perfetto/tracing/core/data_source_config.h" #include "perfetto/tracing/internal/basic_types.h" #include "perfetto/tracing/trace_writer_base.h" namespace perfetto { class DataSourceBase; class InterceptorBase; class TraceWriterBase; namespace internal { class TracingTLS; // This maintains the internal state of a data source instance that is used only // to implement the tracing mechanics and is not exposed to the API client. // There is one of these object per DataSource instance (up to // kMaxDataSourceInstances). struct DataSourceState { … }; // This is to allow lazy-initialization and avoid static initializers and // at-exit destructors. All the entries are initialized via placement-new when // DataSource::Register() is called, see TracingMuxerImpl::RegisterDataSource(). struct DataSourceStateStorage { … }; // Per-DataSource-type global state. struct DataSourceStaticState { … }; // Per-DataSource-instance thread-local state. struct DataSourceInstanceThreadLocalState { … }; // Per-DataSource-type thread-local state. struct DataSourceThreadLocalState { … }; } // namespace internal } // namespace perfetto #endif // INCLUDE_PERFETTO_TRACING_INTERNAL_DATA_SOURCE_INTERNAL_H_