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