diff options
author | Yi Jin <jinyithu@google.com> | 2017-11-01 17:08:27 -0700 |
---|---|---|
committer | Yi Jin <jinyithu@google.com> | 2017-11-10 17:34:07 -0800 |
commit | e2f7f79d023f0b3ba2fee374492dde61f525ece6 (patch) | |
tree | 8ea7efe3b552f1cb23c2f4c2ef379be6fb02f19b /cmds/incident_helper/src/parsers/KernelWakesParser.cpp | |
parent | 9a753af26b2ce27c10ad215aa70cf1bcd44d7915 (diff) |
Implement Cpu Info Section
Support carriage return in Read class, and add a new way to parse lines
which is not able to split purly by delimiters
Bug: 65642861
Test: unit test and on device test
Change-Id: Ib82dd4e458bb7d2fa33462b23fbe11b828325916
Diffstat (limited to 'cmds/incident_helper/src/parsers/KernelWakesParser.cpp')
-rw-r--r-- | cmds/incident_helper/src/parsers/KernelWakesParser.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/cmds/incident_helper/src/parsers/KernelWakesParser.cpp b/cmds/incident_helper/src/parsers/KernelWakesParser.cpp index cc4a1e1ecfa2..ada4a5d0ffe2 100644 --- a/cmds/incident_helper/src/parsers/KernelWakesParser.cpp +++ b/cmds/incident_helper/src/parsers/KernelWakesParser.cpp @@ -23,8 +23,6 @@ using namespace android::os; -const std::string LINE_DELIMITER = "\t"; - status_t KernelWakesParser::Parse(const int in, const int out) const { @@ -42,12 +40,12 @@ KernelWakesParser::Parse(const int in, const int out) const if (line.empty()) continue; // parse head line if (nline++ == 0) { - header = parseHeader(line, LINE_DELIMITER); + header = parseHeader(line, TAB_DELIMITER); continue; } // parse for each record, the line delimiter is \t only! - record = parseRecord(line, LINE_DELIMITER); + record = parseRecord(line, TAB_DELIMITER); if (record.size() != header.size()) { // TODO: log this to incident report! @@ -57,7 +55,7 @@ KernelWakesParser::Parse(const int in, const int out) const long long token = proto.start(KernelWakeSources::WAKEUP_SOURCES); for (int i=0; i<(int)record.size(); i++) { - if (!table.insertField(proto, header[i], record[i])) { + if (!table.insertField(&proto, header[i], record[i])) { fprintf(stderr, "[%s]Line %d has bad value %s of %s\n", this->name.string(), nline, header[i].c_str(), record[i].c_str()); } |