[llvm] r329496 - [llvm-exegesis] Fix unused return value warning and add a useful error message for event counter reads.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 7 04:37:21 PDT 2018
Author: rksimon
Date: Sat Apr 7 04:37:21 2018
New Revision: 329496
URL: http://llvm.org/viewvc/llvm-project?rev=329496&view=rev
Log:
[llvm-exegesis] Fix unused return value warning and add a useful error message for event counter reads.
Modified:
llvm/trunk/tools/llvm-exegesis/lib/PerfHelper.cpp
Modified: llvm/trunk/tools/llvm-exegesis/lib/PerfHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/PerfHelper.cpp?rev=329496&r1=329495&r2=329496&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/PerfHelper.cpp (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/PerfHelper.cpp Sat Apr 7 04:37:21 2018
@@ -107,7 +107,9 @@ void Counter::stop() { ioctl(FileDescrip
int64_t Counter::read() const {
int64_t Count = 0;
- ::read(FileDescriptor, &Count, sizeof(Count));
+ ssize_t ReadSize = ::read(FileDescriptor, &Count, sizeof(Count));
+ if (ReadSize != sizeof(Count))
+ llvm::errs() << "Failed to read event counter";
return Count;
}
More information about the llvm-commits
mailing list