[compiler-rt] r345798 - [XRay] Add CPU ID in Custom Event FDR Records
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 31 17:18:53 PDT 2018
Author: dberris
Date: Wed Oct 31 17:18:52 2018
New Revision: 345798
URL: http://llvm.org/viewvc/llvm-project?rev=345798&view=rev
Log:
[XRay] Add CPU ID in Custom Event FDR Records
Summary:
This change cuts across compiler-rt and llvm, to increment the FDR log
version number to 4, and include the CPU ID in the custom event records.
This is a step towards allowing us to change the `llvm::xray::Trace`
object to start representing both custom and typed events in the stream
of records. Follow-on changes will allow us to change the kinds of
records we're presenting in the stream of traces, to incorporate the
data in custom/typed events.
A follow-on change will handle the typed event case, where it may not
fit within the 15-byte buffer for metadata records.
This work is part of the larger effort to enable writing analysis and
processing tools using a common in-memory representation of the events
found in traces. The work will focus on porting existing tools in LLVM
to use the common representation and informing the design of a
library/framework for expressing trace event analysis as C++ programs.
Reviewers: mboerger, eizan
Subscribers: hiraditya, mgrang, llvm-commits
Differential Revision: https://reviews.llvm.org/D53920
Modified:
compiler-rt/trunk/lib/xray/xray_fdr_controller.h
compiler-rt/trunk/lib/xray/xray_fdr_log_writer.h
compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
Modified: compiler-rt/trunk/lib/xray/xray_fdr_controller.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_controller.h?rev=345798&r1=345797&r2=345798&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_controller.h (original)
+++ compiler-rt/trunk/lib/xray/xray_fdr_controller.h Wed Oct 31 17:18:52 2018
@@ -327,7 +327,7 @@ public:
LatestTSC = 0;
UndoableFunctionEnters = 0;
UndoableTailExits = 0;
- return W.writeCustomEvent(TSC, Event, EventSize);
+ return W.writeCustomEvent(TSC, CPU, Event, EventSize);
}
bool typedEvent(uint64_t TSC, uint16_t CPU, uint16_t EventType,
Modified: compiler-rt/trunk/lib/xray/xray_fdr_log_writer.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_log_writer.h?rev=345798&r1=345797&r2=345798&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_log_writer.h (original)
+++ compiler-rt/trunk/lib/xray/xray_fdr_log_writer.h Wed Oct 31 17:18:52 2018
@@ -110,9 +110,10 @@ public:
return true;
}
- bool writeCustomEvent(uint64_t TSC, const void *Event, int32_t EventSize) {
+ bool writeCustomEvent(uint64_t TSC, uint16_t CPU, const void *Event,
+ int32_t EventSize) {
writeMetadata<MetadataRecord::RecordKinds::CustomEventMarker>(EventSize,
- TSC);
+ TSC, CPU);
internal_memcpy(NextRecord, Event, EventSize);
NextRecord += EventSize;
atomic_fetch_add(&Buffer.Extents, EventSize, memory_order_acq_rel);
Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging.cc?rev=345798&r1=345797&r2=345798&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc Wed Oct 31 17:18:52 2018
@@ -148,7 +148,8 @@ static XRayFileHeader &fdrCommonHeaderIn
// Version 2 of the log writes the extents of the buffer, instead of
// relying on an end-of-buffer record.
// Version 3 includes PID metadata record
- H.Version = 3;
+ // Version 4 includes CPU data in the custom event records
+ H.Version = 4;
H.Type = FileTypes::FDR_LOG;
// Test for required CPU features and cache the cycle frequency
More information about the llvm-commits
mailing list