| 1 | //===-- TraceExporterCTF.cpp ----------------------------------------------===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "TraceExporterCTF.h" |
| 10 | |
| 11 | #include <memory> |
| 12 | |
| 13 | #include "CommandObjectThreadTraceExportCTF.h" |
| 14 | #include "lldb/Core/PluginManager.h" |
| 15 | |
| 16 | using namespace lldb; |
| 17 | using namespace lldb_private; |
| 18 | using namespace lldb_private::ctf; |
| 19 | using namespace llvm; |
| 20 | |
| 21 | LLDB_PLUGIN_DEFINE(TraceExporterCTF) |
| 22 | |
| 23 | //------------------------------------------------------------------ |
| 24 | // PluginInterface protocol |
| 25 | //------------------------------------------------------------------ |
| 26 | |
| 27 | static CommandObjectSP |
| 28 | GetThreadTraceExportCommand(CommandInterpreter &interpreter) { |
| 29 | return std::make_shared<CommandObjectThreadTraceExportCTF>(args&: interpreter); |
| 30 | } |
| 31 | |
| 32 | void TraceExporterCTF::Initialize() { |
| 33 | PluginManager::RegisterPlugin(name: GetPluginNameStatic(), |
| 34 | description: "Chrome Trace Format Exporter", create_callback: CreateInstance, |
| 35 | create_thread_trace_export_command: GetThreadTraceExportCommand); |
| 36 | } |
| 37 | |
| 38 | void TraceExporterCTF::Terminate() { |
| 39 | PluginManager::UnregisterPlugin(create_callback: CreateInstance); |
| 40 | } |
| 41 | |
| 42 | Expected<TraceExporterUP> TraceExporterCTF::CreateInstance() { |
| 43 | return std::make_unique<TraceExporterCTF>(); |
| 44 | } |
| 45 |
