1 /* 2 * Copyright (C) 2019 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/additional_modules.h" 18 19 #include <memory> 20 21 #include "src/trace_processor/importers/etw/etw_module_impl.h" 22 #include "src/trace_processor/importers/ftrace/ftrace_module_impl.h" 23 #include "src/trace_processor/importers/proto/android_camera_event_module.h" 24 #include "src/trace_processor/importers/proto/android_kernel_wakelocks_module.h" 25 #include "src/trace_processor/importers/proto/android_probes_module.h" 26 #include "src/trace_processor/importers/proto/content_analyzer.h" 27 #include "src/trace_processor/importers/proto/graphics_event_module.h" 28 #include "src/trace_processor/importers/proto/heap_graph_module.h" 29 #include "src/trace_processor/importers/proto/metadata_module.h" 30 #include "src/trace_processor/importers/proto/multi_machine_trace_manager.h" 31 #include "src/trace_processor/importers/proto/network_trace_module.h" 32 #include "src/trace_processor/importers/proto/pixel_modem_module.h" 33 #include "src/trace_processor/importers/proto/profile_module.h" 34 #include "src/trace_processor/importers/proto/statsd_module.h" 35 #include "src/trace_processor/importers/proto/system_probes_module.h" 36 #include "src/trace_processor/importers/proto/trace.descriptor.h" 37 #include "src/trace_processor/importers/proto/translation_table_module.h" 38 #include "src/trace_processor/importers/proto/v8_module.h" 39 #include "src/trace_processor/importers/proto/winscope/winscope_module.h" 40 41 namespace perfetto::trace_processor { 42 RegisterAdditionalModules(TraceProcessorContext * context)43void RegisterAdditionalModules(TraceProcessorContext* context) { 44 // Content analyzer and metadata module both depend on this. 45 context->descriptor_pool_->AddFromFileDescriptorSet(kTraceDescriptor.data(), 46 kTraceDescriptor.size()); 47 48 context->modules.emplace_back(new AndroidKernelWakelocksModule(context)); 49 context->modules.emplace_back(new AndroidProbesModule(context)); 50 context->modules.emplace_back(new NetworkTraceModule(context)); 51 context->modules.emplace_back(new GraphicsEventModule(context)); 52 context->modules.emplace_back(new HeapGraphModule(context)); 53 context->modules.emplace_back(new SystemProbesModule(context)); 54 context->modules.emplace_back(new TranslationTableModule(context)); 55 context->modules.emplace_back(new StatsdModule(context)); 56 context->modules.emplace_back(new AndroidCameraEventModule(context)); 57 context->modules.emplace_back(new MetadataModule(context)); 58 context->modules.emplace_back(new V8Module(context)); 59 context->modules.emplace_back(new WinscopeModule(context)); 60 context->modules.emplace_back(new PixelModemModule(context)); 61 context->modules.emplace_back(new ProfileModule(context)); 62 63 // Ftrace/Etw modules are special, because it has one extra method for parsing 64 // ftrace/etw packets. So we need to store a pointer to it separately. 65 context->modules.emplace_back(new FtraceModuleImpl(context)); 66 context->ftrace_module = 67 static_cast<FtraceModule*>(context->modules.back().get()); 68 context->modules.emplace_back(new EtwModuleImpl(context)); 69 context->etw_module = static_cast<EtwModule*>(context->modules.back().get()); 70 71 if (context->multi_machine_trace_manager) { 72 context->multi_machine_trace_manager->EnableAdditionalModules( 73 RegisterAdditionalModules); 74 } 75 76 if (context->config.analyze_trace_proto_content) { 77 context->content_analyzer = std::make_unique<ProtoContentAnalyzer>(context); 78 } 79 } 80 81 } // namespace perfetto::trace_processor 82