Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
39648 views
//===-- TraceIntelPTJSONStructs.h -----------------------------*- C++ //-*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTJSONSTRUCTS_H9#define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTJSONSTRUCTS_H1011#include "lldb/Utility/TraceIntelPTGDBRemotePackets.h"12#include "lldb/lldb-types.h"13#include "llvm/Support/JSON.h"14#include <intel-pt.h>15#include <optional>16#include <vector>1718namespace lldb_private {19namespace trace_intel_pt {2021struct JSONModule {22std::string system_path;23std::optional<std::string> file;24JSONUINT64 load_address;25std::optional<std::string> uuid;26};2728struct JSONThread {29uint64_t tid;30std::optional<std::string> ipt_trace;31};3233struct JSONProcess {34uint64_t pid;35std::optional<std::string> triple;36std::vector<JSONThread> threads;37std::vector<JSONModule> modules;38};3940struct JSONCpu {41lldb::cpu_id_t id;42std::string ipt_trace;43std::string context_switch_trace;44};4546struct JSONKernel {47std::optional<JSONUINT64> load_address;48std::string file;49};5051struct JSONTraceBundleDescription {52std::string type;53pt_cpu cpu_info;54std::optional<std::vector<JSONProcess>> processes;55std::optional<std::vector<JSONCpu>> cpus;56std::optional<LinuxPerfZeroTscConversion> tsc_perf_zero_conversion;57std::optional<JSONKernel> kernel;5859std::optional<std::vector<lldb::cpu_id_t>> GetCpuIds();60};6162llvm::json::Value toJSON(const JSONModule &module);6364llvm::json::Value toJSON(const JSONThread &thread);6566llvm::json::Value toJSON(const JSONProcess &process);6768llvm::json::Value toJSON(const JSONCpu &cpu);6970llvm::json::Value toJSON(const pt_cpu &cpu_info);7172llvm::json::Value toJSON(const JSONKernel &kernel);7374llvm::json::Value toJSON(const JSONTraceBundleDescription &bundle_description);7576bool fromJSON(const llvm::json::Value &value, JSONModule &module,77llvm::json::Path path);7879bool fromJSON(const llvm::json::Value &value, JSONThread &thread,80llvm::json::Path path);8182bool fromJSON(const llvm::json::Value &value, JSONProcess &process,83llvm::json::Path path);8485bool fromJSON(const llvm::json::Value &value, JSONCpu &cpu,86llvm::json::Path path);8788bool fromJSON(const llvm::json::Value &value, pt_cpu &cpu_info,89llvm::json::Path path);9091bool fromJSON(const llvm::json::Value &value, JSONModule &kernel,92llvm::json::Path path);9394bool fromJSON(const llvm::json::Value &value,95JSONTraceBundleDescription &bundle_description,96llvm::json::Path path);97} // namespace trace_intel_pt98} // namespace lldb_private99100#endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTJSONSTRUCTS_H101102103