xref: /aosp_15_r20/external/perfetto/src/trace_processor/importers/proto/default_modules.cc (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1 /*
2  * Copyright (C) 2020 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 "src/trace_processor/importers/proto/default_modules.h"
18 #include "src/trace_processor/importers/etw/etw_module.h"
19 #include "src/trace_processor/importers/ftrace/ftrace_module.h"
20 #include "src/trace_processor/importers/proto/chrome_system_probes_module.h"
21 #include "src/trace_processor/importers/proto/memory_tracker_snapshot_module.h"
22 #include "src/trace_processor/importers/proto/metadata_minimal_module.h"
23 #include "src/trace_processor/importers/proto/profile_module.h"
24 #include "src/trace_processor/importers/proto/proto_importer_module.h"
25 #include "src/trace_processor/importers/proto/track_event_module.h"
26 
27 namespace perfetto {
28 namespace trace_processor {
29 
RegisterDefaultModules(TraceProcessorContext * context)30 void RegisterDefaultModules(TraceProcessorContext* context) {
31   // Ftrace and Etw modules are special, because they have an extra method for
32   // parsing the ftrace/etw packets. So we need to store a pointer to it
33   // separately.
34   context->modules.emplace_back(new FtraceModule());
35   context->ftrace_module =
36       static_cast<FtraceModule*>(context->modules.back().get());
37   context->modules.emplace_back(new EtwModule());
38   context->etw_module = static_cast<EtwModule*>(context->modules.back().get());
39 
40   context->modules.emplace_back(new TrackEventModule(context));
41   context->track_module =
42       static_cast<TrackEventModule*>(context->modules.back().get());
43 
44   context->modules.emplace_back(new MemoryTrackerSnapshotModule(context));
45   context->modules.emplace_back(new ChromeSystemProbesModule(context));
46   context->modules.emplace_back(new ProfileModule(context));
47   context->modules.emplace_back(new MetadataMinimalModule(context));
48 }
49 
50 }  // namespace trace_processor
51 }  // namespace perfetto
52