summaryrefslogtreecommitdiff
path: root/simpleperf/record_file_reader.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2016-07-26 15:03:27 -0700
committerYabin Cui <yabinc@google.com>2016-07-27 14:37:13 -0700
commit3e4c5950f3aafb0bf66544468d98ee3ec26b705c (patch)
tree0b7dca91eb9ffd0e729dd01f68f34b67d500dd13 /simpleperf/record_file_reader.cpp
parent5b46f5747cdc481f8d1f51b3f8664335a2fdbcb4 (diff)
downloadextras-3e4c5950f3aafb0bf66544468d98ee3ec26b705c.tar.gz
simpleperf: use libevent in stat command.
Wrap libevent in IOEventLoop, use IOEventLoop in stat command. Add corresponding tests. Bug: http://b/30405638 Change-Id: I78b79e0eff1365ab46dde29c2a24a2def586af79 Test: run simpleperf_unit_test.
Diffstat (limited to 'simpleperf/record_file_reader.cpp')
-rw-r--r--simpleperf/record_file_reader.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/simpleperf/record_file_reader.cpp b/simpleperf/record_file_reader.cpp
index 68cee21f..9f1e9920 100644
--- a/simpleperf/record_file_reader.cpp
+++ b/simpleperf/record_file_reader.cpp
@@ -80,7 +80,7 @@ bool RecordFileReader::ReadAttrSection() {
return false;
}
if (fseek(record_fp_, header_.attrs.offset, SEEK_SET) != 0) {
- PLOG(ERROR) << "failed to fseek()";
+ PLOG(ERROR) << "fseek() failed";
return false;
}
for (size_t i = 0; i < attr_count; ++i) {
@@ -132,7 +132,7 @@ bool RecordFileReader::ReadFeatureSectionDescriptors() {
}
uint64_t feature_section_offset = header_.data.offset + header_.data.size;
if (fseek(record_fp_, feature_section_offset, SEEK_SET) != 0) {
- PLOG(ERROR) << "failed to fseek()";
+ PLOG(ERROR) << "fseek() failed";
return false;
}
for (const auto& id : features) {
@@ -148,7 +148,7 @@ bool RecordFileReader::ReadFeatureSectionDescriptors() {
bool RecordFileReader::ReadIdsForAttr(const FileAttr& attr, std::vector<uint64_t>* ids) {
size_t id_count = attr.ids.size / sizeof(uint64_t);
if (fseek(record_fp_, attr.ids.offset, SEEK_SET) != 0) {
- PLOG(ERROR) << "failed to fseek()";
+ PLOG(ERROR) << "fseek() failed";
return false;
}
ids->resize(id_count);
@@ -158,10 +158,10 @@ bool RecordFileReader::ReadIdsForAttr(const FileAttr& attr, std::vector<uint64_t
return true;
}
-bool RecordFileReader::ReadDataSection(std::function<bool(std::unique_ptr<Record>)> callback,
- bool sorted) {
+bool RecordFileReader::ReadDataSection(
+ const std::function<bool(std::unique_ptr<Record>)>& callback, bool sorted) {
if (fseek(record_fp_, header_.data.offset, SEEK_SET) != 0) {
- PLOG(ERROR) << "failed to fseek()";
+ PLOG(ERROR) << "fseek() failed";
return false;
}
bool has_timestamp = true;
@@ -283,7 +283,7 @@ bool RecordFileReader::ReadFeatureSection(int feature, std::vector<char>* data)
return true;
}
if (fseek(record_fp_, section.offset, SEEK_SET) != 0) {
- PLOG(ERROR) << "failed to fseek()";
+ PLOG(ERROR) << "fseek() failed";
return false;
}
if (!Read(data->data(), data->size())) {