blob: ee362f2ee535bfd9e5b3301e3c63eaf461bf653b [file] [log] [blame]
/*
* Copyright (C) 2018 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 SRC_TRACE_PROCESSOR_TRACE_PROCESSOR_CONTEXT_H_
#define SRC_TRACE_PROCESSOR_TRACE_PROCESSOR_CONTEXT_H_
#include <memory>
#include <vector>
#include "perfetto/trace_processor/basic_types.h"
#include "src/trace_processor/destructible.h"
#include "src/trace_processor/importers/proto/proto_importer_module.h"
namespace perfetto {
namespace trace_processor {
class ArgsTracker;
class BinderTracker;
class ChunkedTraceReader;
class ClockTracker;
class EventTracker;
class FtraceModule;
class HeapGraphTracker;
class HeapProfileTracker;
class ProcessTracker;
class SchedEventTracker;
class SliceTracker;
class SystraceParser;
class TraceParser;
class TraceSorter;
class TraceStorage;
class TrackTracker;
class TraceProcessorContext {
public:
TraceProcessorContext();
~TraceProcessorContext();
Config config;
std::unique_ptr<TraceStorage> storage;
std::unique_ptr<TrackTracker> track_tracker;
std::unique_ptr<ArgsTracker> args_tracker;
std::unique_ptr<SliceTracker> slice_tracker;
std::unique_ptr<ProcessTracker> process_tracker;
std::unique_ptr<EventTracker> event_tracker;
std::unique_ptr<SchedEventTracker> sched_tracker;
std::unique_ptr<ClockTracker> clock_tracker;
std::unique_ptr<TraceParser> parser;
std::unique_ptr<TraceSorter> sorter;
std::unique_ptr<ChunkedTraceReader> chunk_reader;
std::unique_ptr<HeapProfileTracker> heap_profile_tracker;
std::unique_ptr<SystraceParser> systrace_parser;
std::unique_ptr<BinderTracker> binder_tracker;
// These fields are stored as pointers to Destructible objects rather than
// their actual type (a subclass of Destructible), as the concrete subclass
// type is only available in the storage_full target. To access these fields,
// use the GetOrCreate() method on their subclass type,
// e.g. SyscallTracker::GetOrCreate(context).
std::unique_ptr<Destructible> syscall_tracker; // SyscallTracker.
// The module at the index N is registered to handle field id N in
// TracePacket.
std::vector<ProtoImporterModule*> modules_by_field;
std::vector<std::unique_ptr<ProtoImporterModule>> modules;
FtraceModule* ftrace_module;
};
} // namespace trace_processor
} // namespace perfetto
#endif // SRC_TRACE_PROCESSOR_TRACE_PROCESSOR_CONTEXT_H_