1 //===-- TraceIntelPTBundleSaver.h ----------------------------*- C++ //-*-===// 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 #ifndef LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTBUNDLESAVER_H 10 #define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTBUNDLESAVER_H 11 12 #include "TraceIntelPT.h" 13 14 #include "TraceIntelPTJSONStructs.h" 15 16 namespace lldb_private { 17 namespace trace_intel_pt { 18 19 class TraceIntelPTBundleSaver { 20 public: 21 /// Save the Intel PT trace of a live process to the specified directory, 22 /// which will be created if needed. This will also create a file 23 /// \a <directory>/trace.json with the description of the trace 24 /// bundle, along with others files which contain the actual trace data. 25 /// The trace.json file can be used later as input for the "trace load" 26 /// command to load the trace in LLDB. 27 /// 28 /// \param[in] trace_ipt 29 /// The Intel PT trace to be saved to disk. 30 /// 31 /// \param[in] directory 32 /// The directory where the trace bundle will be created. 33 /// 34 /// \param[in] compact 35 /// Filter out information irrelevant to the traced processes in the 36 /// context switch and intel pt traces when using per-cpu mode. This 37 /// effectively reduces the size of those traces. 38 /// 39 /// \return 40 /// A \a FileSpec pointing to the bundle description file, or an \a 41 /// llvm::Error otherwise. 42 llvm::Expected<FileSpec> SaveToDisk(TraceIntelPT &trace_ipt, 43 FileSpec directory, bool compact); 44 }; 45 46 } // namespace trace_intel_pt 47 } // namespace lldb_private 48 49 #endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTBUNDLESAVER_H 50