diff options
author | Dean Michael Berris <dberris@google.com> | 2018-11-01 00:18:52 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2018-11-01 00:18:52 +0000 |
commit | 6b67ff03002f39adf773f456aa4fd79bb22f3a04 (patch) | |
tree | 69edb04de2b575e8af2eaae3fae04c9d65fc8797 /compiler-rt/lib/xray | |
parent | d4891a1b7add681782e1e2ea8922facbf2c10f4c (diff) | |
download | bcm5719-llvm-6b67ff03002f39adf773f456aa4fd79bb22f3a04.tar.gz bcm5719-llvm-6b67ff03002f39adf773f456aa4fd79bb22f3a04.zip |
[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
llvm-svn: 345798
Diffstat (limited to 'compiler-rt/lib/xray')
-rw-r--r-- | compiler-rt/lib/xray/xray_fdr_controller.h | 2 | ||||
-rw-r--r-- | compiler-rt/lib/xray/xray_fdr_log_writer.h | 5 | ||||
-rw-r--r-- | compiler-rt/lib/xray/xray_fdr_logging.cc | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/compiler-rt/lib/xray/xray_fdr_controller.h b/compiler-rt/lib/xray/xray_fdr_controller.h index d3433080e60..65e19a589ff 100644 --- a/compiler-rt/lib/xray/xray_fdr_controller.h +++ b/compiler-rt/lib/xray/xray_fdr_controller.h @@ -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, diff --git a/compiler-rt/lib/xray/xray_fdr_log_writer.h b/compiler-rt/lib/xray/xray_fdr_log_writer.h index a703bca1064..b9e438e98dc 100644 --- a/compiler-rt/lib/xray/xray_fdr_log_writer.h +++ b/compiler-rt/lib/xray/xray_fdr_log_writer.h @@ -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); diff --git a/compiler-rt/lib/xray/xray_fdr_logging.cc b/compiler-rt/lib/xray/xray_fdr_logging.cc index 6e9633843ad..916ee603468 100644 --- a/compiler-rt/lib/xray/xray_fdr_logging.cc +++ b/compiler-rt/lib/xray/xray_fdr_logging.cc @@ -148,7 +148,8 @@ static XRayFileHeader &fdrCommonHeaderInfo() { // 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 |