Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Trace / intel-pt / TraceIntelPTJSONStructs.h
blob93156aa4aa9e5372a5357c14b11668aafaa17c56
1 //===-- TraceIntelPTJSONStructs.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 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTJSONSTRUCTS_H
10 #define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTJSONSTRUCTS_H
12 #include "lldb/Utility/TraceIntelPTGDBRemotePackets.h"
13 #include "lldb/lldb-types.h"
14 #include "llvm/Support/JSON.h"
15 #include <intel-pt.h>
16 #include <optional>
17 #include <vector>
19 namespace lldb_private {
20 namespace trace_intel_pt {
22 struct JSONModule {
23 std::string system_path;
24 std::optional<std::string> file;
25 JSONUINT64 load_address;
26 std::optional<std::string> uuid;
29 struct JSONThread {
30 uint64_t tid;
31 std::optional<std::string> ipt_trace;
34 struct JSONProcess {
35 uint64_t pid;
36 std::optional<std::string> triple;
37 std::vector<JSONThread> threads;
38 std::vector<JSONModule> modules;
41 struct JSONCpu {
42 lldb::cpu_id_t id;
43 std::string ipt_trace;
44 std::string context_switch_trace;
47 struct JSONKernel {
48 std::optional<JSONUINT64> load_address;
49 std::string file;
52 struct JSONTraceBundleDescription {
53 std::string type;
54 pt_cpu cpu_info;
55 std::optional<std::vector<JSONProcess>> processes;
56 std::optional<std::vector<JSONCpu>> cpus;
57 std::optional<LinuxPerfZeroTscConversion> tsc_perf_zero_conversion;
58 std::optional<JSONKernel> kernel;
60 std::optional<std::vector<lldb::cpu_id_t>> GetCpuIds();
63 llvm::json::Value toJSON(const JSONModule &module);
65 llvm::json::Value toJSON(const JSONThread &thread);
67 llvm::json::Value toJSON(const JSONProcess &process);
69 llvm::json::Value toJSON(const JSONCpu &cpu);
71 llvm::json::Value toJSON(const pt_cpu &cpu_info);
73 llvm::json::Value toJSON(const JSONKernel &kernel);
75 llvm::json::Value toJSON(const JSONTraceBundleDescription &bundle_description);
77 bool fromJSON(const llvm::json::Value &value, JSONModule &module,
78 llvm::json::Path path);
80 bool fromJSON(const llvm::json::Value &value, JSONThread &thread,
81 llvm::json::Path path);
83 bool fromJSON(const llvm::json::Value &value, JSONProcess &process,
84 llvm::json::Path path);
86 bool fromJSON(const llvm::json::Value &value, JSONCpu &cpu,
87 llvm::json::Path path);
89 bool fromJSON(const llvm::json::Value &value, pt_cpu &cpu_info,
90 llvm::json::Path path);
92 bool fromJSON(const llvm::json::Value &value, JSONModule &kernel,
93 llvm::json::Path path);
95 bool fromJSON(const llvm::json::Value &value,
96 JSONTraceBundleDescription &bundle_description,
97 llvm::json::Path path);
98 } // namespace trace_intel_pt
99 } // namespace lldb_private
101 #endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTJSONSTRUCTS_H