[Lldb-commits] [lldb] 6a5355e - [trace][intelpt] Support system-wide tracing [20] - Rename some fields in the schema
Walter Erquinigo via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 16 11:42:33 PDT 2022
Author: Walter Erquinigo
Date: 2022-06-16T11:42:22-07:00
New Revision: 6a5355e8a159bd9c058d4fbba2a87e0465fe0dc7
URL: https://github.com/llvm/llvm-project/commit/6a5355e8a159bd9c058d4fbba2a87e0465fe0dc7
DIFF: https://github.com/llvm/llvm-project/commit/6a5355e8a159bd9c058d4fbba2a87e0465fe0dc7.diff
LOG: [trace][intelpt] Support system-wide tracing [20] - Rename some fields in the schema
As discusses offline with @jj10305, we are updating some naming used throughout the code, specially in the json schema
- traceBuffer -> iptTrace
- core -> cpu
Differential Revision: https://reviews.llvm.org/D127817
Added:
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
Modified:
lldb/docs/lldb-gdb-remote.txt
lldb/docs/use/intel_pt.rst
lldb/include/lldb/Target/Trace.h
lldb/include/lldb/Utility/TraceGDBRemotePackets.h
lldb/include/lldb/Utility/TraceIntelPTGDBRemotePackets.h
lldb/include/lldb/lldb-types.h
lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h
lldb/source/Plugins/Process/Linux/Perf.cpp
lldb/source/Plugins/Process/Linux/Perf.h
lldb/source/Plugins/Process/Linux/Procfs.cpp
lldb/source/Plugins/Process/Linux/Procfs.h
lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp
lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.h
lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.cpp
lldb/source/Target/Trace.cpp
lldb/source/Utility/TraceGDBRemotePackets.cpp
lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp
lldb/test/API/commands/trace/TestTraceSave.py
lldb/test/API/commands/trace/TestTraceSchema.py
lldb/test/API/commands/trace/TestTraceStartStop.py
lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json
lldb/test/API/commands/trace/intelpt-multi-core-trace/trace_missing_threads.json
lldb/test/API/commands/trace/intelpt-trace-multi-file/multi-file-no-ld.json
lldb/test/API/commands/trace/intelpt-trace/trace.json
lldb/test/API/commands/trace/intelpt-trace/trace_2threads.json
lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
lldb/test/API/commands/trace/intelpt-trace/trace_bad3.json
lldb/test/API/commands/trace/intelpt-trace/trace_bad5.json
lldb/test/API/commands/trace/intelpt-trace/trace_bad_image.json
lldb/test/API/commands/trace/intelpt-trace/trace_wrong_cpu.json
lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
lldb/unittests/Process/Linux/ProcfsTests.cpp
Removed:
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.h
################################################################################
diff --git a/lldb/docs/lldb-gdb-remote.txt b/lldb/docs/lldb-gdb-remote.txt
index 4a06964c30cab..4f0cfa4585b0a 100644
--- a/lldb/docs/lldb-gdb-remote.txt
+++ b/lldb/docs/lldb-gdb-remote.txt
@@ -308,13 +308,14 @@ read packet: {"name":<name>, "description":<description>}/E<error code>;AAAAAAAA
// might result in less data available for less frequent threads. See
// "perCoreTracing" below for more information.
//
-// Each actual trace buffer, either from "process tracing" or "thread tracing",
-// is stored in an in-memory circular buffer, which keeps the most recent data.
+// Each actual intel pt trace buffer, either from "process tracing" or "thread
+// tracing", is stored in an in-memory circular buffer, which keeps the most
+// recent data.
//
// Additional params in the input schema:
// {
-// "traceBufferSize": <decimal integer>,
-// Size in bytes used by each individual per-thread or per-core trace
+// "iptTraceSize": <decimal integer>,
+// Size in bytes used by each individual per-thread or per-cpu trace
// buffer. It must be a power of 2 greater than or equal to 4096 (2^12)
// bytes.
//
@@ -369,7 +370,7 @@ read packet: {"name":<name>, "description":<description>}/E<error code>;AAAAAAAA
// /* process tracing only */
// "processBufferSizeLimit": <decimal integer>,
// Maximum total buffer size per process in bytes.
-// This limit applies to the sum of the sizes of all thread or core
+// This limit applies to the sum of the sizes of all thread or cpu core
// buffers for the current process, excluding the ones started with
// "thread tracing".
//
@@ -482,7 +483,7 @@ read packet: OK/E<error code>;AAAAAAAAA
// Size in bytes of this thread data.
// },
// ],
-// "cores"?: [
+// "cpus"?: [
// "id": <decimal integer>,
// Identifier for this CPU logical core.
// "binaryData": [
@@ -507,15 +508,15 @@ read packet: OK/E<error code>;AAAAAAAAA
//
// INTEL PT
//
-// If per-core process tracing is enabled, "tracedThreads" will contain all
+// If per-cpu process tracing is enabled, "tracedThreads" will contain all
// the threads of the process without any trace buffers. Besides that, the
-// "cores" field will also be returned with per core trace buffers.
-// A side effect of per-core tracing is that all the threads of unrelated
+// "cpus" field will also be returned with per cpu core trace buffers.
+// A side effect of per-cpu tracing is that all the threads of unrelated
// processes will also be traced, thus polluting the tracing data.
//
// Binary data kinds:
-// - traceBuffer: trace buffer for a thread or a core.
-// - perfContextSwitchTrace: context switch trace for a core generated by
+// - iptTrace: trace buffer for a thread or a cpu.
+// - perfContextSwitchTrace: context switch trace for a cpu generated by
// perf_event_open.
// - procfsCpuInfo: contents of the /proc/cpuinfo file.
//
@@ -558,17 +559,11 @@ read packet: {...object}/E<error code>;AAAAAAAAA
// Tracing technology name, e.g. intel-pt, arm-etm.
// "kind": <string>,
// Identifier for the data.
-// "coreId": <Optional decimal>,
+// "cpuId": <Optional decimal>,
// Core id in decimal if the data belongs to a CPU core.
// "tid"?: <Optional decimal>,
// Tid in decimal if the data belongs to a thread.
// }
-//
-// INTEL PT
-//
-// Binary data kinds:
-// - traceBuffer: trace buffer for a thread or a core.
-// - procfsCpuInfo: contents of the /proc/cpuinfo file.
//----------------------------------------------------------------------
send packet: jLLDBTraceGetBinaryData:{"type":<type>,"kind":<query>,"tid":<tid>,"offset":<offset>,"size":<size>}]
diff --git a/lldb/docs/use/intel_pt.rst b/lldb/docs/use/intel_pt.rst
index ae6f72011ace4..3d615e30f99ef 100644
--- a/lldb/docs/use/intel_pt.rst
+++ b/lldb/docs/use/intel_pt.rst
@@ -196,7 +196,7 @@ For example
"threads": [
{
"tid": 815455,
- "traceBuffer": "trace.file" # raw thread-specific trace from the AUX buffer
+ "iptTrace": "trace.file" # raw thread-specific trace from the AUX buffer
}
],
"modules": [ # this are all the shared libraries + the main executable
diff --git a/lldb/include/lldb/Target/Trace.h b/lldb/include/lldb/Target/Trace.h
index 63d8443715931..2fee3c9274959 100644
--- a/lldb/include/lldb/Target/Trace.h
+++ b/lldb/include/lldb/Target/Trace.h
@@ -82,7 +82,7 @@ class Trace : public PluginInterface,
/// - The plug-in name (this allows a specific plug-in to be selected)
/// - Architecture or target triple
/// - one or more paths to the trace data file on disk
- /// - core trace data
+ /// - cpu trace data
/// - thread events or related information
/// - shared library load information to use for this trace data that
/// allows a target to be created so the trace information can be
@@ -240,9 +240,9 @@ class Trace : public PluginInterface,
using OnBinaryDataReadCallback =
std::function<llvm::Error(llvm::ArrayRef<uint8_t> data)>;
- using OnCoresBinaryDataReadCallback = std::function<llvm::Error(
- const llvm::DenseMap<lldb::core_id_t, llvm::ArrayRef<uint8_t>>
- &core_to_data)>;
+ using OnCpusBinaryDataReadCallback = std::function<llvm::Error(
+ const llvm::DenseMap<lldb::cpu_id_t, llvm::ArrayRef<uint8_t>>
+ &cpu_to_data)>;
/// Fetch binary data associated with a thread, either live or postmortem, and
/// pass it to the given callback. The reason of having a callback is to free
@@ -269,16 +269,16 @@ class Trace : public PluginInterface,
llvm::Error OnThreadBinaryDataRead(lldb::tid_t tid, llvm::StringRef kind,
OnBinaryDataReadCallback callback);
- /// Fetch binary data associated with a core, either live or postmortem, and
+ /// Fetch binary data associated with a cpu, either live or postmortem, and
/// pass it to the given callback. The reason of having a callback is to free
/// the caller from having to manage the life cycle of the data and to hide
/// the
diff erent data fetching procedures that exist for live and post mortem
- /// cores.
+ /// cpus.
///
/// The fetched data is not persisted after the callback is invoked.
///
- /// \param[in] core_id
- /// The core who owns the data.
+ /// \param[in] cpu_id
+ /// The cpu who owns the data.
///
/// \param[in] kind
/// The kind of data to read.
@@ -291,23 +291,22 @@ class Trace : public PluginInterface,
/// \return
/// An \a llvm::Error if the data couldn't be fetched, or the return value
/// of the callback, otherwise.
- llvm::Error OnCoreBinaryDataRead(lldb::core_id_t core_id,
- llvm::StringRef kind,
- OnBinaryDataReadCallback callback);
+ llvm::Error OnCpuBinaryDataRead(lldb::cpu_id_t cpu_id, llvm::StringRef kind,
+ OnBinaryDataReadCallback callback);
- /// Similar to \a OnCoreBinaryDataRead but this is able to fetch the same data
- /// from all cores at once.
- llvm::Error OnAllCoresBinaryDataRead(llvm::StringRef kind,
- OnCoresBinaryDataReadCallback callback);
+ /// Similar to \a OnCpuBinaryDataRead but this is able to fetch the same data
+ /// from all cpus at once.
+ llvm::Error OnAllCpusBinaryDataRead(llvm::StringRef kind,
+ OnCpusBinaryDataReadCallback callback);
/// \return
/// All the currently traced processes.
std::vector<Process *> GetAllProcesses();
/// \return
- /// The list of cores being traced. Might be empty depending on the
+ /// The list of cpus being traced. Might be empty depending on the
/// plugin.
- llvm::ArrayRef<lldb::core_id_t> GetTracedCores();
+ llvm::ArrayRef<lldb::cpu_id_t> GetTracedCpus();
/// Helper method for reading a data file and passing its data to the given
/// callback.
@@ -337,20 +336,19 @@ class Trace : public PluginInterface,
llvm::Error OnLiveThreadBinaryDataRead(lldb::tid_t tid, llvm::StringRef kind,
OnBinaryDataReadCallback callback);
- /// Implementation of \a OnLiveBinaryDataRead() for live cores.
- llvm::Error OnLiveCoreBinaryDataRead(lldb::core_id_t core,
- llvm::StringRef kind,
- OnBinaryDataReadCallback callback);
+ /// Implementation of \a OnLiveBinaryDataRead() for live cpus.
+ llvm::Error OnLiveCpuBinaryDataRead(lldb::cpu_id_t cpu, llvm::StringRef kind,
+ OnBinaryDataReadCallback callback);
/// Implementation of \a OnThreadBinaryDataRead() for post mortem threads.
llvm::Error
OnPostMortemThreadBinaryDataRead(lldb::tid_t tid, llvm::StringRef kind,
OnBinaryDataReadCallback callback);
- /// Implementation of \a OnCoreBinaryDataRead() for post mortem cores.
- llvm::Error OnPostMortemCoreBinaryDataRead(lldb::core_id_t core_id,
- llvm::StringRef kind,
- OnBinaryDataReadCallback callback);
+ /// Implementation of \a OnCpuBinaryDataRead() for post mortem cpus.
+ llvm::Error OnPostMortemCpuBinaryDataRead(lldb::cpu_id_t cpu_id,
+ llvm::StringRef kind,
+ OnBinaryDataReadCallback callback);
/// Get the file path containing data of a postmortem thread given a data
/// identifier.
@@ -367,11 +365,11 @@ class Trace : public PluginInterface,
llvm::Expected<FileSpec> GetPostMortemThreadDataFile(lldb::tid_t tid,
llvm::StringRef kind);
- /// Get the file path containing data of a postmortem core given a data
+ /// Get the file path containing data of a postmortem cpu given a data
/// identifier.
///
- /// \param[in] core_id
- /// The core whose data is requested.
+ /// \param[in] cpu_id
+ /// The cpu whose data is requested.
///
/// \param[in] kind
/// The kind of data requested.
@@ -379,8 +377,8 @@ class Trace : public PluginInterface,
/// \return
/// The file spec containing the requested data, or an \a llvm::Error in
/// case of failures.
- llvm::Expected<FileSpec> GetPostMortemCoreDataFile(lldb::core_id_t core_id,
- llvm::StringRef kind);
+ llvm::Expected<FileSpec> GetPostMortemCpuDataFile(lldb::cpu_id_t cpu_id,
+ llvm::StringRef kind);
/// Associate a given thread with a data file using a data identifier.
///
@@ -395,18 +393,18 @@ class Trace : public PluginInterface,
void SetPostMortemThreadDataFile(lldb::tid_t tid, llvm::StringRef kind,
FileSpec file_spec);
- /// Associate a given core with a data file using a data identifier.
+ /// Associate a given cpu with a data file using a data identifier.
///
- /// \param[in] core_id
- /// The core associated with the data file.
+ /// \param[in] cpu_id
+ /// The cpu associated with the data file.
///
/// \param[in] kind
/// The kind of data being registered.
///
/// \param[in] file_spec
/// The path of the data file.
- void SetPostMortemCoreDataFile(lldb::core_id_t core_id, llvm::StringRef kind,
- FileSpec file_spec);
+ void SetPostMortemCpuDataFile(lldb::cpu_id_t cpu_id, llvm::StringRef kind,
+ FileSpec file_spec);
/// Get binary data of a live thread given a data identifier.
///
@@ -422,10 +420,10 @@ class Trace : public PluginInterface,
llvm::Expected<std::vector<uint8_t>>
GetLiveThreadBinaryData(lldb::tid_t tid, llvm::StringRef kind);
- /// Get binary data of a live core given a data identifier.
+ /// Get binary data of a live cpu given a data identifier.
///
- /// \param[in] core_id
- /// The core whose data is requested.
+ /// \param[in] cpu_id
+ /// The cpu whose data is requested.
///
/// \param[in] kind
/// The kind of data requested.
@@ -434,7 +432,7 @@ class Trace : public PluginInterface,
/// A vector of bytes with the requested data, or an \a llvm::Error in
/// case of failures.
llvm::Expected<std::vector<uint8_t>>
- GetLiveCoreBinaryData(lldb::core_id_t core_id, llvm::StringRef kind);
+ GetLiveCpuBinaryData(lldb::cpu_id_t cpu_id, llvm::StringRef kind);
/// Get binary data of the current process given a data identifier.
///
@@ -451,16 +449,16 @@ class Trace : public PluginInterface,
llvm::Optional<uint64_t> GetLiveThreadBinaryDataSize(lldb::tid_t tid,
llvm::StringRef kind);
- /// Get the size of the data returned by \a GetLiveCoreBinaryData
- llvm::Optional<uint64_t> GetLiveCoreBinaryDataSize(lldb::core_id_t core_id,
- llvm::StringRef kind);
+ /// Get the size of the data returned by \a GetLiveCpuBinaryData
+ llvm::Optional<uint64_t> GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id,
+ llvm::StringRef kind);
/// Get the size of the data returned by \a GetLiveProcessBinaryData
llvm::Optional<uint64_t> GetLiveProcessBinaryDataSize(llvm::StringRef kind);
/// Constructor for post mortem processes
Trace(llvm::ArrayRef<lldb::ProcessSP> postmortem_processes,
- llvm::Optional<std::vector<lldb::core_id_t>> postmortem_cores);
+ llvm::Optional<std::vector<lldb::cpu_id_t>> postmortem_cpus);
/// Constructor for a live process
Trace(Process &live_process) : m_live_process(&live_process) {}
@@ -541,21 +539,21 @@ class Trace : public PluginInterface,
llvm::DenseMap<lldb::tid_t, llvm::DenseMap<ConstString, uint64_t>>
live_thread_data;
- /// core id -> data kind -> size
- llvm::DenseMap<lldb::core_id_t, llvm::DenseMap<ConstString, uint64_t>>
- live_core_data_sizes;
- /// core id -> data kind -> bytes
- llvm::DenseMap<lldb::core_id_t,
+ /// cpu id -> data kind -> size
+ llvm::DenseMap<lldb::cpu_id_t, llvm::DenseMap<ConstString, uint64_t>>
+ live_cpu_data_sizes;
+ /// cpu id -> data kind -> bytes
+ llvm::DenseMap<lldb::cpu_id_t,
llvm::DenseMap<ConstString, std::vector<uint8_t>>>
- live_core_data;
+ live_cpu_data;
/// data kind -> size
llvm::DenseMap<ConstString, uint64_t> live_process_data;
/// \}
- /// The list of cores being traced. Might be \b None depending on the
+ /// The list of cpus being traced. Might be \b None depending on the
/// plug-in.
- llvm::Optional<std::vector<lldb::core_id_t>> cores;
+ llvm::Optional<std::vector<lldb::cpu_id_t>> cpus;
/// Postmortem traces can specific additional data files, which are
/// represented in this variable using a data kind identifier for each file.
@@ -565,9 +563,9 @@ class Trace : public PluginInterface,
llvm::DenseMap<lldb::tid_t, llvm::DenseMap<ConstString, FileSpec>>
postmortem_thread_data;
- /// core id -> data kind -> file
- llvm::DenseMap<lldb::core_id_t, llvm::DenseMap<ConstString, FileSpec>>
- postmortem_core_data;
+ /// cpu id -> data kind -> file
+ llvm::DenseMap<lldb::cpu_id_t, llvm::DenseMap<ConstString, FileSpec>>
+ postmortem_cpu_data;
/// \}
diff --git a/lldb/include/lldb/Utility/TraceGDBRemotePackets.h b/lldb/include/lldb/Utility/TraceGDBRemotePackets.h
index 44f566190e3a6..c6d3f524d1d11 100644
--- a/lldb/include/lldb/Utility/TraceGDBRemotePackets.h
+++ b/lldb/include/lldb/Utility/TraceGDBRemotePackets.h
@@ -118,21 +118,21 @@ bool fromJSON(const llvm::json::Value &value, TraceThreadState &packet,
llvm::json::Value toJSON(const TraceThreadState &packet);
-struct TraceCoreState {
- lldb::core_id_t core_id;
+struct TraceCpuState {
+ lldb::cpu_id_t id;
/// List of binary data objects for this core.
std::vector<TraceBinaryData> binary_data;
};
-bool fromJSON(const llvm::json::Value &value, TraceCoreState &packet,
+bool fromJSON(const llvm::json::Value &value, TraceCpuState &packet,
llvm::json::Path path);
-llvm::json::Value toJSON(const TraceCoreState &packet);
+llvm::json::Value toJSON(const TraceCpuState &packet);
struct TraceGetStateResponse {
std::vector<TraceThreadState> traced_threads;
std::vector<TraceBinaryData> process_binary_data;
- llvm::Optional<std::vector<TraceCoreState>> cores;
+ llvm::Optional<std::vector<TraceCpuState>> cpus;
llvm::Optional<std::vector<std::string>> warnings;
void AddWarning(llvm::StringRef warning);
@@ -154,7 +154,7 @@ struct TraceGetBinaryDataRequest {
/// Optional tid if the data is related to a thread.
llvm::Optional<lldb::tid_t> tid;
/// Optional core id if the data is related to a cpu core.
- llvm::Optional<lldb::core_id_t> core_id;
+ llvm::Optional<lldb::cpu_id_t> cpu_id;
};
bool fromJSON(const llvm::json::Value &value,
diff --git a/lldb/include/lldb/Utility/TraceIntelPTGDBRemotePackets.h b/lldb/include/lldb/Utility/TraceIntelPTGDBRemotePackets.h
index b6acd741747aa..6a9fde7050ee6 100644
--- a/lldb/include/lldb/Utility/TraceIntelPTGDBRemotePackets.h
+++ b/lldb/include/lldb/Utility/TraceIntelPTGDBRemotePackets.h
@@ -24,7 +24,7 @@ namespace lldb_private {
// List of data kinds used by jLLDBGetState and jLLDBGetBinaryData.
struct IntelPTDataKinds {
static const char *kProcFsCpuInfo;
- static const char *kTraceBuffer;
+ static const char *kIptTrace;
static const char *kPerfContextSwitchTrace;
};
@@ -32,7 +32,7 @@ struct IntelPTDataKinds {
/// \{
struct TraceIntelPTStartRequest : TraceStartRequest {
/// Size in bytes to use for each thread's trace buffer.
- uint64_t trace_buffer_size;
+ uint64_t ipt_trace_size;
/// Whether to enable TSC
bool enable_tsc;
@@ -47,10 +47,10 @@ struct TraceIntelPTStartRequest : TraceStartRequest {
/// then a "tracing" stop event is triggered.
llvm::Optional<uint64_t> process_buffer_size_limit;
- /// Whether to have a trace buffer per thread or per cpu core.
- llvm::Optional<bool> per_core_tracing;
+ /// Whether to have a trace buffer per thread or per cpu cpu.
+ llvm::Optional<bool> per_cpu_tracing;
- bool IsPerCoreTracing() const;
+ bool IsPerCpuTracing() const;
};
bool fromJSON(const llvm::json::Value &value, TraceIntelPTStartRequest &packet,
diff --git a/lldb/include/lldb/lldb-types.h b/lldb/include/lldb/lldb-types.h
index e6567926909fc..462f4275042cc 100644
--- a/lldb/include/lldb/lldb-types.h
+++ b/lldb/include/lldb/lldb-types.h
@@ -89,7 +89,7 @@ typedef int32_t break_id_t;
typedef int32_t watch_id_t;
typedef void *opaque_compiler_type_t;
typedef uint64_t queue_id_t;
-typedef uint32_t core_id_t; // CPU core id
+typedef uint32_t cpu_id_t; // CPU core id
} // namespace lldb
#endif // LLDB_LLDB_TYPES_H
diff --git a/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
index dee428993a1b4..501429036c718 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
@@ -33,7 +33,7 @@ def setUp(self):
if 'intel-pt' not in configuration.enabled_plugins:
self.skipTest("The intel-pt test plugin is not enabled")
- def skipIfPerCoreTracingIsNotSupported(self):
+ def skipIfPerCpuTracingIsNotSupported(self):
def is_supported():
try:
with open("/proc/sys/kernel/perf_event_paranoid", "r") as permissions:
@@ -43,7 +43,7 @@ def is_supported():
except:
return False
if not is_supported():
- self.skipTest("Per core tracing is not supported. You need "
+ self.skipTest("Per cpu tracing is not supported. You need "
"/proc/sys/kernel/perf_event_paranoid to be 0 or -1.")
def getTraceOrCreate(self):
@@ -58,38 +58,38 @@ def assertSBError(self, sberror, error=False):
else:
self.assertSuccess(sberror)
- def createConfiguration(self, traceBufferSize=None,
+ def createConfiguration(self, iptTraceSize=None,
processBufferSizeLimit=None, enableTsc=False,
- psbPeriod=None, perCoreTracing=False):
+ psbPeriod=None, perCpuTracing=False):
obj = {}
if processBufferSizeLimit is not None:
obj["processBufferSizeLimit"] = processBufferSizeLimit
- if traceBufferSize is not None:
- obj["traceBufferSize"] = traceBufferSize
+ if iptTraceSize is not None:
+ obj["iptTraceSize"] = iptTraceSize
if psbPeriod is not None:
obj["psbPeriod"] = psbPeriod
obj["enableTsc"] = enableTsc
- obj["perCoreTracing"] = perCoreTracing
+ obj["perCpuTracing"] = perCpuTracing
configuration = lldb.SBStructuredData()
configuration.SetFromJSON(json.dumps(obj))
return configuration
def traceStartThread(self, thread=None, error=False, substrs=None,
- traceBufferSize=None, enableTsc=False, psbPeriod=None):
+ iptTraceSize=None, enableTsc=False, psbPeriod=None):
if self.USE_SB_API:
trace = self.getTraceOrCreate()
thread = thread if thread is not None else self.thread()
configuration = self.createConfiguration(
- traceBufferSize=traceBufferSize, enableTsc=enableTsc,
+ iptTraceSize=iptTraceSize, enableTsc=enableTsc,
psbPeriod=psbPeriod)
self.assertSBError(trace.Start(thread, configuration), error)
else:
command = "thread trace start"
if thread is not None:
command += " " + str(thread.GetIndexID())
- if traceBufferSize is not None:
- command += " -s " + str(traceBufferSize)
+ if iptTraceSize is not None:
+ command += " -s " + str(iptTraceSize)
if enableTsc:
command += " --tsc"
if psbPeriod is not None:
@@ -98,12 +98,12 @@ def traceStartThread(self, thread=None, error=False, substrs=None,
def traceStartProcess(self, processBufferSizeLimit=None, error=False,
substrs=None, enableTsc=False, psbPeriod=None,
- perCoreTracing=False):
+ perCpuTracing=False):
if self.USE_SB_API:
trace = self.getTraceOrCreate()
configuration = self.createConfiguration(
processBufferSizeLimit=processBufferSizeLimit, enableTsc=enableTsc,
- psbPeriod=psbPeriod, perCoreTracing=perCoreTracing)
+ psbPeriod=psbPeriod, perCpuTracing=perCpuTracing)
self.assertSBError(trace.Start(configuration), error=error)
else:
command = "process trace start"
@@ -113,8 +113,8 @@ def traceStartProcess(self, processBufferSizeLimit=None, error=False,
command += " --tsc"
if psbPeriod is not None:
command += " --psb-period " + str(psbPeriod)
- if perCoreTracing:
- command += " --per-core-tracing"
+ if perCpuTracing:
+ command += " --per-cpu-tracing"
self.expect(command, error=error, substrs=substrs)
def traceStopProcess(self):
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
index 7118e6f70d3a2..f7990f2d394fc 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
@@ -72,7 +72,7 @@ Error IntelPTCollector::TraceStart(const TraceIntelPTStartRequest &request) {
inconvertibleErrorCode(),
"Process currently traced. Stop process tracing first");
}
- if (request.IsPerCoreTracing()) {
+ if (request.IsPerCpuTracing()) {
if (m_thread_traces.GetTracedThreadsCount() > 0)
return createStringError(
inconvertibleErrorCode(),
@@ -170,9 +170,9 @@ Expected<json::Value> IntelPTCollector::GetState() {
m_thread_traces.ForEachThread(
[&](lldb::tid_t tid, const IntelPTSingleBufferTrace &thread_trace) {
- state.traced_threads.push_back({tid,
- {{IntelPTDataKinds::kTraceBuffer,
- thread_trace.GetTraceBufferSize()}}});
+ state.traced_threads.push_back(
+ {tid,
+ {{IntelPTDataKinds::kIptTrace, thread_trace.GetIptTraceSize()}}});
});
if (Expected<LinuxPerfZeroTscConversion &> tsc_conversion =
@@ -208,9 +208,9 @@ IntelPTCollector::GetBinaryData(const TraceGetBinaryDataRequest &request) {
return createStringError(
inconvertibleErrorCode(),
- formatv("Can't fetch data kind {0} for core_id {1}, tid {2} and "
+ formatv("Can't fetch data kind {0} for cpu_id {1}, tid {2} and "
"\"process tracing\" mode {3}",
- request.kind, request.core_id, request.tid,
+ request.kind, request.cpu_id, request.tid,
m_process_trace_up ? "enabled" : "not enabled"));
}
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
index 537f8fb575a5b..1a30d5c71a0b9 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
@@ -17,9 +17,9 @@ using namespace lldb_private;
using namespace process_linux;
using namespace llvm;
-static bool IsTotalBufferLimitReached(ArrayRef<core_id_t> cores,
+static bool IsTotalBufferLimitReached(ArrayRef<cpu_id_t> cores,
const TraceIntelPTStartRequest &request) {
- uint64_t required = cores.size() * request.trace_buffer_size;
+ uint64_t required = cores.size() * request.ipt_trace_size;
uint64_t limit = request.process_buffer_size_limit.getValueOr(
std::numeric_limits<uint64_t>::max());
return required > limit;
@@ -36,30 +36,30 @@ static Error IncludePerfEventParanoidMessageInError(Error &&error) {
Expected<std::unique_ptr<IntelPTMultiCoreTrace>>
IntelPTMultiCoreTrace::StartOnAllCores(const TraceIntelPTStartRequest &request,
NativeProcessProtocol &process) {
- Expected<ArrayRef<core_id_t>> core_ids = GetAvailableLogicalCoreIDs();
- if (!core_ids)
- return core_ids.takeError();
+ Expected<ArrayRef<cpu_id_t>> cpu_ids = GetAvailableLogicalCoreIDs();
+ if (!cpu_ids)
+ return cpu_ids.takeError();
- if (IsTotalBufferLimitReached(*core_ids, request))
+ if (IsTotalBufferLimitReached(*cpu_ids, request))
return createStringError(
inconvertibleErrorCode(),
"The process can't be traced because the process trace size limit "
"has been reached. Consider retracing with a higher limit.");
- DenseMap<core_id_t, std::pair<IntelPTSingleBufferTrace, ContextSwitchTrace>>
+ DenseMap<cpu_id_t, std::pair<IntelPTSingleBufferTrace, ContextSwitchTrace>>
traces;
- for (core_id_t core_id : *core_ids) {
+ for (cpu_id_t cpu_id : *cpu_ids) {
Expected<IntelPTSingleBufferTrace> core_trace =
- IntelPTSingleBufferTrace::Start(request, /*tid=*/None, core_id,
+ IntelPTSingleBufferTrace::Start(request, /*tid=*/None, cpu_id,
/*disabled=*/true);
if (!core_trace)
return IncludePerfEventParanoidMessageInError(core_trace.takeError());
if (Expected<PerfEvent> context_switch_trace =
- CreateContextSwitchTracePerfEvent(core_id,
+ CreateContextSwitchTracePerfEvent(cpu_id,
&core_trace->GetPerfEvent())) {
- traces.try_emplace(core_id,
+ traces.try_emplace(cpu_id,
std::make_pair(std::move(*core_trace),
std::move(*context_switch_trace)));
} else {
@@ -72,15 +72,14 @@ IntelPTMultiCoreTrace::StartOnAllCores(const TraceIntelPTStartRequest &request,
}
void IntelPTMultiCoreTrace::ForEachCore(
- std::function<void(core_id_t core_id, IntelPTSingleBufferTrace &core_trace)>
+ std::function<void(cpu_id_t cpu_id, IntelPTSingleBufferTrace &core_trace)>
callback) {
for (auto &it : m_traces_per_core)
callback(it.first, it.second.first);
}
void IntelPTMultiCoreTrace::ForEachCore(
- std::function<void(core_id_t core_id,
- IntelPTSingleBufferTrace &intelpt_trace,
+ std::function<void(cpu_id_t cpu_id, IntelPTSingleBufferTrace &intelpt_trace,
ContextSwitchTrace &context_switch_trace)>
callback) {
for (auto &it : m_traces_per_core)
@@ -88,19 +87,19 @@ void IntelPTMultiCoreTrace::ForEachCore(
}
void IntelPTMultiCoreTrace::ProcessDidStop() {
- ForEachCore([](core_id_t core_id, IntelPTSingleBufferTrace &core_trace) {
+ ForEachCore([](cpu_id_t cpu_id, IntelPTSingleBufferTrace &core_trace) {
if (Error err = core_trace.Pause()) {
LLDB_LOG_ERROR(GetLog(POSIXLog::Trace), std::move(err),
- "Unable to pause the core trace for core {0}", core_id);
+ "Unable to pause the core trace for core {0}", cpu_id);
}
});
}
void IntelPTMultiCoreTrace::ProcessWillResume() {
- ForEachCore([](core_id_t core_id, IntelPTSingleBufferTrace &core_trace) {
+ ForEachCore([](cpu_id_t cpu_id, IntelPTSingleBufferTrace &core_trace) {
if (Error err = core_trace.Resume()) {
LLDB_LOG_ERROR(GetLog(POSIXLog::Trace), std::move(err),
- "Unable to resume the core trace for core {0}", core_id);
+ "Unable to resume the core trace for core {0}", cpu_id);
}
});
}
@@ -112,13 +111,13 @@ TraceIntelPTGetStateResponse IntelPTMultiCoreTrace::GetState() {
state.traced_threads.push_back(
TraceThreadState{m_process.GetThreadAtIndex(i)->GetID(), {}});
- state.cores.emplace();
- ForEachCore([&](lldb::core_id_t core_id,
+ state.cpus.emplace();
+ ForEachCore([&](lldb::cpu_id_t cpu_id,
const IntelPTSingleBufferTrace &core_trace,
const ContextSwitchTrace &context_switch_trace) {
- state.cores->push_back(
- {core_id,
- {{IntelPTDataKinds::kTraceBuffer, core_trace.GetTraceBufferSize()},
+ state.cpus->push_back(
+ {cpu_id,
+ {{IntelPTDataKinds::kIptTrace, core_trace.GetIptTraceSize()},
{IntelPTDataKinds::kPerfContextSwitchTrace,
context_switch_trace.GetEffectiveDataBufferSize()}}});
});
@@ -149,16 +148,16 @@ Error IntelPTMultiCoreTrace::TraceStop(lldb::tid_t tid) {
Expected<Optional<std::vector<uint8_t>>>
IntelPTMultiCoreTrace::TryGetBinaryData(
const TraceGetBinaryDataRequest &request) {
- if (!request.core_id)
+ if (!request.cpu_id)
return None;
- auto it = m_traces_per_core.find(*request.core_id);
+ auto it = m_traces_per_core.find(*request.cpu_id);
if (it == m_traces_per_core.end())
return createStringError(
inconvertibleErrorCode(),
- formatv("Core {0} is not being traced", *request.core_id));
+ formatv("Core {0} is not being traced", *request.cpu_id));
- if (request.kind == IntelPTDataKinds::kTraceBuffer)
- return it->second.first.GetTraceBuffer();
+ if (request.kind == IntelPTDataKinds::kIptTrace)
+ return it->second.first.GetIptTrace();
if (request.kind == IntelPTDataKinds::kPerfContextSwitchTrace)
return it->second.second.GetReadOnlyDataBuffer();
return None;
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
index 95a6da69ea8da..8afebf372c50a 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
+++ b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
@@ -44,18 +44,18 @@ class IntelPTMultiCoreTrace : public IntelPTProcessTrace {
/// Execute the provided callback on each core that is being traced.
///
- /// \param[in] callback.core_id
+ /// \param[in] callback.cpu_id
/// The core id that is being traced.
///
/// \param[in] callback.core_trace
/// The single-buffer trace instance for the given core.
- void ForEachCore(std::function<void(lldb::core_id_t core_id,
+ void ForEachCore(std::function<void(lldb::cpu_id_t cpu_id,
IntelPTSingleBufferTrace &core_trace)>
callback);
/// Execute the provided callback on each core that is being traced.
///
- /// \param[in] callback.core_id
+ /// \param[in] callback.cpu_id
/// The core id that is being traced.
///
/// \param[in] callback.intelpt_trace
@@ -63,7 +63,7 @@ class IntelPTMultiCoreTrace : public IntelPTProcessTrace {
///
/// \param[in] callback.context_switch_trace
/// The perf event collecting context switches for the given core.
- void ForEachCore(std::function<void(lldb::core_id_t core_id,
+ void ForEachCore(std::function<void(lldb::cpu_id_t cpu_id,
IntelPTSingleBufferTrace &intelpt_trace,
ContextSwitchTrace &context_switch_trace)>
callback);
@@ -87,13 +87,13 @@ class IntelPTMultiCoreTrace : public IntelPTProcessTrace {
/// This assumes that all underlying perf_events for each core are part of the
/// same perf event group.
IntelPTMultiCoreTrace(
- llvm::DenseMap<lldb::core_id_t,
+ llvm::DenseMap<lldb::cpu_id_t,
std::pair<IntelPTSingleBufferTrace, ContextSwitchTrace>>
&&traces_per_core,
NativeProcessProtocol &process)
: m_traces_per_core(std::move(traces_per_core)), m_process(process) {}
- llvm::DenseMap<lldb::core_id_t,
+ llvm::DenseMap<lldb::cpu_id_t,
std::pair<IntelPTSingleBufferTrace, ContextSwitchTrace>>
m_traces_per_core;
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
index cfda1b42d183a..7183b213e340f 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
@@ -22,8 +22,7 @@ Error IntelPTPerThreadProcessTrace::TraceStop(lldb::tid_t tid) {
}
Error IntelPTPerThreadProcessTrace::TraceStart(lldb::tid_t tid) {
- if (m_thread_traces.GetTotalBufferSize() +
- m_tracing_params.trace_buffer_size >
+ if (m_thread_traces.GetTotalBufferSize() + m_tracing_params.ipt_trace_size >
static_cast<size_t>(*m_tracing_params.process_buffer_size_limit))
return createStringError(
inconvertibleErrorCode(),
@@ -39,9 +38,9 @@ TraceIntelPTGetStateResponse IntelPTPerThreadProcessTrace::GetState() {
TraceIntelPTGetStateResponse state;
m_thread_traces.ForEachThread(
[&](lldb::tid_t tid, const IntelPTSingleBufferTrace &thread_trace) {
- state.traced_threads.push_back({tid,
- {{IntelPTDataKinds::kTraceBuffer,
- thread_trace.GetTraceBufferSize()}}});
+ state.traced_threads.push_back(
+ {tid,
+ {{IntelPTDataKinds::kIptTrace, thread_trace.GetIptTraceSize()}}});
});
return state;
}
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
index d9d88ac6b747c..bd8611d4d4776 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
@@ -201,7 +201,7 @@ CreateIntelPTPerfEventConfiguration(bool enable_tsc,
}
#endif
-size_t IntelPTSingleBufferTrace::GetTraceBufferSize() const {
+size_t IntelPTSingleBufferTrace::GetIptTraceSize() const {
return m_perf_event.GetAuxBuffer().size();
}
@@ -213,7 +213,7 @@ Error IntelPTSingleBufferTrace::Resume() {
return m_perf_event.EnableWithIoctl();
}
-Expected<std::vector<uint8_t>> IntelPTSingleBufferTrace::GetTraceBuffer() {
+Expected<std::vector<uint8_t>> IntelPTSingleBufferTrace::GetIptTrace() {
// Disable the perf event to force a flush out of the CPU's internal buffer.
// Besides, we can guarantee that the CPU won't override any data as we are
// reading the buffer.
@@ -234,27 +234,26 @@ Expected<std::vector<uint8_t>> IntelPTSingleBufferTrace::GetTraceBuffer() {
Expected<IntelPTSingleBufferTrace>
IntelPTSingleBufferTrace::Start(const TraceIntelPTStartRequest &request,
Optional<lldb::tid_t> tid,
- Optional<core_id_t> core_id, bool disabled) {
+ Optional<cpu_id_t> cpu_id, bool disabled) {
#ifndef PERF_ATTR_SIZE_VER5
return createStringError(inconvertibleErrorCode(),
"Intel PT Linux perf event not supported");
#else
Log *log = GetLog(POSIXLog::Trace);
- LLDB_LOG(log, "Will start tracing thread id {0} and cpu id {1}", tid,
- core_id);
+ LLDB_LOG(log, "Will start tracing thread id {0} and cpu id {1}", tid, cpu_id);
- if (__builtin_popcount(request.trace_buffer_size) != 1 ||
- request.trace_buffer_size < 4096) {
+ if (__builtin_popcount(request.ipt_trace_size) != 1 ||
+ request.ipt_trace_size < 4096) {
return createStringError(
inconvertibleErrorCode(),
- "The trace buffer size must be a power of 2 greater than or equal to "
+ "The intel pt trace size must be a power of 2 greater than or equal to "
"4096 (2^12) bytes. It was %" PRIu64 ".",
- request.trace_buffer_size);
+ request.ipt_trace_size);
}
uint64_t page_size = getpagesize();
uint64_t aux_buffer_numpages = static_cast<uint64_t>(llvm::PowerOf2Floor(
- (request.trace_buffer_size + page_size - 1) / page_size));
+ (request.ipt_trace_size + page_size - 1) / page_size));
Expected<perf_event_attr> attr = CreateIntelPTPerfEventConfiguration(
request.enable_tsc, request.psb_period.map([](int value) {
@@ -264,10 +263,10 @@ IntelPTSingleBufferTrace::Start(const TraceIntelPTStartRequest &request,
return attr.takeError();
attr->disabled = disabled;
- LLDB_LOG(log, "Will create trace buffer of size {0}",
- request.trace_buffer_size);
+ LLDB_LOG(log, "Will create intel pt trace buffer of size {0}",
+ request.ipt_trace_size);
- if (Expected<PerfEvent> perf_event = PerfEvent::Init(*attr, tid, core_id)) {
+ if (Expected<PerfEvent> perf_event = PerfEvent::Init(*attr, tid, cpu_id)) {
if (Error mmap_err = perf_event->MmapMetadataAndBuffers(
/*num_data_pages=*/0, aux_buffer_numpages,
/*data_buffer_write=*/true)) {
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
index 76952376035b3..558af429e412d 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
+++ b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
@@ -36,7 +36,7 @@ class IntelPTSingleBufferTrace {
/// The tid of the thread to be traced. If \b None, then this traces all
/// threads of all processes.
///
- /// \param[in] core_id
+ /// \param[in] cpu_id
/// The CPU core id where to trace. If \b None, then this traces all CPUs.
///
/// \param[in] disabled
@@ -50,7 +50,7 @@ class IntelPTSingleBufferTrace {
static llvm::Expected<IntelPTSingleBufferTrace>
Start(const TraceIntelPTStartRequest &request,
llvm::Optional<lldb::tid_t> tid,
- llvm::Optional<lldb::core_id_t> core_id = llvm::None,
+ llvm::Optional<lldb::cpu_id_t> cpu_id = llvm::None,
bool disabled = false);
/// \return
@@ -59,19 +59,19 @@ class IntelPTSingleBufferTrace {
llvm::Expected<std::vector<uint8_t>>
GetBinaryData(const TraceGetBinaryDataRequest &request) const;
- /// Read the trace buffer managed by this trace instance. To ensure that the
- /// data is up-to-date and is not corrupted by read-write race conditions, the
- /// underlying perf_event is paused during read, and later it's returned to
- /// its initial state.
+ /// Read the intel pt trace buffer managed by this trace instance. To ensure
+ /// that the data is up-to-date and is not corrupted by read-write race
+ /// conditions, the underlying perf_event is paused during read, and later
+ /// it's returned to its initial state.
///
/// \return
/// A vector with the requested binary data.
- llvm::Expected<std::vector<uint8_t>> GetTraceBuffer();
+ llvm::Expected<std::vector<uint8_t>> GetIptTrace();
/// \return
- /// The total the size in bytes used by the trace buffer managed by this
- /// trace instance.
- size_t GetTraceBufferSize() const;
+ /// The total the size in bytes used by the intel pt trace buffer managed
+ /// by this trace instance.
+ size_t GetIptTraceSize() const;
/// Resume the collection of this trace.
///
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp b/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
index 182f822cd8995..f2c86e347e8ff 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
@@ -22,7 +22,7 @@ Error IntelPTThreadTraceCollection::TraceStop(lldb::tid_t tid) {
if (it == m_thread_traces.end())
return createStringError(inconvertibleErrorCode(),
"Thread %" PRIu64 " not currently traced", tid);
- m_total_buffer_size -= it->second.GetTraceBufferSize();
+ m_total_buffer_size -= it->second.GetIptTraceSize();
m_thread_traces.erase(tid);
return Error::success();
}
@@ -38,7 +38,7 @@ Error IntelPTThreadTraceCollection::TraceStart(
if (!trace)
return trace.takeError();
- m_total_buffer_size += trace->GetTraceBufferSize();
+ m_total_buffer_size += trace->GetIptTraceSize();
m_thread_traces.try_emplace(tid, std::move(*trace));
return Error::success();
}
@@ -77,7 +77,7 @@ IntelPTThreadTraceCollection::TryGetBinaryData(
const TraceGetBinaryDataRequest &request) {
if (!request.tid)
return None;
- if (request.kind != IntelPTDataKinds::kTraceBuffer)
+ if (request.kind != IntelPTDataKinds::kIptTrace)
return None;
if (!TracesThread(*request.tid))
@@ -85,7 +85,7 @@ IntelPTThreadTraceCollection::TryGetBinaryData(
if (Expected<IntelPTSingleBufferTrace &> trace =
GetTracedThread(*request.tid))
- return trace->GetTraceBuffer();
+ return trace->GetIptTrace();
else
return trace.takeError();
}
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h b/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h
index 8a6b5a26352ac..25bfbbe37592b 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h
+++ b/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h
@@ -27,7 +27,8 @@ class IntelPTThreadTraceCollection {
bool TracesThread(lldb::tid_t tid) const;
/// \return
- /// The total sum of the trace buffer sizes used by this collection.
+ /// The total sum of the intel pt trace buffer sizes used by this
+ /// collection.
size_t GetTotalBufferSize() const;
/// Execute the provided callback on each thread that is being traced.
diff --git a/lldb/source/Plugins/Process/Linux/Perf.cpp b/lldb/source/Plugins/Process/Linux/Perf.cpp
index f51e1cadd0c89..b6e24f921f31f 100644
--- a/lldb/source/Plugins/Process/Linux/Perf.cpp
+++ b/lldb/source/Plugins/Process/Linux/Perf.cpp
@@ -73,7 +73,7 @@ void resource_handle::FileDescriptorDeleter::operator()(long *ptr) {
llvm::Expected<PerfEvent> PerfEvent::Init(perf_event_attr &attr,
Optional<lldb::pid_t> pid,
- Optional<lldb::core_id_t> cpu,
+ Optional<lldb::cpu_id_t> cpu,
Optional<long> group_fd,
unsigned long flags) {
errno = 0;
@@ -89,7 +89,7 @@ llvm::Expected<PerfEvent> PerfEvent::Init(perf_event_attr &attr,
llvm::Expected<PerfEvent> PerfEvent::Init(perf_event_attr &attr,
Optional<lldb::pid_t> pid,
- Optional<lldb::core_id_t> cpu) {
+ Optional<lldb::cpu_id_t> cpu) {
return Init(attr, pid, cpu, -1, 0);
}
@@ -306,7 +306,7 @@ size_t PerfEvent::GetEffectiveDataBufferSize() const {
Expected<PerfEvent>
lldb_private::process_linux::CreateContextSwitchTracePerfEvent(
- lldb::core_id_t core_id, const PerfEvent *parent_perf_event) {
+ lldb::cpu_id_t cpu_id, const PerfEvent *parent_perf_event) {
Log *log = GetLog(POSIXLog::Trace);
#ifndef PERF_ATTR_SIZE_VER5
return createStringError(inconvertibleErrorCode(),
@@ -342,7 +342,7 @@ lldb_private::process_linux::CreateContextSwitchTracePerfEvent(
group_fd = parent_perf_event->GetFd();
if (Expected<PerfEvent> perf_event =
- PerfEvent::Init(attr, /*pid=*/None, core_id, group_fd, /*flags=*/0)) {
+ PerfEvent::Init(attr, /*pid=*/None, cpu_id, group_fd, /*flags=*/0)) {
if (Error mmap_err = perf_event->MmapMetadataAndBuffers(
data_buffer_numpages, 0, /*data_buffer_write=*/false)) {
return std::move(mmap_err);
diff --git a/lldb/source/Plugins/Process/Linux/Perf.h b/lldb/source/Plugins/Process/Linux/Perf.h
index b5f968e72b2a1..5887b0a2a0a45 100644
--- a/lldb/source/Plugins/Process/Linux/Perf.h
+++ b/lldb/source/Plugins/Process/Linux/Perf.h
@@ -110,7 +110,7 @@ class PerfEvent {
/// instance, or an \a llvm::Error otherwise.
static llvm::Expected<PerfEvent> Init(perf_event_attr &attr,
llvm::Optional<lldb::pid_t> pid,
- llvm::Optional<lldb::core_id_t> cpu,
+ llvm::Optional<lldb::cpu_id_t> cpu,
llvm::Optional<long> group_fd,
unsigned long flags);
@@ -128,7 +128,7 @@ class PerfEvent {
/// all threads and processes are monitored.
static llvm::Expected<PerfEvent>
Init(perf_event_attr &attr, llvm::Optional<lldb::pid_t> pid,
- llvm::Optional<lldb::core_id_t> core = llvm::None);
+ llvm::Optional<lldb::cpu_id_t> core = llvm::None);
/// Mmap the metadata page and the data and aux buffers of the perf event and
/// expose them through \a PerfEvent::GetMetadataPage() , \a
@@ -309,14 +309,14 @@ class PerfEvent {
/// Create a perf event that tracks context switches on a cpu.
///
-/// \param[in] core_id
+/// \param[in] cpu_id
/// The core to trace.
///
/// \param[in] parent_perf_event
/// An optional perf event that will be grouped with the
/// new perf event.
llvm::Expected<PerfEvent>
-CreateContextSwitchTracePerfEvent(lldb::core_id_t core_id,
+CreateContextSwitchTracePerfEvent(lldb::cpu_id_t cpu_id,
const PerfEvent *parent_perf_event = nullptr);
/// Load \a PerfTscConversionParameters from \a perf_event_mmap_page, if
diff --git a/lldb/source/Plugins/Process/Linux/Procfs.cpp b/lldb/source/Plugins/Process/Linux/Procfs.cpp
index bca0f1070f839..7c0c55a4f208d 100644
--- a/lldb/source/Plugins/Process/Linux/Procfs.cpp
+++ b/lldb/source/Plugins/Process/Linux/Procfs.cpp
@@ -30,18 +30,18 @@ Expected<ArrayRef<uint8_t>> lldb_private::process_linux::GetProcfsCpuInfo() {
return *cpu_info;
}
-Expected<std::vector<core_id_t>>
+Expected<std::vector<cpu_id_t>>
lldb_private::process_linux::GetAvailableLogicalCoreIDs(StringRef cpuinfo) {
SmallVector<StringRef, 8> lines;
cpuinfo.split(lines, "\n", /*MaxSplit=*/-1, /*KeepEmpty=*/false);
- std::vector<core_id_t> logical_cores;
+ std::vector<cpu_id_t> logical_cores;
for (StringRef line : lines) {
std::pair<StringRef, StringRef> key_value = line.split(':');
auto key = key_value.first.trim();
auto val = key_value.second.trim();
if (key == "processor") {
- core_id_t processor;
+ cpu_id_t processor;
if (val.getAsInteger(10, processor))
return createStringError(
inconvertibleErrorCode(),
@@ -52,21 +52,21 @@ lldb_private::process_linux::GetAvailableLogicalCoreIDs(StringRef cpuinfo) {
return logical_cores;
}
-llvm::Expected<llvm::ArrayRef<core_id_t>>
+llvm::Expected<llvm::ArrayRef<cpu_id_t>>
lldb_private::process_linux::GetAvailableLogicalCoreIDs() {
- static Optional<std::vector<core_id_t>> logical_cores_ids;
+ static Optional<std::vector<cpu_id_t>> logical_cores_ids;
if (!logical_cores_ids) {
// We find the actual list of core ids by parsing /proc/cpuinfo
Expected<ArrayRef<uint8_t>> cpuinfo = GetProcfsCpuInfo();
if (!cpuinfo)
return cpuinfo.takeError();
- Expected<std::vector<core_id_t>> core_ids = GetAvailableLogicalCoreIDs(
+ Expected<std::vector<cpu_id_t>> cpu_ids = GetAvailableLogicalCoreIDs(
StringRef(reinterpret_cast<const char *>(cpuinfo->data())));
- if (!core_ids)
- return core_ids.takeError();
+ if (!cpu_ids)
+ return cpu_ids.takeError();
- logical_cores_ids.emplace(std::move(*core_ids));
+ logical_cores_ids.emplace(std::move(*cpu_ids));
}
return *logical_cores_ids;
}
diff --git a/lldb/source/Plugins/Process/Linux/Procfs.h b/lldb/source/Plugins/Process/Linux/Procfs.h
index ee45b25a5529e..3a068432074b7 100644
--- a/lldb/source/Plugins/Process/Linux/Procfs.h
+++ b/lldb/source/Plugins/Process/Linux/Procfs.h
@@ -45,13 +45,13 @@ llvm::Expected<llvm::ArrayRef<uint8_t>> GetProcfsCpuInfo();
/// \return
/// A list of available logical core ids given the contents of
/// /proc/cpuinfo.
-llvm::Expected<std::vector<lldb::core_id_t>>
+llvm::Expected<std::vector<lldb::cpu_id_t>>
GetAvailableLogicalCoreIDs(llvm::StringRef cpuinfo);
/// \return
/// A list with all the logical cores available in the system and cache it
/// if errors didn't happen.
-llvm::Expected<llvm::ArrayRef<lldb::core_id_t>> GetAvailableLogicalCoreIDs();
+llvm::Expected<llvm::ArrayRef<lldb::cpu_id_t>> GetAvailableLogicalCoreIDs();
} // namespace process_linux
} // namespace lldb_private
diff --git a/lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt b/lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
index 4d55521648bc8..077fb44ae8a27 100644
--- a/lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
+++ b/lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
@@ -23,7 +23,7 @@ add_lldb_library(lldbPluginTraceIntelPT PLUGIN
TraceCursorIntelPT.cpp
TraceIntelPT.cpp
TraceIntelPTJSONStructs.cpp
- TraceIntelPTMultiCoreDecoder.cpp
+ TraceIntelPTMultiCpuDecoder.cpp
TraceIntelPTSessionFileParser.cpp
TraceIntelPTSessionSaver.cpp
diff --git a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
index bd3017f8f09be..6c386f6a83fac 100644
--- a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
@@ -32,13 +32,13 @@ Status CommandObjectThreadTraceStartIntelPT::CommandOptions::SetOptionValue(
switch (short_option) {
case 's': {
- int64_t trace_buffer_size;
- if (option_arg.empty() || option_arg.getAsInteger(0, trace_buffer_size) ||
- trace_buffer_size < 0)
+ int64_t ipt_trace_size;
+ if (option_arg.empty() || option_arg.getAsInteger(0, ipt_trace_size) ||
+ ipt_trace_size < 0)
error.SetErrorStringWithFormat("invalid integer value for option '%s'",
option_arg.str().c_str());
else
- m_trace_buffer_size = trace_buffer_size;
+ m_ipt_trace_size = ipt_trace_size;
break;
}
case 't': {
@@ -63,7 +63,7 @@ Status CommandObjectThreadTraceStartIntelPT::CommandOptions::SetOptionValue(
void CommandObjectThreadTraceStartIntelPT::CommandOptions::
OptionParsingStarting(ExecutionContext *execution_context) {
- m_trace_buffer_size = kDefaultTraceBufferSize;
+ m_ipt_trace_size = kDefaultIptTraceSize;
m_enable_tsc = kDefaultEnableTscValue;
m_psb_period = kDefaultPsbPeriod;
}
@@ -76,7 +76,7 @@ CommandObjectThreadTraceStartIntelPT::CommandOptions::GetDefinitions() {
bool CommandObjectThreadTraceStartIntelPT::DoExecuteOnThreads(
Args &command, CommandReturnObject &result,
llvm::ArrayRef<lldb::tid_t> tids) {
- if (Error err = m_trace.Start(tids, m_options.m_trace_buffer_size,
+ if (Error err = m_trace.Start(tids, m_options.m_ipt_trace_size,
m_options.m_enable_tsc, m_options.m_psb_period))
result.SetError(Status(std::move(err)));
else
@@ -98,13 +98,13 @@ Status CommandObjectProcessTraceStartIntelPT::CommandOptions::SetOptionValue(
switch (short_option) {
case 's': {
- int64_t trace_buffer_size;
- if (option_arg.empty() || option_arg.getAsInteger(0, trace_buffer_size) ||
- trace_buffer_size < 0)
+ int64_t ipt_trace_size;
+ if (option_arg.empty() || option_arg.getAsInteger(0, ipt_trace_size) ||
+ ipt_trace_size < 0)
error.SetErrorStringWithFormat("invalid integer value for option '%s'",
option_arg.str().c_str());
else
- m_trace_buffer_size = trace_buffer_size;
+ m_ipt_trace_size = ipt_trace_size;
break;
}
case 'l': {
@@ -123,7 +123,7 @@ Status CommandObjectProcessTraceStartIntelPT::CommandOptions::SetOptionValue(
break;
}
case 'c': {
- m_per_core_tracing = true;
+ m_per_cpu_tracing = true;
break;
}
case 'p': {
@@ -144,11 +144,11 @@ Status CommandObjectProcessTraceStartIntelPT::CommandOptions::SetOptionValue(
void CommandObjectProcessTraceStartIntelPT::CommandOptions::
OptionParsingStarting(ExecutionContext *execution_context) {
- m_trace_buffer_size = kDefaultTraceBufferSize;
+ m_ipt_trace_size = kDefaultIptTraceSize;
m_process_buffer_size_limit = kDefaultProcessBufferSizeLimit;
m_enable_tsc = kDefaultEnableTscValue;
m_psb_period = kDefaultPsbPeriod;
- m_per_core_tracing = kDefaultPerCoreTracing;
+ m_per_cpu_tracing = kDefaultPerCpuTracing;
}
llvm::ArrayRef<OptionDefinition>
@@ -158,10 +158,10 @@ CommandObjectProcessTraceStartIntelPT::CommandOptions::GetDefinitions() {
bool CommandObjectProcessTraceStartIntelPT::DoExecute(
Args &command, CommandReturnObject &result) {
- if (Error err = m_trace.Start(m_options.m_trace_buffer_size,
+ if (Error err = m_trace.Start(m_options.m_ipt_trace_size,
m_options.m_process_buffer_size_limit,
m_options.m_enable_tsc, m_options.m_psb_period,
- m_options.m_per_core_tracing))
+ m_options.m_per_cpu_tracing))
result.SetError(Status(std::move(err)));
else
result.SetStatus(eReturnStatusSuccessFinishResult);
diff --git a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
index e38521040879a..b5d6a0f240436 100644
--- a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
+++ b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
@@ -31,7 +31,7 @@ class CommandObjectThreadTraceStartIntelPT
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- uint64_t m_trace_buffer_size;
+ uint64_t m_ipt_trace_size;
bool m_enable_tsc;
llvm::Optional<uint64_t> m_psb_period;
};
@@ -74,11 +74,11 @@ class CommandObjectProcessTraceStartIntelPT : public CommandObjectParsed {
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- uint64_t m_trace_buffer_size;
+ uint64_t m_ipt_trace_size;
uint64_t m_process_buffer_size_limit;
bool m_enable_tsc;
llvm::Optional<uint64_t> m_psb_period;
- bool m_per_core_tracing;
+ bool m_per_cpu_tracing;
};
CommandObjectProcessTraceStartIntelPT(TraceIntelPT &trace,
@@ -86,11 +86,11 @@ class CommandObjectProcessTraceStartIntelPT : public CommandObjectParsed {
: CommandObjectParsed(
interpreter, "process trace start",
"Start tracing this process with intel-pt, including future "
- "threads. If --per-core-tracing is not provided, this traces each "
+ "threads. If --per-cpu-tracing is not provided, this traces each "
"thread independently, thus using a trace buffer per thread. "
"Threads traced with the \"thread trace start\" command are left "
"unaffected ant not retraced. This is the recommended option "
- "unless the number of threads is huge. If --per-core-tracing is "
+ "unless the number of threads is huge. If --per-cpu-tracing is "
"passed, each cpu core is traced instead of each thread, which "
"uses a fixed number of trace buffers, but might result in less "
"data available for less frequent threads.",
diff --git a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
index d4d2a12fe537d..c17ef00da2a98 100644
--- a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
@@ -326,12 +326,12 @@ void lldb_private::trace_intel_pt::DecodeSingleTraceForThread(DecodedThread &dec
void lldb_private::trace_intel_pt::DecodeSystemWideTraceForThread(
DecodedThread &decoded_thread, TraceIntelPT &trace_intel_pt,
- const DenseMap<lldb::core_id_t, llvm::ArrayRef<uint8_t>> &buffers,
+ const DenseMap<lldb::cpu_id_t, llvm::ArrayRef<uint8_t>> &buffers,
const std::vector<IntelPTThreadContinousExecution> &executions) {
- DenseMap<lldb::core_id_t, LibiptDecoder> decoders;
- for (auto &core_id_buffer : buffers) {
+ DenseMap<lldb::cpu_id_t, LibiptDecoder> decoders;
+ for (auto &cpu_id_buffer : buffers) {
Expected<PtInsnDecoderUP> decoder_up =
- CreateInstructionDecoder(trace_intel_pt, core_id_buffer.second);
+ CreateInstructionDecoder(trace_intel_pt, cpu_id_buffer.second);
if (!decoder_up)
return decoded_thread.SetAsFailed(decoder_up.takeError());
@@ -339,7 +339,7 @@ void lldb_private::trace_intel_pt::DecodeSystemWideTraceForThread(
*decoded_thread.GetThread()->GetProcess()))
return decoded_thread.SetAsFailed(std::move(err));
- decoders.try_emplace(core_id_buffer.first,
+ decoders.try_emplace(cpu_id_buffer.first,
LibiptDecoder(*decoder_up->release(), decoded_thread));
}
@@ -354,9 +354,9 @@ void lldb_private::trace_intel_pt::DecodeSystemWideTraceForThread(
decoded_thread.AppendError(createStringError(
inconvertibleErrorCode(),
formatv("Unable to find intel pt data for thread execution with "
- "tsc = {0} on core id = {1}",
+ "tsc = {0} on cpu id = {1}",
execution.thread_execution.GetLowestKnownTSC(),
- execution.thread_execution.core_id)));
+ execution.thread_execution.cpu_id)));
}
// If the first execution is incomplete because it doesn't have a previous
@@ -365,15 +365,15 @@ void lldb_private::trace_intel_pt::DecodeSystemWideTraceForThread(
variant == ThreadContinuousExecution::Variant::HintedStart) {
decoded_thread.AppendError(createStringError(
inconvertibleErrorCode(),
- formatv("Thread execution starting at tsc = {0} on core id = {1} "
+ formatv("Thread execution starting at tsc = {0} on cpu id = {1} "
"doesn't have a matching context switch in.",
execution.thread_execution.GetLowestKnownTSC(),
- execution.thread_execution.core_id)));
+ execution.thread_execution.cpu_id)));
}
}
LibiptDecoder &decoder =
- decoders.find(execution.thread_execution.core_id)->second;
+ decoders.find(execution.thread_execution.cpu_id)->second;
for (const IntelPTThreadSubtrace &intel_pt_execution :
execution.intelpt_subtraces) {
has_seen_psbs = true;
@@ -389,10 +389,10 @@ void lldb_private::trace_intel_pt::DecodeSystemWideTraceForThread(
variant == ThreadContinuousExecution::Variant::HintedEnd) {
decoded_thread.AppendError(createStringError(
inconvertibleErrorCode(),
- formatv("Thread execution starting at tsc = {0} on core id = {1} "
+ formatv("Thread execution starting at tsc = {0} on cpu id = {1} "
"doesn't have a matching context switch out",
execution.thread_execution.GetLowestKnownTSC(),
- execution.thread_execution.core_id)));
+ execution.thread_execution.cpu_id)));
}
}
}
diff --git a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
index 127e547137702..f85e0db6f5140 100644
--- a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
+++ b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
@@ -27,7 +27,7 @@ struct IntelPTThreadSubtrace {
uint64_t tsc;
};
-/// This struct represents a continuous execution of a thread in a core,
+/// This struct represents a continuous execution of a thread in a cpu,
/// delimited by a context switch in and out, and a list of Intel PT subtraces
/// that belong to this execution.
struct IntelPTThreadContinousExecution {
@@ -65,7 +65,7 @@ void DecodeSingleTraceForThread(DecodedThread &decoded_thread, TraceIntelPT &tra
/// part of the execution ocurred.
void DecodeSystemWideTraceForThread(
DecodedThread &decoded_thread, TraceIntelPT &trace_intel_pt,
- const llvm::DenseMap<lldb::core_id_t, llvm::ArrayRef<uint8_t>> &buffers,
+ const llvm::DenseMap<lldb::cpu_id_t, llvm::ArrayRef<uint8_t>> &buffers,
const std::vector<IntelPTThreadContinousExecution> &executions);
/// Given an intel pt trace, split it in chunks delimited by PSB packets. Each of these chunks
diff --git a/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp b/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp
index 3732b38f0cfb6..6b4251a0fcd98 100644
--- a/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp
@@ -133,9 +133,9 @@ uint64_t ThreadContinuousExecution::GetEndTSC() const {
}
ThreadContinuousExecution ThreadContinuousExecution::CreateCompleteExecution(
- lldb::core_id_t core_id, lldb::tid_t tid, lldb::pid_t pid, uint64_t start,
+ lldb::cpu_id_t cpu_id, lldb::tid_t tid, lldb::pid_t pid, uint64_t start,
uint64_t end) {
- ThreadContinuousExecution o(core_id, tid, pid);
+ ThreadContinuousExecution o(cpu_id, tid, pid);
o.variant = Variant::Complete;
o.tscs.complete.start = start;
o.tscs.complete.end = end;
@@ -143,9 +143,9 @@ ThreadContinuousExecution ThreadContinuousExecution::CreateCompleteExecution(
}
ThreadContinuousExecution ThreadContinuousExecution::CreateHintedStartExecution(
- lldb::core_id_t core_id, lldb::tid_t tid, lldb::pid_t pid,
+ lldb::cpu_id_t cpu_id, lldb::tid_t tid, lldb::pid_t pid,
uint64_t hinted_start, uint64_t end) {
- ThreadContinuousExecution o(core_id, tid, pid);
+ ThreadContinuousExecution o(cpu_id, tid, pid);
o.variant = Variant::HintedStart;
o.tscs.hinted_start.hinted_start = hinted_start;
o.tscs.hinted_start.end = end;
@@ -153,9 +153,9 @@ ThreadContinuousExecution ThreadContinuousExecution::CreateHintedStartExecution(
}
ThreadContinuousExecution ThreadContinuousExecution::CreateHintedEndExecution(
- lldb::core_id_t core_id, lldb::tid_t tid, lldb::pid_t pid, uint64_t start,
+ lldb::cpu_id_t cpu_id, lldb::tid_t tid, lldb::pid_t pid, uint64_t start,
uint64_t hinted_end) {
- ThreadContinuousExecution o(core_id, tid, pid);
+ ThreadContinuousExecution o(cpu_id, tid, pid);
o.variant = Variant::HintedEnd;
o.tscs.hinted_end.start = start;
o.tscs.hinted_end.hinted_end = hinted_end;
@@ -163,23 +163,23 @@ ThreadContinuousExecution ThreadContinuousExecution::CreateHintedEndExecution(
}
ThreadContinuousExecution ThreadContinuousExecution::CreateOnlyEndExecution(
- lldb::core_id_t core_id, lldb::tid_t tid, lldb::pid_t pid, uint64_t end) {
- ThreadContinuousExecution o(core_id, tid, pid);
+ lldb::cpu_id_t cpu_id, lldb::tid_t tid, lldb::pid_t pid, uint64_t end) {
+ ThreadContinuousExecution o(cpu_id, tid, pid);
o.variant = Variant::OnlyEnd;
o.tscs.only_end.end = end;
return o;
}
ThreadContinuousExecution ThreadContinuousExecution::CreateOnlyStartExecution(
- lldb::core_id_t core_id, lldb::tid_t tid, lldb::pid_t pid, uint64_t start) {
- ThreadContinuousExecution o(core_id, tid, pid);
+ lldb::cpu_id_t cpu_id, lldb::tid_t tid, lldb::pid_t pid, uint64_t start) {
+ ThreadContinuousExecution o(cpu_id, tid, pid);
o.variant = Variant::OnlyStart;
o.tscs.only_start.start = start;
return o;
}
static Error RecoverExecutionsFromConsecutiveRecords(
- core_id_t core_id, const LinuxPerfZeroTscConversion &tsc_conversion,
+ cpu_id_t cpu_id, const LinuxPerfZeroTscConversion &tsc_conversion,
const ContextSwitchRecord ¤t_record,
const Optional<ContextSwitchRecord> &prev_record,
std::function<void(const ThreadContinuousExecution &execution)>
@@ -187,7 +187,7 @@ static Error RecoverExecutionsFromConsecutiveRecords(
if (!prev_record) {
if (current_record.IsOut()) {
on_new_execution(ThreadContinuousExecution::CreateOnlyEndExecution(
- core_id, current_record.tid, current_record.pid, current_record.tsc));
+ cpu_id, current_record.tid, current_record.pid, current_record.tsc));
}
// The 'in' case will be handled later when we try to look for its end
return Error::success();
@@ -205,26 +205,26 @@ static Error RecoverExecutionsFromConsecutiveRecords(
// We found two consecutive ins, which means that we didn't capture
// the end of the previous execution.
on_new_execution(ThreadContinuousExecution::CreateHintedEndExecution(
- core_id, prev.tid, prev.pid, prev.tsc, current_record.tsc - 1));
+ cpu_id, prev.tid, prev.pid, prev.tsc, current_record.tsc - 1));
} else if (current_record.IsOut() && prev.IsOut()) {
// We found two consecutive outs, that means that we didn't capture
// the beginning of the current execution.
on_new_execution(ThreadContinuousExecution::CreateHintedStartExecution(
- core_id, current_record.tid, current_record.pid, prev.tsc + 1,
+ cpu_id, current_record.tid, current_record.pid, prev.tsc + 1,
current_record.tsc));
} else if (current_record.IsOut() && prev.IsIn()) {
if (current_record.pid == prev.pid && current_record.tid == prev.tid) {
/// A complete execution
on_new_execution(ThreadContinuousExecution::CreateCompleteExecution(
- core_id, current_record.tid, current_record.pid, prev.tsc,
+ cpu_id, current_record.tid, current_record.pid, prev.tsc,
current_record.tsc));
} else {
// An out after the in of a
diff erent thread. The first one doesn't
// have an end, and the second one doesn't have a start.
on_new_execution(ThreadContinuousExecution::CreateHintedEndExecution(
- core_id, prev.tid, prev.pid, prev.tsc, current_record.tsc - 1));
+ cpu_id, prev.tid, prev.pid, prev.tsc, current_record.tsc - 1));
on_new_execution(ThreadContinuousExecution::CreateHintedStartExecution(
- core_id, current_record.tid, current_record.pid, prev.tsc + 1,
+ cpu_id, current_record.tid, current_record.pid, prev.tsc + 1,
current_record.tsc));
}
}
@@ -233,7 +233,7 @@ static Error RecoverExecutionsFromConsecutiveRecords(
Expected<std::vector<ThreadContinuousExecution>>
lldb_private::trace_intel_pt::DecodePerfContextSwitchTrace(
- ArrayRef<uint8_t> data, core_id_t core_id,
+ ArrayRef<uint8_t> data, cpu_id_t cpu_id,
const LinuxPerfZeroTscConversion &tsc_conversion) {
std::vector<ThreadContinuousExecution> executions;
@@ -260,7 +260,7 @@ lldb_private::trace_intel_pt::DecodePerfContextSwitchTrace(
static_cast<lldb::tid_t>(context_switch_record.tid)};
if (Error err = RecoverExecutionsFromConsecutiveRecords(
- core_id, tsc_conversion, record, prev_record,
+ cpu_id, tsc_conversion, record, prev_record,
[&](const ThreadContinuousExecution &execution) {
executions.push_back(execution);
}))
@@ -274,7 +274,7 @@ lldb_private::trace_intel_pt::DecodePerfContextSwitchTrace(
// We might have an incomplete last record
if (prev_record && prev_record->IsIn())
executions.push_back(ThreadContinuousExecution::CreateOnlyStartExecution(
- core_id, prev_record->tid, prev_record->pid, prev_record->tsc));
+ cpu_id, prev_record->tid, prev_record->pid, prev_record->tsc));
return Error::success();
};
@@ -282,8 +282,7 @@ lldb_private::trace_intel_pt::DecodePerfContextSwitchTrace(
return createStringError(inconvertibleErrorCode(),
formatv("Malformed perf context switch trace for "
"cpu {0} at offset {1}. {2}",
- core_id, offset,
- toString(std::move(err))));
+ cpu_id, offset, toString(std::move(err))));
return executions;
}
diff --git a/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.h b/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.h
index 6c4600b9ee985..721aa1d774813 100644
--- a/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.h
+++ b/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.h
@@ -21,8 +21,6 @@ namespace trace_intel_pt {
/// This class indicates the time interval in which a thread was running
/// continuously on a cpu core.
-///
-/// Note: we use the terms CPU and cores interchangeably.
struct ThreadContinuousExecution {
/// In most cases both the start and end of a continuous execution can be
@@ -35,15 +33,15 @@ struct ThreadContinuousExecution {
/// Both endpoints are known.
Complete,
/// The end is known and we have a lower bound for the start, i.e. the
- /// previous execution in the same core happens strictly before the hinted
+ /// previous execution in the same cpu happens strictly before the hinted
/// start.
HintedStart,
/// The start is known and we have an upper bound for the end, i.e. the next
- /// execution in the same core happens strictly after the hinted end.
+ /// execution in the same cpu happens strictly after the hinted end.
HintedEnd,
- /// We only know the start. This might be the last entry of a core trace.
+ /// We only know the start. This might be the last entry of a cpu trace.
OnlyStart,
- /// We only know the end. This might be the first entry or a core trace.
+ /// We only know the end. This might be the first entry or a cpu trace.
OnlyEnd,
} variant;
@@ -64,25 +62,26 @@ struct ThreadContinuousExecution {
///
/// \{
static ThreadContinuousExecution
- CreateCompleteExecution(lldb::core_id_t core_id, lldb::tid_t tid,
+ CreateCompleteExecution(lldb::cpu_id_t cpu_id, lldb::tid_t tid,
lldb::pid_t pid, uint64_t start, uint64_t end);
static ThreadContinuousExecution
- CreateHintedStartExecution(lldb::core_id_t core_id, lldb::tid_t tid,
+ CreateHintedStartExecution(lldb::cpu_id_t cpu_id, lldb::tid_t tid,
lldb::pid_t pid, uint64_t hinted_start,
uint64_t end);
static ThreadContinuousExecution
- CreateHintedEndExecution(lldb::core_id_t core_id, lldb::tid_t tid,
+ CreateHintedEndExecution(lldb::cpu_id_t cpu_id, lldb::tid_t tid,
lldb::pid_t pid, uint64_t start,
uint64_t hinted_end);
- static ThreadContinuousExecution
- CreateOnlyEndExecution(lldb::core_id_t core_id, lldb::tid_t tid,
- lldb::pid_t pid, uint64_t end);
+ static ThreadContinuousExecution CreateOnlyEndExecution(lldb::cpu_id_t cpu_id,
+ lldb::tid_t tid,
+ lldb::pid_t pid,
+ uint64_t end);
static ThreadContinuousExecution
- CreateOnlyStartExecution(lldb::core_id_t core_id, lldb::tid_t tid,
+ CreateOnlyStartExecution(lldb::cpu_id_t cpu_id, lldb::tid_t tid,
lldb::pid_t pid, uint64_t start);
/// \}
@@ -109,16 +108,16 @@ struct ThreadContinuousExecution {
} hinted_end;
} tscs;
- lldb::core_id_t core_id;
+ lldb::cpu_id_t cpu_id;
lldb::tid_t tid;
lldb::pid_t pid;
private:
/// We keep this constructor private to force the usage of the static named
/// constructors.
- ThreadContinuousExecution(lldb::core_id_t core_id, lldb::tid_t tid,
+ ThreadContinuousExecution(lldb::cpu_id_t cpu_id, lldb::tid_t tid,
lldb::pid_t pid)
- : core_id(core_id), tid(tid), pid(pid) {}
+ : cpu_id(cpu_id), tid(tid), pid(pid) {}
};
/// Decodes a context switch trace collected with perf_event_open.
@@ -126,8 +125,8 @@ struct ThreadContinuousExecution {
/// \param[in] data
/// The context switch trace in binary format.
///
-/// \param[i] core_id
-/// The core_id where the trace were gotten from.
+/// \param[i] cpu_id
+/// The cpu_id where the trace were gotten from.
///
/// \param[in] tsc_conversion
/// The conversion values used to confert nanoseconds to TSC.
@@ -137,7 +136,7 @@ struct ThreadContinuousExecution {
/// time, or an \a llvm::Error if the data is malformed.
llvm::Expected<std::vector<ThreadContinuousExecution>>
DecodePerfContextSwitchTrace(llvm::ArrayRef<uint8_t> data,
- lldb::core_id_t core_id,
+ lldb::cpu_id_t cpu_id,
const LinuxPerfZeroTscConversion &tsc_conversion);
} // namespace trace_intel_pt
diff --git a/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h b/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
index 06bb958a3e721..e5a6931c9c92c 100644
--- a/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
+++ b/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
@@ -23,7 +23,7 @@ namespace trace_intel_pt {
class ThreadDecoder {
public:
/// \param[in] thread_sp
- /// The thread whose trace buffer will be decoded.
+ /// The thread whose intel pt trace buffer will be decoded.
///
/// \param[in] trace
/// The main Trace object who owns this decoder and its data.
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
index 2fe57097dda3f..997c138ae8c9b 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
@@ -77,21 +77,21 @@ Expected<TraceSP> TraceIntelPT::CreateInstanceForLiveProcess(Process &process) {
TraceIntelPT::TraceIntelPT(JSONTraceSession &session,
ArrayRef<ProcessSP> traced_processes,
ArrayRef<ThreadPostMortemTraceSP> traced_threads)
- : Trace(traced_processes, session.GetCoreIds()),
+ : Trace(traced_processes, session.GetCpuIds()),
m_cpu_info(session.cpu_info) {
m_storage.tsc_conversion = session.tsc_perf_zero_conversion;
- if (session.cores) {
- std::vector<core_id_t> cores;
+ if (session.cpus) {
+ std::vector<cpu_id_t> cpus;
- for (const JSONCore &core : *session.cores) {
- SetPostMortemCoreDataFile(core.core_id, IntelPTDataKinds::kTraceBuffer,
- FileSpec(core.trace_buffer));
+ for (const JSONCpu &cpu : *session.cpus) {
+ SetPostMortemCpuDataFile(cpu.id, IntelPTDataKinds::kIptTrace,
+ FileSpec(cpu.ipt_trace));
- SetPostMortemCoreDataFile(core.core_id,
- IntelPTDataKinds::kPerfContextSwitchTrace,
- FileSpec(core.context_switch_trace));
- cores.push_back(core.core_id);
+ SetPostMortemCpuDataFile(cpu.id,
+ IntelPTDataKinds::kPerfContextSwitchTrace,
+ FileSpec(cpu.context_switch_trace));
+ cpus.push_back(cpu.id);
}
std::vector<tid_t> tids;
@@ -99,14 +99,14 @@ TraceIntelPT::TraceIntelPT(JSONTraceSession &session,
for (const JSONThread &thread : process.threads)
tids.push_back(thread.tid);
- m_storage.multicore_decoder.emplace(*this);
+ m_storage.multicpu_decoder.emplace(*this);
} else {
for (const ThreadPostMortemTraceSP &thread : traced_threads) {
m_storage.thread_decoders.try_emplace(
thread->GetID(), std::make_unique<ThreadDecoder>(thread, *this));
if (const Optional<FileSpec> &trace_file = thread->GetTraceFile()) {
- SetPostMortemThreadDataFile(
- thread->GetID(), IntelPTDataKinds::kTraceBuffer, *trace_file);
+ SetPostMortemThreadDataFile(thread->GetID(),
+ IntelPTDataKinds::kIptTrace, *trace_file);
}
}
}
@@ -119,8 +119,8 @@ DecodedThreadSP TraceIntelPT::Decode(Thread &thread) {
createStringError(inconvertibleErrorCode(), error));
Storage &storage = GetUpdatedStorage();
- if (storage.multicore_decoder)
- return storage.multicore_decoder->Decode(thread);
+ if (storage.multicpu_decoder)
+ return storage.multicpu_decoder->Decode(thread);
auto it = storage.thread_decoders.find(thread.GetID());
if (it == storage.thread_decoders.end())
@@ -204,14 +204,13 @@ void TraceIntelPT::DumpTraceInfo(Thread &thread, Stream &s, bool verbose) {
}
}
- // Multicode decoding stats
- if (storage.multicore_decoder) {
- s << "\n Multi-core decoding:\n";
+ if (storage.multicpu_decoder) {
+ s << "\n Multi-cpu decoding:\n";
s.Format(" Total number of continuous executions found: {0}\n",
- storage.multicore_decoder->GetTotalContinuousExecutionsCount());
+ storage.multicpu_decoder->GetTotalContinuousExecutionsCount());
s.Format(
" Number of continuous executions for this thread: {0}\n",
- storage.multicore_decoder->GetNumContinuousExecutionsForThread(tid));
+ storage.multicpu_decoder->GetNumContinuousExecutionsForThread(tid));
}
// Errors
@@ -231,12 +230,12 @@ void TraceIntelPT::DumpTraceInfo(Thread &thread, Stream &s, bool verbose) {
llvm::Expected<Optional<uint64_t>>
TraceIntelPT::GetRawTraceSize(Thread &thread) {
- if (GetUpdatedStorage().multicore_decoder)
+ if (GetUpdatedStorage().multicpu_decoder)
return None; // TODO: calculate the amount of intel pt raw trace associated
// with the given thread.
if (GetLiveProcess())
return GetLiveThreadBinaryDataSize(thread.GetID(),
- IntelPTDataKinds::kTraceBuffer);
+ IntelPTDataKinds::kIptTrace);
uint64_t size;
auto callback = [&](llvm::ArrayRef<uint8_t> data) {
size = data.size();
@@ -333,7 +332,7 @@ Error TraceIntelPT::DoRefreshLiveProcessState(TraceGetStateResponse state,
m_storage.tsc_conversion = intelpt_state->tsc_perf_zero_conversion;
- if (!intelpt_state->cores) {
+ if (!intelpt_state->cpus) {
for (const TraceThreadState &thread_state : state.traced_threads) {
ThreadSP thread_sp =
GetLiveProcess()->GetThreadList().FindThreadByID(thread_state.tid);
@@ -341,9 +340,9 @@ Error TraceIntelPT::DoRefreshLiveProcessState(TraceGetStateResponse state,
thread_state.tid, std::make_unique<ThreadDecoder>(thread_sp, *this));
}
} else {
- std::vector<core_id_t> cores;
- for (const TraceCoreState &core : *intelpt_state->cores)
- cores.push_back(core.core_id);
+ std::vector<cpu_id_t> cpus;
+ for (const TraceCpuState &cpu : *intelpt_state->cpus)
+ cpus.push_back(cpu.id);
std::vector<tid_t> tids;
for (const TraceThreadState &thread : intelpt_state->traced_threads)
@@ -352,7 +351,7 @@ Error TraceIntelPT::DoRefreshLiveProcessState(TraceGetStateResponse state,
if (!intelpt_state->tsc_perf_zero_conversion)
return createStringError(inconvertibleErrorCode(),
"Missing perf time_zero conversion values");
- m_storage.multicore_decoder.emplace(*this);
+ m_storage.multicpu_decoder.emplace(*this);
}
if (m_storage.tsc_conversion) {
@@ -364,8 +363,8 @@ Error TraceIntelPT::DoRefreshLiveProcessState(TraceGetStateResponse state,
bool TraceIntelPT::IsTraced(lldb::tid_t tid) {
Storage &storage = GetUpdatedStorage();
- if (storage.multicore_decoder)
- return storage.multicore_decoder->TracesThread(tid);
+ if (storage.multicpu_decoder)
+ return storage.multicpu_decoder->TracesThread(tid);
return storage.thread_decoders.count(tid);
}
@@ -381,7 +380,7 @@ const char *TraceIntelPT::GetStartConfigurationHelp() {
See the jLLDBTraceStart section in lldb/docs/lldb-gdb-remote.txt for a
description of each parameter below.
- - int traceBufferSize (defaults to {0} bytes):
+ - int iptTraceSize (defaults to {0} bytes):
[process and thread tracing]
- boolean enableTsc (default to {1}):
@@ -390,62 +389,61 @@ const char *TraceIntelPT::GetStartConfigurationHelp() {
- int psbPeriod (defaults to {2}):
[process and thread tracing]
- - boolean perCoreTracing (default to {3}):
+ - boolean perCpuTracing (default to {3}):
[process tracing only]
- int processBufferSizeLimit (defaults to {4} MiB):
[process tracing only])",
- kDefaultTraceBufferSize, kDefaultEnableTscValue,
- kDefaultPsbPeriod, kDefaultPerCoreTracing,
+ kDefaultIptTraceSize, kDefaultEnableTscValue,
+ kDefaultPsbPeriod, kDefaultPerCpuTracing,
kDefaultProcessBufferSizeLimit / 1024 / 1024));
}
return message->c_str();
}
-Error TraceIntelPT::Start(uint64_t trace_buffer_size,
+Error TraceIntelPT::Start(uint64_t ipt_trace_size,
uint64_t total_buffer_size_limit, bool enable_tsc,
- Optional<uint64_t> psb_period,
- bool per_core_tracing) {
+ Optional<uint64_t> psb_period, bool per_cpu_tracing) {
TraceIntelPTStartRequest request;
- request.trace_buffer_size = trace_buffer_size;
+ request.ipt_trace_size = ipt_trace_size;
request.process_buffer_size_limit = total_buffer_size_limit;
request.enable_tsc = enable_tsc;
request.psb_period = psb_period;
request.type = GetPluginName().str();
- request.per_core_tracing = per_core_tracing;
+ request.per_cpu_tracing = per_cpu_tracing;
return Trace::Start(toJSON(request));
}
Error TraceIntelPT::Start(StructuredData::ObjectSP configuration) {
- uint64_t trace_buffer_size = kDefaultTraceBufferSize;
+ uint64_t ipt_trace_size = kDefaultIptTraceSize;
uint64_t process_buffer_size_limit = kDefaultProcessBufferSizeLimit;
bool enable_tsc = kDefaultEnableTscValue;
Optional<uint64_t> psb_period = kDefaultPsbPeriod;
- bool per_core_tracing = kDefaultPerCoreTracing;
+ bool per_cpu_tracing = kDefaultPerCpuTracing;
if (configuration) {
if (StructuredData::Dictionary *dict = configuration->GetAsDictionary()) {
- dict->GetValueForKeyAsInteger("traceBufferSize", trace_buffer_size);
+ dict->GetValueForKeyAsInteger("iptTraceSize", ipt_trace_size);
dict->GetValueForKeyAsInteger("processBufferSizeLimit",
process_buffer_size_limit);
dict->GetValueForKeyAsBoolean("enableTsc", enable_tsc);
dict->GetValueForKeyAsInteger("psbPeriod", psb_period);
- dict->GetValueForKeyAsBoolean("perCoreTracing", per_core_tracing);
+ dict->GetValueForKeyAsBoolean("perCpuTracing", per_cpu_tracing);
} else {
return createStringError(inconvertibleErrorCode(),
"configuration object is not a dictionary");
}
}
- return Start(trace_buffer_size, process_buffer_size_limit, enable_tsc,
- psb_period, per_core_tracing);
+ return Start(ipt_trace_size, process_buffer_size_limit, enable_tsc,
+ psb_period, per_cpu_tracing);
}
llvm::Error TraceIntelPT::Start(llvm::ArrayRef<lldb::tid_t> tids,
- uint64_t trace_buffer_size, bool enable_tsc,
+ uint64_t ipt_trace_size, bool enable_tsc,
Optional<uint64_t> psb_period) {
TraceIntelPTStartRequest request;
- request.trace_buffer_size = trace_buffer_size;
+ request.ipt_trace_size = ipt_trace_size;
request.enable_tsc = enable_tsc;
request.psb_period = psb_period;
request.type = GetPluginName().str();
@@ -457,13 +455,13 @@ llvm::Error TraceIntelPT::Start(llvm::ArrayRef<lldb::tid_t> tids,
Error TraceIntelPT::Start(llvm::ArrayRef<lldb::tid_t> tids,
StructuredData::ObjectSP configuration) {
- uint64_t trace_buffer_size = kDefaultTraceBufferSize;
+ uint64_t ipt_trace_size = kDefaultIptTraceSize;
bool enable_tsc = kDefaultEnableTscValue;
Optional<uint64_t> psb_period = kDefaultPsbPeriod;
if (configuration) {
if (StructuredData::Dictionary *dict = configuration->GetAsDictionary()) {
- dict->GetValueForKeyAsInteger("traceBufferSize", trace_buffer_size);
+ dict->GetValueForKeyAsInteger("iptTraceSize", ipt_trace_size);
dict->GetValueForKeyAsBoolean("enableTsc", enable_tsc);
dict->GetValueForKeyAsInteger("psbPeriod", psb_period);
} else {
@@ -472,12 +470,12 @@ Error TraceIntelPT::Start(llvm::ArrayRef<lldb::tid_t> tids,
}
}
- return Start(tids, trace_buffer_size, enable_tsc, psb_period);
+ return Start(tids, ipt_trace_size, enable_tsc, psb_period);
}
Error TraceIntelPT::OnThreadBufferRead(lldb::tid_t tid,
OnBinaryDataReadCallback callback) {
- return OnThreadBinaryDataRead(tid, IntelPTDataKinds::kTraceBuffer, callback);
+ return OnThreadBinaryDataRead(tid, IntelPTDataKinds::kIptTrace, callback);
}
TaskTimer &TraceIntelPT::GetTimer() { return GetUpdatedStorage().task_timer; }
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
index 0fa6be4bfbb9d..64bcc8ba84cbc 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
@@ -11,7 +11,7 @@
#include "TaskTimer.h"
#include "ThreadDecoder.h"
-#include "TraceIntelPTMultiCoreDecoder.h"
+#include "TraceIntelPTMultiCpuDecoder.h"
#include "TraceIntelPTSessionFileParser.h"
#include "lldb/Utility/FileSpec.h"
@@ -89,7 +89,7 @@ class TraceIntelPT : public Trace {
/// More information on the parameters below can be found in the
/// jLLDBTraceStart section in lldb/docs/lldb-gdb-remote.txt.
///
- /// \param[in] trace_buffer_size
+ /// \param[in] ipt_trace_size
/// Trace size per thread in bytes.
///
/// \param[in] total_buffer_size_limit
@@ -101,17 +101,16 @@ class TraceIntelPT : public Trace {
/// \param[in] psb_period
/// This value defines the period in which PSB packets will be generated.
///
- /// \param[in] per_core_tracing
- /// This value defines whether to have a trace buffer per thread or per
- /// cpu core.
+ /// \param[in] per_cpu_tracing
+ /// This value defines whether to have an intel pt trace buffer per thread
+ /// or per cpu core.
///
/// \return
/// \a llvm::Error::success if the operation was successful, or
/// \a llvm::Error otherwise.
- llvm::Error Start(uint64_t trace_buffer_size,
- uint64_t total_buffer_size_limit, bool enable_tsc,
- llvm::Optional<uint64_t> psb_period,
- bool m_per_core_tracing);
+ llvm::Error Start(uint64_t ipt_trace_size, uint64_t total_buffer_size_limit,
+ bool enable_tsc, llvm::Optional<uint64_t> psb_period,
+ bool m_per_cpu_tracing);
/// \copydoc Trace::Start
llvm::Error Start(StructuredData::ObjectSP configuration =
@@ -125,8 +124,8 @@ class TraceIntelPT : public Trace {
/// \param[in] tids
/// Threads to trace.
///
- /// \param[in] trace_buffer_size
- /// Trace size per thread or per core in bytes.
+ /// \param[in] ipt_trace_size
+ /// Trace size per thread or per cpu core in bytes.
///
/// \param[in] enable_tsc
/// Whether to use enable TSC timestamps or not.
@@ -137,9 +136,8 @@ class TraceIntelPT : public Trace {
/// \return
/// \a llvm::Error::success if the operation was successful, or
/// \a llvm::Error otherwise.
- llvm::Error Start(llvm::ArrayRef<lldb::tid_t> tids,
- uint64_t trace_buffer_size, bool enable_tsc,
- llvm::Optional<uint64_t> psb_period);
+ llvm::Error Start(llvm::ArrayRef<lldb::tid_t> tids, uint64_t ipt_trace_size,
+ bool enable_tsc, llvm::Optional<uint64_t> psb_period);
/// \copydoc Trace::Start
llvm::Error Start(llvm::ArrayRef<lldb::tid_t> tids,
@@ -200,8 +198,8 @@ class TraceIntelPT : public Trace {
/// This variable should only be accessed directly by constructores or live
/// process data refreshers.
struct Storage {
- llvm::Optional<TraceIntelPTMultiCoreDecoder> multicore_decoder;
- /// These decoders are used for the non-per-core case
+ llvm::Optional<TraceIntelPTMultiCpuDecoder> multicpu_decoder;
+ /// These decoders are used for the non-per-cpu case
llvm::DenseMap<lldb::tid_t, std::unique_ptr<ThreadDecoder>> thread_decoders;
/// Helper variable used to track long running operations for telemetry.
TaskTimer task_timer;
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
index 501fc3013f60c..61fdb4574d541 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
@@ -16,11 +16,11 @@
namespace lldb_private {
namespace trace_intel_pt {
-const size_t kDefaultTraceBufferSize = 4 * 1024; // 4KB
+const size_t kDefaultIptTraceSize = 4 * 1024; // 4KB
const size_t kDefaultProcessBufferSizeLimit = 5 * 1024 * 1024; // 500MB
const bool kDefaultEnableTscValue = false;
const llvm::Optional<size_t> kDefaultPsbPeriod = llvm::None;
-const bool kDefaultPerCoreTracing = false;
+const bool kDefaultPerCpuTracing = false;
} // namespace trace_intel_pt
} // namespace lldb_private
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
index 5aeeb46831ed7..85f589e7f40da 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
@@ -20,13 +20,13 @@ using namespace llvm::json;
namespace lldb_private {
namespace trace_intel_pt {
-Optional<std::vector<lldb::core_id_t>> JSONTraceSession::GetCoreIds() {
- if (!cores)
+Optional<std::vector<lldb::cpu_id_t>> JSONTraceSession::GetCpuIds() {
+ if (!cpus)
return None;
- std::vector<lldb::core_id_t> core_ids;
- for (const JSONCore &core : *cores)
- core_ids.push_back(core.core_id);
- return core_ids;
+ std::vector<lldb::cpu_id_t> cpu_ids;
+ for (const JSONCpu &cpu : *cpus)
+ cpu_ids.push_back(cpu.id);
+ return cpu_ids;
}
json::Value toJSON(const JSONModule &module) {
@@ -50,15 +50,14 @@ bool fromJSON(const json::Value &value, JSONModule &module, Path path) {
json::Value toJSON(const JSONThread &thread) {
json::Object obj{{"tid", thread.tid}};
- if (thread.trace_buffer)
- obj["traceBuffer"] = *thread.trace_buffer;
+ if (thread.ipt_trace)
+ obj["iptTrace"] = *thread.ipt_trace;
return obj;
}
bool fromJSON(const json::Value &value, JSONThread &thread, Path path) {
ObjectMapper o(value, path);
- return o && o.map("tid", thread.tid) &&
- o.map("traceBuffer", thread.trace_buffer);
+ return o && o.map("tid", thread.tid) && o.map("iptTrace", thread.ipt_trace);
}
json::Value toJSON(const JSONProcess &process) {
@@ -76,22 +75,21 @@ bool fromJSON(const json::Value &value, JSONProcess &process, Path path) {
o.map("threads", process.threads) && o.map("modules", process.modules);
}
-json::Value toJSON(const JSONCore &core) {
+json::Value toJSON(const JSONCpu &cpu) {
return Object{
- {"coreId", core.core_id},
- {"traceBuffer", core.trace_buffer},
- {"contextSwitchTrace", core.context_switch_trace},
+ {"id", cpu.id},
+ {"iptTrace", cpu.ipt_trace},
+ {"contextSwitchTrace", cpu.context_switch_trace},
};
}
-bool fromJSON(const json::Value &value, JSONCore &core, Path path) {
+bool fromJSON(const json::Value &value, JSONCpu &cpu, Path path) {
ObjectMapper o(value, path);
- uint64_t core_id;
- if (!(o && o.map("coreId", core_id) &&
- o.map("traceBuffer", core.trace_buffer) &&
- o.map("contextSwitchTrace", core.context_switch_trace)))
+ uint64_t cpu_id;
+ if (!(o && o.map("id", cpu_id) && o.map("iptTrace", cpu.ipt_trace) &&
+ o.map("contextSwitchTrace", cpu.context_switch_trace)))
return false;
- core.core_id = core_id;
+ cpu.id = cpu_id;
return true;
}
@@ -124,19 +122,19 @@ json::Value toJSON(const JSONTraceSession &session) {
// We have to do this because the compiler fails at doing it
// automatically because pt_cpu is not in a namespace
{"cpuInfo", toJSON(session.cpu_info)},
- {"cores", session.cores},
+ {"cpus", session.cpus},
{"tscPerfZeroConversion", session.tsc_perf_zero_conversion}};
}
bool fromJSON(const json::Value &value, JSONTraceSession &session, Path path) {
ObjectMapper o(value, path);
if (!(o && o.map("processes", session.processes) &&
- o.map("type", session.type) && o.map("cores", session.cores) &&
+ o.map("type", session.type) && o.map("cpus", session.cpus) &&
o.map("tscPerfZeroConversion", session.tsc_perf_zero_conversion)))
return false;
- if (session.cores && !session.tsc_perf_zero_conversion) {
+ if (session.cpus && !session.tsc_perf_zero_conversion) {
path.report(
- "\"tscPerfZeroConversion\" is required when \"cores\" is provided");
+ "\"tscPerfZeroConversion\" is required when \"cpus\" is provided");
return false;
}
// We have to do this because the compiler fails at doing it automatically
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
index 39f262688a008..277f0c0f636fc 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
@@ -31,7 +31,7 @@ struct JSONModule {
struct JSONThread {
uint64_t tid;
- llvm::Optional<std::string> trace_buffer;
+ llvm::Optional<std::string> ipt_trace;
};
struct JSONProcess {
@@ -41,9 +41,9 @@ struct JSONProcess {
std::vector<JSONModule> modules;
};
-struct JSONCore {
- lldb::core_id_t core_id;
- std::string trace_buffer;
+struct JSONCpu {
+ lldb::cpu_id_t id;
+ std::string ipt_trace;
std::string context_switch_trace;
};
@@ -51,10 +51,10 @@ struct JSONTraceSession {
std::string type;
pt_cpu cpu_info;
std::vector<JSONProcess> processes;
- llvm::Optional<std::vector<JSONCore>> cores;
+ llvm::Optional<std::vector<JSONCpu>> cpus;
llvm::Optional<LinuxPerfZeroTscConversion> tsc_perf_zero_conversion;
- llvm::Optional<std::vector<lldb::core_id_t>> GetCoreIds();
+ llvm::Optional<std::vector<lldb::cpu_id_t>> GetCpuIds();
};
llvm::json::Value toJSON(const JSONModule &module);
@@ -63,7 +63,7 @@ llvm::json::Value toJSON(const JSONThread &thread);
llvm::json::Value toJSON(const JSONProcess &process);
-llvm::json::Value toJSON(const JSONCore &core);
+llvm::json::Value toJSON(const JSONCpu &cpu);
llvm::json::Value toJSON(const pt_cpu &cpu_info);
@@ -78,7 +78,7 @@ bool fromJSON(const llvm::json::Value &value, JSONThread &thread,
bool fromJSON(const llvm::json::Value &value, JSONProcess &process,
llvm::json::Path path);
-bool fromJSON(const llvm::json::Value &value, JSONCore &core,
+bool fromJSON(const llvm::json::Value &value, JSONCpu &cpu,
llvm::json::Path path);
bool fromJSON(const llvm::json::Value &value, pt_cpu &cpu_info,
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
similarity index 78%
rename from lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.cpp
rename to lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
index 53db5be60f1a2..6cc70e25f4191 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
@@ -1,4 +1,4 @@
-//===-- TraceIntelPTMultiCoreDecoder.cpp ----------------------------------===//
+//===-- TraceIntelPTMultiCpuDecoder.cpp ----0------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "TraceIntelPTMultiCoreDecoder.h"
+#include "TraceIntelPTMultiCpuDecoder.h"
#include "TraceIntelPT.h"
@@ -17,7 +17,7 @@ using namespace lldb_private;
using namespace lldb_private::trace_intel_pt;
using namespace llvm;
-TraceIntelPTMultiCoreDecoder::TraceIntelPTMultiCoreDecoder(TraceIntelPT &trace)
+TraceIntelPTMultiCpuDecoder::TraceIntelPTMultiCpuDecoder(TraceIntelPT &trace)
: m_trace(&trace) {
for (Process *proc : trace.GetAllProcesses()) {
for (ThreadSP thread_sp : proc->GetThreadList().Threads()) {
@@ -26,11 +26,11 @@ TraceIntelPTMultiCoreDecoder::TraceIntelPTMultiCoreDecoder(TraceIntelPT &trace)
}
}
-bool TraceIntelPTMultiCoreDecoder::TracesThread(lldb::tid_t tid) const {
+bool TraceIntelPTMultiCpuDecoder::TracesThread(lldb::tid_t tid) const {
return m_tids.count(tid);
}
-DecodedThreadSP TraceIntelPTMultiCoreDecoder::Decode(Thread &thread) {
+DecodedThreadSP TraceIntelPTMultiCpuDecoder::Decode(Thread &thread) {
if (Error err = CorrelateContextSwitchesAndIntelPtTraces())
return std::make_shared<DecodedThread>(thread.shared_from_this(),
std::move(err));
@@ -41,12 +41,13 @@ DecodedThreadSP TraceIntelPTMultiCoreDecoder::Decode(Thread &thread) {
DecodedThreadSP decoded_thread_sp =
std::make_shared<DecodedThread>(thread.shared_from_this());
- Error err = m_trace->OnAllCoresBinaryDataRead(
- IntelPTDataKinds::kTraceBuffer,
- [&](const DenseMap<core_id_t, ArrayRef<uint8_t>>& buffers) -> Error {
+ Error err = m_trace->OnAllCpusBinaryDataRead(
+ IntelPTDataKinds::kIptTrace,
+ [&](const DenseMap<cpu_id_t, ArrayRef<uint8_t>> &buffers) -> Error {
auto it = m_continuous_executions_per_thread->find(thread.GetID());
if (it != m_continuous_executions_per_thread->end())
- DecodeSystemWideTraceForThread(*decoded_thread_sp, *m_trace, buffers, it->second);
+ DecodeSystemWideTraceForThread(*decoded_thread_sp, *m_trace, buffers,
+ it->second);
return Error::success();
});
@@ -58,10 +59,10 @@ DecodedThreadSP TraceIntelPTMultiCoreDecoder::Decode(Thread &thread) {
}
static Expected<std::vector<IntelPTThreadSubtrace>>
-GetIntelPTSubtracesForCore(TraceIntelPT &trace, core_id_t core_id) {
+GetIntelPTSubtracesForCpu(TraceIntelPT &trace, cpu_id_t cpu_id) {
std::vector<IntelPTThreadSubtrace> intel_pt_subtraces;
- Error err = trace.OnCoreBinaryDataRead(
- core_id, IntelPTDataKinds::kTraceBuffer,
+ Error err = trace.OnCpuBinaryDataRead(
+ cpu_id, IntelPTDataKinds::kIptTrace,
[&](ArrayRef<uint8_t> data) -> Error {
Expected<std::vector<IntelPTThreadSubtrace>> split_trace =
SplitTraceInContinuousExecutions(trace, data);
@@ -76,9 +77,8 @@ GetIntelPTSubtracesForCore(TraceIntelPT &trace, core_id_t core_id) {
return intel_pt_subtraces;
}
-Expected<
- DenseMap<lldb::tid_t, std::vector<IntelPTThreadContinousExecution>>>
-TraceIntelPTMultiCoreDecoder::DoCorrelateContextSwitchesAndIntelPtTraces() {
+Expected<DenseMap<lldb::tid_t, std::vector<IntelPTThreadContinousExecution>>>
+TraceIntelPTMultiCpuDecoder::DoCorrelateContextSwitchesAndIntelPtTraces() {
DenseMap<lldb::tid_t, std::vector<IntelPTThreadContinousExecution>>
continuous_executions_per_thread;
@@ -91,9 +91,9 @@ TraceIntelPTMultiCoreDecoder::DoCorrelateContextSwitchesAndIntelPtTraces() {
LinuxPerfZeroTscConversion tsc_conversion = *conv_opt;
- for (core_id_t core_id : m_trace->GetTracedCores()) {
+ for (cpu_id_t cpu_id : m_trace->GetTracedCpus()) {
Expected<std::vector<IntelPTThreadSubtrace>> intel_pt_subtraces =
- GetIntelPTSubtracesForCore(*m_trace, core_id);
+ GetIntelPTSubtracesForCpu(*m_trace, cpu_id);
if (!intel_pt_subtraces)
return intel_pt_subtraces.takeError();
@@ -101,7 +101,7 @@ TraceIntelPTMultiCoreDecoder::DoCorrelateContextSwitchesAndIntelPtTraces() {
// pt subtraces sorted by time.
auto it = intel_pt_subtraces->begin();
auto on_new_thread_execution =
- [&](const ThreadContinuousExecution& thread_execution) {
+ [&](const ThreadContinuousExecution &thread_execution) {
IntelPTThreadContinousExecution execution(thread_execution);
for (; it != intel_pt_subtraces->end() &&
@@ -116,11 +116,11 @@ TraceIntelPTMultiCoreDecoder::DoCorrelateContextSwitchesAndIntelPtTraces() {
continuous_executions_per_thread[thread_execution.tid].push_back(
execution);
};
- Error err = m_trace->OnCoreBinaryDataRead(
- core_id, IntelPTDataKinds::kPerfContextSwitchTrace,
+ Error err = m_trace->OnCpuBinaryDataRead(
+ cpu_id, IntelPTDataKinds::kPerfContextSwitchTrace,
[&](ArrayRef<uint8_t> data) -> Error {
Expected<std::vector<ThreadContinuousExecution>> executions =
- DecodePerfContextSwitchTrace(data, core_id, tsc_conversion);
+ DecodePerfContextSwitchTrace(data, cpu_id, tsc_conversion);
if (!executions)
return executions.takeError();
for (const ThreadContinuousExecution &exec : *executions)
@@ -138,7 +138,7 @@ TraceIntelPTMultiCoreDecoder::DoCorrelateContextSwitchesAndIntelPtTraces() {
return continuous_executions_per_thread;
}
-Error TraceIntelPTMultiCoreDecoder::CorrelateContextSwitchesAndIntelPtTraces() {
+Error TraceIntelPTMultiCpuDecoder::CorrelateContextSwitchesAndIntelPtTraces() {
if (m_setup_error)
return createStringError(inconvertibleErrorCode(), m_setup_error->c_str());
@@ -161,7 +161,7 @@ Error TraceIntelPTMultiCoreDecoder::CorrelateContextSwitchesAndIntelPtTraces() {
return Error::success();
}
-size_t TraceIntelPTMultiCoreDecoder::GetNumContinuousExecutionsForThread(
+size_t TraceIntelPTMultiCpuDecoder::GetNumContinuousExecutionsForThread(
lldb::tid_t tid) const {
if (!m_continuous_executions_per_thread)
return 0;
@@ -171,7 +171,7 @@ size_t TraceIntelPTMultiCoreDecoder::GetNumContinuousExecutionsForThread(
return it->second.size();
}
-size_t TraceIntelPTMultiCoreDecoder::GetTotalContinuousExecutionsCount() const {
+size_t TraceIntelPTMultiCpuDecoder::GetTotalContinuousExecutionsCount() const {
if (!m_continuous_executions_per_thread)
return 0;
size_t count = 0;
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
similarity index 79%
rename from lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.h
rename to lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
index 6bdc602dfb06c..cf03d6ce3e62b 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCoreDecoder.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
@@ -1,4 +1,4 @@
-//===-- TraceIntelPTMultiCoreDecoder.h --------------------------*- C++ -*-===//
+//===-- TraceIntelPTMultiCpuDecoder.h ---------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTMULTICOREDECODER_H
-#define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTMULTICOREDECODER_H
+#ifndef LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTMULTICPUDECODER_H
+#define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTMULTICPUDECODER_H
#include "LibiptDecoder.h"
#include "PerfContextSwitchDecoder.h"
@@ -16,9 +16,9 @@
namespace lldb_private {
namespace trace_intel_pt {
-/// Class used to decode a multi-core Intel PT trace. It assumes that each
-/// thread could have potentially been executed on
diff erent cores. It uses a
-/// context switch trace per CPU with timestamps to identify which thread owns
+/// Class used to decode a multi-cpu Intel PT trace. It assumes that each
+/// thread could have potentially been executed on
diff erent cpu cores. It uses
+/// a context switch trace per CPU with timestamps to identify which thread owns
/// each Intel PT decoded instruction and in which order. It also assumes that
/// the Intel PT data and context switches might have gaps in their traces due
/// to contention or race conditions. Finally, it assumes that a tid is not
@@ -27,11 +27,11 @@ namespace trace_intel_pt {
///
/// This object should be recreated after every stop in the case of live
/// processes.
-class TraceIntelPTMultiCoreDecoder {
+class TraceIntelPTMultiCpuDecoder {
public:
/// \param[in] TraceIntelPT
/// The trace object to be decoded
- TraceIntelPTMultiCoreDecoder(TraceIntelPT &trace);
+ TraceIntelPTMultiCpuDecoder(TraceIntelPT &trace);
/// \return
/// A \a DecodedThread for the \p thread by decoding its instructions on all
@@ -52,8 +52,9 @@ class TraceIntelPTMultiCoreDecoder {
size_t GetTotalContinuousExecutionsCount() const;
private:
- /// Traverse the context switch traces and the basic intel pt continuous subtraces
- /// and produce a list of continuous executions for each process and thread.
+ /// Traverse the context switch traces and the basic intel pt continuous
+ /// subtraces and produce a list of continuous executions for each process and
+ /// thread.
///
/// See \a DoCorrelateContextSwitchesAndIntelPtTraces.
///
@@ -81,4 +82,4 @@ class TraceIntelPTMultiCoreDecoder {
} // namespace trace_intel_pt
} // namespace lldb_private
-#endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTMULTICOREDECODER_H
+#endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTMULTICPUDECODER_H
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td
index 1cc41ac9198c9..29aa1459306ae 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td
@@ -38,16 +38,16 @@ let Command = "process trace start intel pt" in {
def process_trace_start_intel_pt_buffer_size: Option<"buffer-size", "s">,
Group<1>,
Arg<"Value">,
- Desc<"Size in bytes used by each individual per-thread or per-core trace "
+ Desc<"Size in bytes used by each individual per-thread or per-cpu trace "
"buffer. It must be a power of 2 greater than or equal to 4096 (2^12) "
"bytes.">;
- def process_trace_start_intel_pt_per_core_tracing:
- Option<"per-core-tracing", "c">,
+ def process_trace_start_intel_pt_per_cpu_tracing:
+ Option<"per-cpu-tracing", "c">,
Group<1>,
Desc<"Instead of having an individual trace buffer per thread, which uses "
"a number trace buffers proportional to the number of running "
"threads, this option triggers the collection on a per cpu core "
- "basis. This effectively traces the entire activity on all cores "
+ "basis. This effectively traces the entire activity on all cpus "
"using a limited amount of trace buffers regardless of the number of "
"threads. This might cause data loss for less frequent threads. This "
"option forces the capture of TSC timestamps (see --tsc). Also, this "
@@ -57,7 +57,7 @@ let Command = "process trace start intel pt" in {
Group<1>,
Arg<"Value">,
Desc<"Maximum total trace size per process in bytes. This limit applies to "
- "the sum of the sizes of all thread and core traces of this process, "
+ "the sum of the sizes of all thread and cpu traces of this process, "
"excluding the ones created with the \"thread trace start\" command. "
"Whenever a thread is attempted to be traced due to this command and "
"the limit would be reached, the process is stopped with a "
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
index 81e574b024def..590f38de18cc5 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
@@ -79,8 +79,8 @@ TraceIntelPTSessionFileParser::ParseThread(Process &process,
lldb::tid_t tid = static_cast<lldb::tid_t>(thread.tid);
Optional<FileSpec> trace_file;
- if (thread.trace_buffer)
- trace_file = FileSpec(*thread.trace_buffer);
+ if (thread.ipt_trace)
+ trace_file = FileSpec(*thread.ipt_trace);
ThreadPostMortemTraceSP thread_sp =
std::make_shared<ThreadPostMortemTrace>(process, tid, trace_file);
@@ -175,7 +175,7 @@ StringRef TraceIntelPTSessionFileParser::GetSchema() {
// optional.
{
"tid": integer,
- "traceBuffer"?: string
+ "iptTrace"?: string
// Path to the raw Intel PT buffer file for this thread.
}
],
@@ -193,14 +193,14 @@ StringRef TraceIntelPTSessionFileParser::GetSchema() {
]
}
],
- "cores"?: [
+ "cpus"?: [
{
- "coreId": integer,
+ "id": integer,
// Id of this CPU core.
- "traceBuffer": string,
- // Path to the raw Intel PT buffer for this core.
+ "iptTrace": string,
+ // Path to the raw Intel PT buffer for this cpu core.
"contextSwitchTrace": string,
- // Path to the raw perf_event_open context switch trace file for this core.
+ // Path to the raw perf_event_open context switch trace file for this cpu core.
// The perf_event must have been configured with PERF_SAMPLE_TID and
// PERF_SAMPLE_TIME, as well as sample_id_all = 1.
}
@@ -219,8 +219,8 @@ StringRef TraceIntelPTSessionFileParser::GetSchema() {
Notes:
- All paths are either absolute or relative to folder containing the session file.
-- "cores" is provided if and only if processes[].threads[].traceBuffer is not provided.
-- "tscPerfZeroConversion" must be provided if "cores" is provided.
+- "cpus" is provided if and only if processes[].threads[].iptTrace is not provided.
+- "tscPerfZeroConversion" must be provided if "cpus" is provided.
})";
}
return schema;
@@ -228,7 +228,7 @@ StringRef TraceIntelPTSessionFileParser::GetSchema() {
Error TraceIntelPTSessionFileParser::AugmentThreadsFromContextSwitches(
JSONTraceSession &session) {
- if (!session.cores)
+ if (!session.cpus)
return Error::success();
if (!session.tsc_perf_zero_conversion)
@@ -252,15 +252,15 @@ Error TraceIntelPTSessionFileParser::AugmentThreadsFromContextSwitches(
if (indexed_threads[proc->second].count(tid))
return;
indexed_threads[proc->second].insert(tid);
- proc->second->threads.push_back({tid, /*trace_buffer=*/None});
+ proc->second->threads.push_back({tid, /*ipt_trace=*/None});
};
- for (const JSONCore &core : *session.cores) {
+ for (const JSONCpu &cpu : *session.cpus) {
Error err = Trace::OnDataFileRead(
- FileSpec(core.context_switch_trace),
+ FileSpec(cpu.context_switch_trace),
[&](ArrayRef<uint8_t> data) -> Error {
Expected<std::vector<ThreadContinuousExecution>> executions =
- DecodePerfContextSwitchTrace(data, core.core_id,
+ DecodePerfContextSwitchTrace(data, cpu.id,
*session.tsc_perf_zero_conversion);
if (!executions)
return executions.takeError();
@@ -300,15 +300,15 @@ void TraceIntelPTSessionFileParser::NormalizeAllPaths(
module.file = NormalizePath(*module.file).GetPath();
}
for (JSONThread &thread : process.threads) {
- if (thread.trace_buffer)
- thread.trace_buffer = NormalizePath(*thread.trace_buffer).GetPath();
+ if (thread.ipt_trace)
+ thread.ipt_trace = NormalizePath(*thread.ipt_trace).GetPath();
}
}
- if (session.cores) {
- for (JSONCore &core : *session.cores) {
- core.context_switch_trace =
- NormalizePath(core.context_switch_trace).GetPath();
- core.trace_buffer = NormalizePath(core.trace_buffer).GetPath();
+ if (session.cpus) {
+ for (JSONCpu &cpu : *session.cpus) {
+ cpu.context_switch_trace =
+ NormalizePath(cpu.context_switch_trace).GetPath();
+ cpu.ipt_trace = NormalizePath(cpu.ipt_trace).GetPath();
}
}
}
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.cpp
index a252b332eb5a8..c282da3926569 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.cpp
@@ -103,13 +103,13 @@ BuildThreadsSection(Process &process, FileSpec directory) {
JSONThread json_thread;
json_thread.tid = tid;
- if (trace_sp->GetTracedCores().empty()) {
+ if (trace_sp->GetTracedCpus().empty()) {
FileSpec output_file = threads_dir;
output_file.AppendPathComponent(std::to_string(tid) + ".intelpt_trace");
- json_thread.trace_buffer = output_file.GetPath();
+ json_thread.ipt_trace = output_file.GetPath();
llvm::Error err = process.GetTarget().GetTrace()->OnThreadBinaryDataRead(
- tid, IntelPTDataKinds::kTraceBuffer,
+ tid, IntelPTDataKinds::kIptTrace,
[&](llvm::ArrayRef<uint8_t> data) -> llvm::Error {
return WriteBytesToDisk(output_file, data);
});
@@ -122,28 +122,28 @@ BuildThreadsSection(Process &process, FileSpec directory) {
return json_threads;
}
-static llvm::Expected<llvm::Optional<std::vector<JSONCore>>>
-BuildCoresSection(TraceIntelPT &trace_ipt, FileSpec directory) {
- if (trace_ipt.GetTracedCores().empty())
+static llvm::Expected<llvm::Optional<std::vector<JSONCpu>>>
+BuildCpusSection(TraceIntelPT &trace_ipt, FileSpec directory) {
+ if (trace_ipt.GetTracedCpus().empty())
return None;
- std::vector<JSONCore> json_cores;
- FileSpec cores_dir = directory;
- cores_dir.AppendPathComponent("cores");
- sys::fs::create_directories(cores_dir.GetCString());
+ std::vector<JSONCpu> json_cpus;
+ FileSpec cpus_dir = directory;
+ cpus_dir.AppendPathComponent("cpus");
+ sys::fs::create_directories(cpus_dir.GetCString());
- for (lldb::core_id_t core_id : trace_ipt.GetTracedCores()) {
- JSONCore json_core;
- json_core.core_id = core_id;
+ for (lldb::cpu_id_t cpu_id : trace_ipt.GetTracedCpus()) {
+ JSONCpu json_cpu;
+ json_cpu.id = cpu_id;
{
- FileSpec output_trace = cores_dir;
- output_trace.AppendPathComponent(std::to_string(core_id) +
+ FileSpec output_trace = cpus_dir;
+ output_trace.AppendPathComponent(std::to_string(cpu_id) +
".intelpt_trace");
- json_core.trace_buffer = output_trace.GetPath();
+ json_cpu.ipt_trace = output_trace.GetPath();
- llvm::Error err = trace_ipt.OnCoreBinaryDataRead(
- core_id, IntelPTDataKinds::kTraceBuffer,
+ llvm::Error err = trace_ipt.OnCpuBinaryDataRead(
+ cpu_id, IntelPTDataKinds::kIptTrace,
[&](llvm::ArrayRef<uint8_t> data) -> llvm::Error {
return WriteBytesToDisk(output_trace, data);
});
@@ -152,22 +152,22 @@ BuildCoresSection(TraceIntelPT &trace_ipt, FileSpec directory) {
}
{
- FileSpec output_context_switch_trace = cores_dir;
+ FileSpec output_context_switch_trace = cpus_dir;
output_context_switch_trace.AppendPathComponent(
- std::to_string(core_id) + ".perf_context_switch_trace");
- json_core.context_switch_trace = output_context_switch_trace.GetPath();
+ std::to_string(cpu_id) + ".perf_context_switch_trace");
+ json_cpu.context_switch_trace = output_context_switch_trace.GetPath();
- llvm::Error err = trace_ipt.OnCoreBinaryDataRead(
- core_id, IntelPTDataKinds::kPerfContextSwitchTrace,
+ llvm::Error err = trace_ipt.OnCpuBinaryDataRead(
+ cpu_id, IntelPTDataKinds::kPerfContextSwitchTrace,
[&](llvm::ArrayRef<uint8_t> data) -> llvm::Error {
return WriteBytesToDisk(output_context_switch_trace, data);
});
if (err)
return std::move(err);
}
- json_cores.push_back(std::move(json_core));
+ json_cpus.push_back(std::move(json_cpu));
}
- return json_cores;
+ return json_cpus;
}
/// Build modules sub-section of the trace's session. The original modules
@@ -298,13 +298,13 @@ Error TraceIntelPTSessionSaver::SaveToDisk(TraceIntelPT &trace_ipt,
if (!json_processes)
return json_processes.takeError();
- Expected<Optional<std::vector<JSONCore>>> json_cores =
- BuildCoresSection(trace_ipt, directory);
- if (!json_cores)
- return json_cores.takeError();
+ Expected<Optional<std::vector<JSONCpu>>> json_cpus =
+ BuildCpusSection(trace_ipt, directory);
+ if (!json_cpus)
+ return json_cpus.takeError();
JSONTraceSession json_intel_pt_session{"intel-pt", *cpu_info, *json_processes,
- *json_cores,
+ *json_cpus,
trace_ipt.GetPerfZeroTscConversion()};
return WriteSessionToFile(toJSON(json_intel_pt_session), directory);
diff --git a/lldb/source/Target/Trace.cpp b/lldb/source/Target/Trace.cpp
index a65f23fdb324d..88122d6f4f650 100644
--- a/lldb/source/Target/Trace.cpp
+++ b/lldb/source/Target/Trace.cpp
@@ -162,10 +162,10 @@ Optional<uint64_t> Trace::GetLiveThreadBinaryDataSize(lldb::tid_t tid,
return Lookup2(storage.live_thread_data, tid, ConstString(kind));
}
-Optional<uint64_t> Trace::GetLiveCoreBinaryDataSize(lldb::core_id_t core_id,
- llvm::StringRef kind) {
+Optional<uint64_t> Trace::GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id,
+ llvm::StringRef kind) {
Storage &storage = GetUpdatedStorage();
- return Lookup2(storage.live_core_data_sizes, core_id, ConstString(kind));
+ return Lookup2(storage.live_cpu_data_sizes, cpu_id, ConstString(kind));
}
Optional<uint64_t> Trace::GetLiveProcessBinaryDataSize(llvm::StringRef kind) {
@@ -180,8 +180,8 @@ Trace::GetLiveTraceBinaryData(const TraceGetBinaryDataRequest &request,
return createStringError(
inconvertibleErrorCode(),
formatv("Attempted to fetch live trace data without a live process. "
- "Data kind = {0}, tid = {1}, core id = {2}.",
- request.kind, request.tid, request.core_id));
+ "Data kind = {0}, tid = {1}, cpu id = {2}.",
+ request.kind, request.tid, request.cpu_id));
Expected<std::vector<uint8_t>> data =
m_live_process->TraceGetBinaryData(request);
@@ -193,9 +193,9 @@ Trace::GetLiveTraceBinaryData(const TraceGetBinaryDataRequest &request,
return createStringError(
inconvertibleErrorCode(),
formatv("Got incomplete live trace data. Data kind = {0}, expected "
- "size = {1}, actual size = {2}, tid = {3}, core id = {4}",
+ "size = {1}, actual size = {2}, tid = {3}, cpu id = {4}",
request.kind, expected_size, data->size(), request.tid,
- request.core_id));
+ request.cpu_id));
return data;
}
@@ -210,25 +210,25 @@ Trace::GetLiveThreadBinaryData(lldb::tid_t tid, llvm::StringRef kind) {
kind.data(), tid);
TraceGetBinaryDataRequest request{GetPluginName().str(), kind.str(), tid,
- /*core_id=*/None};
+ /*cpu_id=*/None};
return GetLiveTraceBinaryData(request, *size);
}
Expected<std::vector<uint8_t>>
-Trace::GetLiveCoreBinaryData(lldb::core_id_t core_id, llvm::StringRef kind) {
+Trace::GetLiveCpuBinaryData(lldb::cpu_id_t cpu_id, llvm::StringRef kind) {
if (!m_live_process)
return createStringError(
inconvertibleErrorCode(),
"Attempted to fetch live cpu data without a live process.");
- llvm::Optional<uint64_t> size = GetLiveCoreBinaryDataSize(core_id, kind);
+ llvm::Optional<uint64_t> size = GetLiveCpuBinaryDataSize(cpu_id, kind);
if (!size)
return createStringError(
inconvertibleErrorCode(),
- "Tracing data \"%s\" is not available for core_id %" PRIu64 ".",
- kind.data(), core_id);
+ "Tracing data \"%s\" is not available for cpu_id %" PRIu64 ".",
+ kind.data(), cpu_id);
TraceGetBinaryDataRequest request{GetPluginName().str(), kind.str(),
- /*tid=*/None, core_id};
+ /*tid=*/None, cpu_id};
return m_live_process->TraceGetBinaryData(request);
}
@@ -241,7 +241,7 @@ Trace::GetLiveProcessBinaryData(llvm::StringRef kind) {
"Tracing data \"%s\" is not available for the process.", kind.data());
TraceGetBinaryDataRequest request{GetPluginName().str(), kind.str(),
- /*tid=*/None, /*core_id*/ None};
+ /*tid=*/None, /*cpu_id*/ None};
return GetLiveTraceBinaryData(request, *size);
}
@@ -290,16 +290,16 @@ const char *Trace::RefreshLiveProcessState() {
LLDB_LOG(log, "== Found {0} threads being traced",
live_process_state->traced_threads.size());
- if (live_process_state->cores) {
- m_storage.cores.emplace();
- for (const TraceCoreState &core_state : *live_process_state->cores) {
- m_storage.cores->push_back(core_state.core_id);
- for (const TraceBinaryData &item : core_state.binary_data)
- m_storage.live_core_data_sizes[core_state.core_id].insert(
+ if (live_process_state->cpus) {
+ m_storage.cpus.emplace();
+ for (const TraceCpuState &cpu_state : *live_process_state->cpus) {
+ m_storage.cpus->push_back(cpu_state.id);
+ for (const TraceBinaryData &item : cpu_state.binary_data)
+ m_storage.live_cpu_data_sizes[cpu_state.id].insert(
{ConstString(item.kind), item.size});
}
- LLDB_LOG(log, "== Found {0} cpu cores being traced",
- live_process_state->cores->size());
+ LLDB_LOG(log, "== Found {0} cpu cpus being traced",
+ live_process_state->cpus->size());
}
for (const TraceBinaryData &item : live_process_state->process_binary_data)
@@ -318,10 +318,10 @@ const char *Trace::RefreshLiveProcessState() {
}
Trace::Trace(ArrayRef<ProcessSP> postmortem_processes,
- Optional<std::vector<lldb::core_id_t>> postmortem_cores) {
+ Optional<std::vector<lldb::cpu_id_t>> postmortem_cpus) {
for (ProcessSP process_sp : postmortem_processes)
m_storage.postmortem_processes.push_back(process_sp.get());
- m_storage.cores = postmortem_cores;
+ m_storage.cpus = postmortem_cpus;
}
Process *Trace::GetLiveProcess() { return m_live_process; }
@@ -354,18 +354,17 @@ Trace::GetPostMortemThreadDataFile(lldb::tid_t tid, llvm::StringRef kind) {
tid, kind));
}
-llvm::Expected<FileSpec>
-Trace::GetPostMortemCoreDataFile(lldb::core_id_t core_id,
- llvm::StringRef kind) {
+llvm::Expected<FileSpec> Trace::GetPostMortemCpuDataFile(lldb::cpu_id_t cpu_id,
+ llvm::StringRef kind) {
Storage &storage = GetUpdatedStorage();
if (Optional<FileSpec> file =
- Lookup2(storage.postmortem_core_data, core_id, ConstString(kind)))
+ Lookup2(storage.postmortem_cpu_data, cpu_id, ConstString(kind)))
return *file;
else
return createStringError(
inconvertibleErrorCode(),
- formatv("The core with id={0} doesn't have the tracing data {1}",
- core_id, kind));
+ formatv("The cpu with id={0} doesn't have the tracing data {1}", cpu_id,
+ kind));
}
void Trace::SetPostMortemThreadDataFile(lldb::tid_t tid, llvm::StringRef kind,
@@ -374,11 +373,10 @@ void Trace::SetPostMortemThreadDataFile(lldb::tid_t tid, llvm::StringRef kind,
storage.postmortem_thread_data[tid].insert({ConstString(kind), file_spec});
}
-void Trace::SetPostMortemCoreDataFile(lldb::core_id_t core_id,
- llvm::StringRef kind,
- FileSpec file_spec) {
+void Trace::SetPostMortemCpuDataFile(lldb::cpu_id_t cpu_id,
+ llvm::StringRef kind, FileSpec file_spec) {
Storage &storage = GetUpdatedStorage();
- storage.postmortem_core_data[core_id].insert({ConstString(kind), file_spec});
+ storage.postmortem_cpu_data[cpu_id].insert({ConstString(kind), file_spec});
}
llvm::Error
@@ -390,18 +388,18 @@ Trace::OnLiveThreadBinaryDataRead(lldb::tid_t tid, llvm::StringRef kind,
return callback(*data);
}
-llvm::Error Trace::OnLiveCoreBinaryDataRead(lldb::core_id_t core_id,
- llvm::StringRef kind,
- OnBinaryDataReadCallback callback) {
+llvm::Error Trace::OnLiveCpuBinaryDataRead(lldb::cpu_id_t cpu_id,
+ llvm::StringRef kind,
+ OnBinaryDataReadCallback callback) {
Storage &storage = GetUpdatedStorage();
- if (std::vector<uint8_t> *core_data =
- Lookup2AsPtr(storage.live_core_data, core_id, ConstString(kind)))
- return callback(*core_data);
+ if (std::vector<uint8_t> *cpu_data =
+ Lookup2AsPtr(storage.live_cpu_data, cpu_id, ConstString(kind)))
+ return callback(*cpu_data);
- Expected<std::vector<uint8_t>> data = GetLiveCoreBinaryData(core_id, kind);
+ Expected<std::vector<uint8_t>> data = GetLiveCpuBinaryData(cpu_id, kind);
if (!data)
return data.takeError();
- auto it = storage.live_core_data[core_id].insert(
+ auto it = storage.live_cpu_data[cpu_id].insert(
{ConstString(kind), std::move(*data)});
return callback(it.first->second);
}
@@ -432,10 +430,10 @@ Trace::OnPostMortemThreadBinaryDataRead(lldb::tid_t tid, llvm::StringRef kind,
}
llvm::Error
-Trace::OnPostMortemCoreBinaryDataRead(lldb::core_id_t core_id,
- llvm::StringRef kind,
- OnBinaryDataReadCallback callback) {
- if (Expected<FileSpec> file = GetPostMortemCoreDataFile(core_id, kind))
+Trace::OnPostMortemCpuBinaryDataRead(lldb::cpu_id_t cpu_id,
+ llvm::StringRef kind,
+ OnBinaryDataReadCallback callback) {
+ if (Expected<FileSpec> file = GetPostMortemCpuDataFile(cpu_id, kind))
return OnDataFileRead(*file, callback);
else
return file.takeError();
@@ -450,42 +448,42 @@ llvm::Error Trace::OnThreadBinaryDataRead(lldb::tid_t tid, llvm::StringRef kind,
}
llvm::Error
-Trace::OnAllCoresBinaryDataRead(llvm::StringRef kind,
- OnCoresBinaryDataReadCallback callback) {
- DenseMap<core_id_t, ArrayRef<uint8_t>> buffers;
+Trace::OnAllCpusBinaryDataRead(llvm::StringRef kind,
+ OnCpusBinaryDataReadCallback callback) {
+ DenseMap<cpu_id_t, ArrayRef<uint8_t>> buffers;
Storage &storage = GetUpdatedStorage();
- if (!storage.cores)
+ if (!storage.cpus)
return Error::success();
- std::function<Error(std::vector<core_id_t>::iterator)> process_core =
- [&](std::vector<core_id_t>::iterator core_id) -> Error {
- if (core_id == storage.cores->end())
+ std::function<Error(std::vector<cpu_id_t>::iterator)> process_cpu =
+ [&](std::vector<cpu_id_t>::iterator cpu_id) -> Error {
+ if (cpu_id == storage.cpus->end())
return callback(buffers);
- return OnCoreBinaryDataRead(*core_id, kind,
- [&](ArrayRef<uint8_t> data) -> Error {
- buffers.try_emplace(*core_id, data);
- auto next_id = core_id;
- next_id++;
- return process_core(next_id);
- });
+ return OnCpuBinaryDataRead(*cpu_id, kind,
+ [&](ArrayRef<uint8_t> data) -> Error {
+ buffers.try_emplace(*cpu_id, data);
+ auto next_id = cpu_id;
+ next_id++;
+ return process_cpu(next_id);
+ });
};
- return process_core(storage.cores->begin());
+ return process_cpu(storage.cpus->begin());
}
-llvm::Error Trace::OnCoreBinaryDataRead(lldb::core_id_t core_id,
- llvm::StringRef kind,
- OnBinaryDataReadCallback callback) {
+llvm::Error Trace::OnCpuBinaryDataRead(lldb::cpu_id_t cpu_id,
+ llvm::StringRef kind,
+ OnBinaryDataReadCallback callback) {
if (m_live_process)
- return OnLiveCoreBinaryDataRead(core_id, kind, callback);
+ return OnLiveCpuBinaryDataRead(cpu_id, kind, callback);
else
- return OnPostMortemCoreBinaryDataRead(core_id, kind, callback);
+ return OnPostMortemCpuBinaryDataRead(cpu_id, kind, callback);
}
-ArrayRef<lldb::core_id_t> Trace::GetTracedCores() {
+ArrayRef<lldb::cpu_id_t> Trace::GetTracedCpus() {
Storage &storage = GetUpdatedStorage();
- if (storage.cores)
- return *storage.cores;
+ if (storage.cpus)
+ return *storage.cpus;
return {};
}
diff --git a/lldb/source/Utility/TraceGDBRemotePackets.cpp b/lldb/source/Utility/TraceGDBRemotePackets.cpp
index cea4099d1c3f2..9879b7b2cb797 100644
--- a/lldb/source/Utility/TraceGDBRemotePackets.cpp
+++ b/lldb/source/Utility/TraceGDBRemotePackets.cpp
@@ -100,14 +100,13 @@ bool fromJSON(const json::Value &value, TraceGetStateResponse &packet,
ObjectMapper o(value, path);
return o && o.map("tracedThreads", packet.traced_threads) &&
o.map("processBinaryData", packet.process_binary_data) &&
- o.map("cores", packet.cores) &&
- o.map("warnings", packet.warnings);
+ o.map("cpus", packet.cpus) && o.map("warnings", packet.warnings);
}
json::Value toJSON(const TraceGetStateResponse &packet) {
return json::Value(Object{{"tracedThreads", packet.traced_threads},
{"processBinaryData", packet.process_binary_data},
- {"cores", packet.cores},
+ {"cpus", packet.cpus},
{"warnings", packet.warnings}});
}
@@ -117,20 +116,19 @@ void TraceGetStateResponse::AddWarning(StringRef warning) {
warnings->push_back(warning.data());
}
-bool fromJSON(const json::Value &value, TraceCoreState &packet,
+bool fromJSON(const json::Value &value, TraceCpuState &packet,
json::Path path) {
ObjectMapper o(value, path);
- uint64_t core_id;
- if (!(o && o.map("coreId", core_id) &&
- o.map("binaryData", packet.binary_data)))
+ uint64_t cpu_id;
+ if (!(o && o.map("id", cpu_id) && o.map("binaryData", packet.binary_data)))
return false;
- packet.core_id = static_cast<lldb::core_id_t>(core_id);
+ packet.id = static_cast<lldb::cpu_id_t>(cpu_id);
return true;
}
-json::Value toJSON(const TraceCoreState &packet) {
+json::Value toJSON(const TraceCpuState &packet) {
return json::Value(
- Object{{"coreId", packet.core_id}, {"binaryData", packet.binary_data}});
+ Object{{"id", packet.id}, {"binaryData", packet.binary_data}});
}
/// \}
@@ -140,19 +138,19 @@ json::Value toJSON(const TraceGetBinaryDataRequest &packet) {
return json::Value(Object{{"type", packet.type},
{"kind", packet.kind},
{"tid", packet.tid},
- {"coreId", packet.core_id}});
+ {"cpuId", packet.cpu_id}});
}
bool fromJSON(const json::Value &value, TraceGetBinaryDataRequest &packet,
Path path) {
ObjectMapper o(value, path);
- Optional<uint64_t> core_id;
+ Optional<uint64_t> cpu_id;
if (!(o && o.map("type", packet.type) && o.map("kind", packet.kind) &&
- o.map("tid", packet.tid) && o.map("coreId", core_id)))
+ o.map("tid", packet.tid) && o.map("cpuId", cpu_id)))
return false;
- if (core_id)
- packet.core_id = static_cast<lldb::core_id_t>(*core_id);
+ if (cpu_id)
+ packet.cpu_id = static_cast<lldb::cpu_id_t>(*cpu_id);
return true;
}
/// \}
diff --git a/lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp b/lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp
index 985480a08a42e..a168bf030c6b0 100644
--- a/lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp
+++ b/lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp
@@ -14,12 +14,12 @@ using namespace llvm::json;
namespace lldb_private {
const char *IntelPTDataKinds::kProcFsCpuInfo = "procfsCpuInfo";
-const char *IntelPTDataKinds::kTraceBuffer = "traceBuffer";
+const char *IntelPTDataKinds::kIptTrace = "iptTrace";
const char *IntelPTDataKinds::kPerfContextSwitchTrace =
"perfContextSwitchTrace";
-bool TraceIntelPTStartRequest::IsPerCoreTracing() const {
- return per_core_tracing.getValueOr(false);
+bool TraceIntelPTStartRequest::IsPerCpuTracing() const {
+ return per_cpu_tracing.getValueOr(false);
}
bool fromJSON(const json::Value &value, TraceIntelPTStartRequest &packet,
@@ -28,12 +28,12 @@ bool fromJSON(const json::Value &value, TraceIntelPTStartRequest &packet,
if (!o || !fromJSON(value, (TraceStartRequest &)packet, path) ||
!o.map("enableTsc", packet.enable_tsc) ||
!o.map("psbPeriod", packet.psb_period) ||
- !o.map("traceBufferSize", packet.trace_buffer_size))
+ !o.map("iptTraceSize", packet.ipt_trace_size))
return false;
if (packet.IsProcessTracing()) {
if (!o.map("processBufferSizeLimit", packet.process_buffer_size_limit) ||
- !o.map("perCoreTracing", packet.per_core_tracing))
+ !o.map("perCpuTracing", packet.per_cpu_tracing))
return false;
}
return true;
@@ -42,11 +42,11 @@ bool fromJSON(const json::Value &value, TraceIntelPTStartRequest &packet,
json::Value toJSON(const TraceIntelPTStartRequest &packet) {
json::Value base = toJSON((const TraceStartRequest &)packet);
json::Object &obj = *base.getAsObject();
- obj.try_emplace("traceBufferSize", packet.trace_buffer_size);
+ obj.try_emplace("iptTraceSize", packet.ipt_trace_size);
obj.try_emplace("processBufferSizeLimit", packet.process_buffer_size_limit);
obj.try_emplace("psbPeriod", packet.psb_period);
obj.try_emplace("enableTsc", packet.enable_tsc);
- obj.try_emplace("perCoreTracing", packet.per_core_tracing);
+ obj.try_emplace("perCpuTracing", packet.per_cpu_tracing);
return base;
}
diff --git a/lldb/test/API/commands/trace/TestTraceSave.py b/lldb/test/API/commands/trace/TestTraceSave.py
index 9b82e636d0ae6..f7752abee44e0 100644
--- a/lldb/test/API/commands/trace/TestTraceSave.py
+++ b/lldb/test/API/commands/trace/TestTraceSave.py
@@ -62,18 +62,18 @@ def testSaveWhenNotLiveTrace(self):
self.expect("process trace save -d " +
os.path.join(self.getBuildDir(), "intelpt-trace", "trace_not_live_dir"))
- def testSaveMultiCoreTrace(self):
+ def testSaveMultiCpuTrace(self):
'''
- This test starts a per-core tracing session, then saves the session to disk, and
+ This test starts a per-cpu tracing session, then saves the session to disk, and
finally it loads it again.
'''
- self.skipIfPerCoreTracingIsNotSupported()
+ self.skipIfPerCpuTracingIsNotSupported()
self.expect("target create " +
os.path.join(self.getSourceDir(), "intelpt-trace", "a.out"))
self.expect("b main")
self.expect("r")
- self.expect("process trace start --per-core-tracing")
+ self.expect("process trace start --per-cpu-tracing")
self.expect("b 7")
output_dir = os.path.join(self.getBuildDir(), "intelpt-trace", "trace_save")
@@ -84,14 +84,14 @@ def checkSessionBundle(session_file_path):
session = json.load(session_file)
# We expect tsc conversion info
self.assertTrue("tscPerfZeroConversion" in session)
- # We expect at least one core
- self.assertGreater(len(session["cores"]), 0)
+ # We expect at least one cpu
+ self.assertGreater(len(session["cpus"]), 0)
# We expect the required trace files to be created
- for core in session["cores"]:
- core_files_prefix = os.path.join(output_dir, "cores", str(core["coreId"]))
- self.assertTrue(os.path.exists(core_files_prefix + ".intelpt_trace"))
- self.assertTrue(os.path.exists(core_files_prefix + ".perf_context_switch_trace"))
+ for cpu in session["cpus"]:
+ cpu_files_prefix = os.path.join(output_dir, "cpus", str(cpu["id"]))
+ self.assertTrue(os.path.exists(cpu_files_prefix + ".intelpt_trace"))
+ self.assertTrue(os.path.exists(cpu_files_prefix + ".perf_context_switch_trace"))
# We expect at least one one process
self.assertGreater(len(session["processes"]), 0)
@@ -100,7 +100,7 @@ def checkSessionBundle(session_file_path):
self.assertGreater(len(process["threads"]), 0)
# We don't expect thread traces
for thread in process["threads"]:
- self.assertTrue(("traceBuffer" not in thread) or (thread["traceBuffer"] is None))
+ self.assertTrue(("iptTrace" not in thread) or (thread["iptTrace"] is None))
original_trace_session_file = os.path.join(output_dir, "trace.json")
checkSessionBundle(original_trace_session_file)
@@ -130,9 +130,9 @@ def checkSessionBundle(session_file_path):
copied_thread = find(lambda thr : thr["tid"] == thread["tid"], copied_process["threads"])
self.assertTrue(copied_thread is not None)
- for core in original["cores"]:
- copied_core = find(lambda cor : cor["coreId"] == core["coreId"], copy["cores"])
- self.assertTrue(copied_core is not None)
+ for cpu in original["cpus"]:
+ copied_cpu = find(lambda cor : cor["id"] == cpu["id"], copy["cpus"])
+ self.assertTrue(copied_cpu is not None)
def testSaveTrace(self):
self.expect("target create " +
diff --git a/lldb/test/API/commands/trace/TestTraceSchema.py b/lldb/test/API/commands/trace/TestTraceSchema.py
index 8ba2809537b7a..368fd6a7e98bd 100644
--- a/lldb/test/API/commands/trace/TestTraceSchema.py
+++ b/lldb/test/API/commands/trace/TestTraceSchema.py
@@ -9,7 +9,7 @@ class TestTraceLoad(TraceIntelPTTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
def testSchema(self):
- self.expect("trace schema intel-pt", substrs=["triple", "threads", "traceBuffer"])
+ self.expect("trace schema intel-pt", substrs=["triple", "threads", "iptTrace"])
def testInvalidPluginSchema(self):
self.expect("trace schema invalid-plugin", error=True,
diff --git a/lldb/test/API/commands/trace/TestTraceStartStop.py b/lldb/test/API/commands/trace/TestTraceStartStop.py
index 294ba96cf013e..f4b5c0950acd2 100644
--- a/lldb/test/API/commands/trace/TestTraceStartStop.py
+++ b/lldb/test/API/commands/trace/TestTraceStartStop.py
@@ -35,18 +35,18 @@ def testStartSessionWithWrongSize(self):
self.expect("r")
self.traceStartThread(
- error=True, traceBufferSize=2000,
- substrs=["The trace buffer size must be a power of 2", "It was 2000"])
+ error=True, iptTraceSize=2000,
+ substrs=["The intel pt trace size must be a power of 2", "It was 2000"])
self.traceStartThread(
- error=True, traceBufferSize=5000,
- substrs=["The trace buffer size must be a power of 2", "It was 5000"])
+ error=True, iptTraceSize=5000,
+ substrs=["The intel pt trace size must be a power of 2", "It was 5000"])
self.traceStartThread(
- error=True, traceBufferSize=0,
- substrs=["The trace buffer size must be a power of 2", "It was 0"])
+ error=True, iptTraceSize=0,
+ substrs=["The intel pt trace size must be a power of 2", "It was 0"])
- self.traceStartThread(traceBufferSize=1048576)
+ self.traceStartThread(iptTraceSize=1048576)
@skipIf(oslist=no_match(['linux']), archs=no_match(['i386', 'x86_64']))
def testSBAPIHelp(self):
@@ -55,7 +55,7 @@ def testSBAPIHelp(self):
self.expect("r")
help = self.getTraceOrCreate().GetStartConfigurationHelp()
- self.assertIn("traceBufferSize", help)
+ self.assertIn("iptTraceSize", help)
self.assertIn("processBufferSizeLimit", help)
@skipIf(oslist=no_match(['linux']), archs=no_match(['i386', 'x86_64']))
diff --git a/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json b/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json
index b8e77d7c4373b..08246879e889b 100644
--- a/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json
+++ b/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json
@@ -1,14 +1,14 @@
{
- "cores": [
+ "cpus": [
{
"contextSwitchTrace": "cores/45.perf_context_switch_trace",
- "coreId": 45,
- "traceBuffer": "cores/45.intelpt_trace"
+ "id": 45,
+ "iptTrace": "cores/45.intelpt_trace"
},
{
"contextSwitchTrace": "cores/51.perf_context_switch_trace",
- "coreId": 51,
- "traceBuffer": "cores/51.intelpt_trace"
+ "id": 51,
+ "iptTrace": "cores/51.intelpt_trace"
}
],
"cpuInfo": {
diff --git a/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace_missing_threads.json b/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace_missing_threads.json
index e77fb87abb9b1..e3f684d4deb4f 100644
--- a/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace_missing_threads.json
+++ b/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace_missing_threads.json
@@ -1,14 +1,14 @@
{
- "cores": [
+ "cpus": [
{
"contextSwitchTrace": "cores/45.perf_context_switch_trace",
- "coreId": 45,
- "traceBuffer": "cores/45.intelpt_trace"
+ "id": 45,
+ "iptTrace": "cores/45.intelpt_trace"
},
{
"contextSwitchTrace": "cores/51.perf_context_switch_trace",
- "coreId": 51,
- "traceBuffer": "cores/51.intelpt_trace"
+ "id": 51,
+ "iptTrace": "cores/51.intelpt_trace"
}
],
"cpuInfo": {
diff --git a/lldb/test/API/commands/trace/intelpt-trace-multi-file/multi-file-no-ld.json b/lldb/test/API/commands/trace/intelpt-trace-multi-file/multi-file-no-ld.json
index 6b44b92edd58e..1b4fa6983f02c 100644
--- a/lldb/test/API/commands/trace/intelpt-trace-multi-file/multi-file-no-ld.json
+++ b/lldb/test/API/commands/trace/intelpt-trace-multi-file/multi-file-no-ld.json
@@ -13,7 +13,7 @@
"threads": [
{
"tid": 815455,
- "traceBuffer": "multi-file.trace"
+ "iptTrace": "multi-file.trace"
}
],
"modules": [
diff --git a/lldb/test/API/commands/trace/intelpt-trace/trace.json b/lldb/test/API/commands/trace/intelpt-trace/trace.json
index d284817591094..28beed0708231 100644
--- a/lldb/test/API/commands/trace/intelpt-trace/trace.json
+++ b/lldb/test/API/commands/trace/intelpt-trace/trace.json
@@ -13,7 +13,7 @@
"threads": [
{
"tid": 3842849,
- "traceBuffer": "3842849.trace"
+ "iptTrace": "3842849.trace"
}
],
"modules": [
diff --git a/lldb/test/API/commands/trace/intelpt-trace/trace_2threads.json b/lldb/test/API/commands/trace/intelpt-trace/trace_2threads.json
index 5bd3d35ec08b6..6c89842c6f727 100644
--- a/lldb/test/API/commands/trace/intelpt-trace/trace_2threads.json
+++ b/lldb/test/API/commands/trace/intelpt-trace/trace_2threads.json
@@ -13,11 +13,11 @@
"threads": [
{
"tid": 3842849,
- "traceBuffer": "3842849.trace"
+ "iptTrace": "3842849.trace"
},
{
"tid": 3842850,
- "traceBuffer": "3842849.trace"
+ "iptTrace": "3842849.trace"
}
],
"modules": [
diff --git a/lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json b/lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
index 98d322fb39b58..380388da5bbb6 100644
--- a/lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
+++ b/lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
@@ -12,7 +12,7 @@
"threads": [
{
"tid": 5678,
- "traceBuffer": "3842849.trace"
+ "iptTrace": "3842849.trace"
}
],
"modules": [
@@ -29,7 +29,7 @@
"threads": [
{
"tid": 56789,
- "traceBuffer": "3842849.trace"
+ "iptTrace": "3842849.trace"
}
],
"modules": []
diff --git a/lldb/test/API/commands/trace/intelpt-trace/trace_bad3.json b/lldb/test/API/commands/trace/intelpt-trace/trace_bad3.json
index ae33077c8ff09..9f32867275a16 100644
--- a/lldb/test/API/commands/trace/intelpt-trace/trace_bad3.json
+++ b/lldb/test/API/commands/trace/intelpt-trace/trace_bad3.json
@@ -13,7 +13,7 @@
"threads": [
{
"tid": 5678,
- "traceBuffer": "3842849.trace"
+ "iptTrace": "3842849.trace"
}
],
"modules": [
diff --git a/lldb/test/API/commands/trace/intelpt-trace/trace_bad5.json b/lldb/test/API/commands/trace/intelpt-trace/trace_bad5.json
index d70b176af878b..8ab8bf1fa7023 100644
--- a/lldb/test/API/commands/trace/intelpt-trace/trace_bad5.json
+++ b/lldb/test/API/commands/trace/intelpt-trace/trace_bad5.json
@@ -13,7 +13,7 @@
"threads": [
{
"tid": 5678,
- "traceBuffer": "3842849.trace"
+ "iptTrace": "3842849.trace"
}
],
"modules": [
diff --git a/lldb/test/API/commands/trace/intelpt-trace/trace_bad_image.json b/lldb/test/API/commands/trace/intelpt-trace/trace_bad_image.json
index 84e4bf783f021..88412fc00cd5b 100644
--- a/lldb/test/API/commands/trace/intelpt-trace/trace_bad_image.json
+++ b/lldb/test/API/commands/trace/intelpt-trace/trace_bad_image.json
@@ -13,7 +13,7 @@
"threads": [
{
"tid": 3842849,
- "traceBuffer": "3842849.trace"
+ "iptTrace": "3842849.trace"
}
],
"modules": [
diff --git a/lldb/test/API/commands/trace/intelpt-trace/trace_wrong_cpu.json b/lldb/test/API/commands/trace/intelpt-trace/trace_wrong_cpu.json
index e55af9f1cacc4..e1f27df3cefc7 100644
--- a/lldb/test/API/commands/trace/intelpt-trace/trace_wrong_cpu.json
+++ b/lldb/test/API/commands/trace/intelpt-trace/trace_wrong_cpu.json
@@ -13,7 +13,7 @@
"threads": [
{
"tid": 3842849,
- "traceBuffer": "3842849.trace"
+ "iptTrace": "3842849.trace"
}
],
"modules": [
diff --git a/lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py b/lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
index f33822ac4cadf..7c90c9a1ca50f 100644
--- a/lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
+++ b/lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
@@ -162,8 +162,8 @@ def testStartMultipleLiveThreadsWithSmallTotalLimit(self):
@skipIf(oslist=no_match(['linux']), archs=no_match(['i386', 'x86_64']))
@testSBAPIAndCommands
- def testStartPerCoreSession(self):
- self.skipIfPerCoreTracingIsNotSupported()
+ def testStartPerCpuSession(self):
+ self.skipIfPerCpuTracingIsNotSupported()
self.build()
exe = self.getBuildArtifact("a.out")
@@ -173,34 +173,34 @@ def testStartPerCoreSession(self):
self.expect("r")
# We should fail if we hit the total buffer limit. Useful if the number
- # of cores is huge.
+ # of cpus is huge.
self.traceStartProcess(error="True", processBufferSizeLimit=100,
- perCoreTracing=True,
+ perCpuTracing=True,
substrs=["The process can't be traced because the process trace size "
"limit has been reached. Consider retracing with a higher limit."])
- self.traceStartProcess(perCoreTracing=True)
+ self.traceStartProcess(perCpuTracing=True)
self.traceStopProcess()
- self.traceStartProcess(perCoreTracing=True)
- # We can't support multiple per-core tracing sessions.
- self.traceStartProcess(error=True, perCoreTracing=True,
+ self.traceStartProcess(perCpuTracing=True)
+ # We can't support multiple per-cpu tracing sessions.
+ self.traceStartProcess(error=True, perCpuTracing=True,
substrs=["Process currently traced. Stop process tracing first"])
- # We can't support tracing per thread is per core is enabled.
+ # We can't support tracing per thread is per cpu is enabled.
self.traceStartThread(
error="True",
substrs=["Thread with tid ", "is currently traced"])
- # We can't stop individual thread when per core is enabled.
+ # We can't stop individual thread when per cpu is enabled.
self.traceStopThread(error="True",
- substrs=["Can't stop tracing an individual thread when per-core process tracing is enabled"])
+ substrs=["Can't stop tracing an individual thread when per-cpu process tracing is enabled"])
# We move forward a little bit to collect some data
self.expect("b 19")
self.expect("c")
- # We will assert that the trace state will contain valid context switch and trace buffer entries.
+ # We will assert that the trace state will contain valid context switch and intel pt trace buffer entries.
# Besides that, we need to get tsc-to-nanos conversion information.
# We first parse the json response from the custom packet
@@ -213,20 +213,20 @@ def testStartPerCoreSession(self):
output = json.loads(response)
self.assertTrue(output is not None)
- self.assertIn("cores", output)
+ self.assertIn("cpus", output)
self.assertIn("tscPerfZeroConversion", output)
found_non_empty_context_switch = False
- for core in output["cores"]:
+ for cpu in output["cpus"]:
context_switch_size = None
- trace_buffer_size = None
- for binary_data in core["binaryData"]:
- if binary_data["kind"] == "traceBuffer":
- trace_buffer_size = binary_data["size"]
+ ipt_trace_size = None
+ for binary_data in cpu["binaryData"]:
+ if binary_data["kind"] == "iptTrace":
+ ipt_trace_size = binary_data["size"]
elif binary_data["kind"] == "perfContextSwitchTrace":
context_switch_size = binary_data["size"]
self.assertTrue(context_switch_size is not None)
- self.assertTrue(trace_buffer_size is not None)
+ self.assertTrue(ipt_trace_size is not None)
if context_switch_size > 0:
found_non_empty_context_switch = True
diff --git a/lldb/unittests/Process/Linux/ProcfsTests.cpp b/lldb/unittests/Process/Linux/ProcfsTests.cpp
index e11ef728449d9..c069091b7b065 100644
--- a/lldb/unittests/Process/Linux/ProcfsTests.cpp
+++ b/lldb/unittests/Process/Linux/ProcfsTests.cpp
@@ -18,7 +18,7 @@ using namespace process_linux;
using namespace llvm;
TEST(Perf, HardcodedLogicalCoreIDs) {
- Expected<std::vector<lldb::core_id_t>> core_ids =
+ Expected<std::vector<lldb::cpu_id_t>> cpu_ids =
GetAvailableLogicalCoreIDs(R"(processor : 13
vendor_id : GenuineIntel
cpu family : 6
@@ -87,8 +87,8 @@ apicid : 121
power management:
)");
- ASSERT_TRUE((bool)core_ids);
- ASSERT_THAT(*core_ids, ::testing::ElementsAre(13, 24, 35, 79));
+ ASSERT_TRUE((bool)cpu_ids);
+ ASSERT_THAT(*cpu_ids, ::testing::ElementsAre(13, 24, 35, 79));
}
TEST(Perf, RealLogicalCoreIDs) {
@@ -98,7 +98,7 @@ TEST(Perf, RealLogicalCoreIDs) {
GTEST_SKIP() << toString(buffer_or_error.takeError());
// At this point we shouldn't fail parsing the core ids
- Expected<ArrayRef<lldb::core_id_t>> core_ids = GetAvailableLogicalCoreIDs();
- ASSERT_TRUE((bool)core_ids);
- ASSERT_GT((int)core_ids->size(), 0) << "We must see at least one core";
+ Expected<ArrayRef<lldb::cpu_id_t>> cpu_ids = GetAvailableLogicalCoreIDs();
+ ASSERT_TRUE((bool)cpu_ids);
+ ASSERT_GT((int)cpu_ids->size(), 0) << "We must see at least one core";
}
More information about the lldb-commits
mailing list