diff options
author | Dean Michael Berris <dberris@google.com> | 2018-09-11 06:36:51 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2018-09-11 06:36:51 +0000 |
commit | d2c50408d42f718c305a46c9cc6503d9156ea4d9 (patch) | |
tree | fdd044d1aba6d02aa05c941f1b6d670aa605ae07 /llvm/lib/XRay/RecordInitializer.cpp | |
parent | 9aacaffd9833381ed3d5de32fbece02afe2bba5e (diff) | |
download | bcm5719-llvm-d2c50408d42f718c305a46c9cc6503d9156ea4d9.tar.gz bcm5719-llvm-d2c50408d42f718c305a46c9cc6503d9156ea4d9.zip |
[XRay] Add TSC to NewCPUId Records
Summary:
This more correctly reflects the data written by the FDR mode runtime.
This is a continuation of the work in D50441.
Reviewers: mboerger, eizan
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D51911
llvm-svn: 341905
Diffstat (limited to 'llvm/lib/XRay/RecordInitializer.cpp')
-rw-r--r-- | llvm/lib/XRay/RecordInitializer.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/XRay/RecordInitializer.cpp b/llvm/lib/XRay/RecordInitializer.cpp index de4e68bc966..7f9fd4c9627 100644 --- a/llvm/lib/XRay/RecordInitializer.cpp +++ b/llvm/lib/XRay/RecordInitializer.cpp @@ -61,13 +61,20 @@ Error RecordInitializer::visit(NewCPUIDRecord &R) { return createStringError(std::make_error_code(std::errc::bad_address), "Invalid offset for a new cpu id record (%d).", OffsetPtr); + auto BeginOffset = OffsetPtr; auto PreReadOffset = OffsetPtr; R.CPUId = E.getU16(&OffsetPtr); if (OffsetPtr == PreReadOffset) return createStringError(std::make_error_code(std::errc::bad_message), "Cannot read CPU id at offset %d.", OffsetPtr); - OffsetPtr += MetadataRecord::kMetadataBodySize - (OffsetPtr - PreReadOffset); + PreReadOffset = OffsetPtr; + R.TSC = E.getU64(&OffsetPtr); + if (OffsetPtr == PreReadOffset) + return createStringError(std::make_error_code(std::errc::bad_message), + "Cannot read CPU TSC at offset %d.", OffsetPtr); + + OffsetPtr += MetadataRecord::kMetadataBodySize - (OffsetPtr - BeginOffset); return Error::success(); } |