summaryrefslogtreecommitdiff
path: root/cmds/incident_helper
diff options
context:
space:
mode:
authorYi Jin <jinyithu@google.com>2018-01-24 21:48:36 -0800
committerYi Jin <jinyithu@google.com>2018-02-13 18:05:32 -0800
commit51d4c54eba8dd613dd0550c6633a747b53e0ce0a (patch)
treedaaac252c97315bb5870eb618b2aa84d1af62ea9 /cmds/incident_helper
parent85a6db68f1860bbaacc1cc21e29c4f61aabe0abb (diff)
Make the platform proto naming consistent, Part 1
Change proto names in incident_helper Bug: 72474563 Test: atest incident_helper_test Change-Id: Ia416ef9726a19d247e62d7de1028874408ec53f1
Diffstat (limited to 'cmds/incident_helper')
-rw-r--r--cmds/incident_helper/src/parsers/CpuFreqParser.cpp12
-rw-r--r--cmds/incident_helper/src/parsers/CpuInfoParser.cpp44
-rw-r--r--cmds/incident_helper/src/parsers/KernelWakesParser.cpp6
-rw-r--r--cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp24
-rw-r--r--cmds/incident_helper/src/parsers/ProcrankParser.cpp16
-rw-r--r--cmds/incident_helper/src/parsers/PsParser.cpp8
-rw-r--r--cmds/incident_helper/tests/CpuFreqParser_test.cpp12
-rw-r--r--cmds/incident_helper/tests/CpuInfoParser_test.cpp34
-rw-r--r--cmds/incident_helper/tests/KernelWakesParser_test.cpp12
-rw-r--r--cmds/incident_helper/tests/PageTypeInfoParser_test.cpp10
-rw-r--r--cmds/incident_helper/tests/ProcrankParser_test.cpp16
-rw-r--r--cmds/incident_helper/tests/PsParser_test.cpp72
12 files changed, 135 insertions, 131 deletions
diff --git a/cmds/incident_helper/src/parsers/CpuFreqParser.cpp b/cmds/incident_helper/src/parsers/CpuFreqParser.cpp
index 02f1ce7cc0fc..fde17bd97a7f 100644
--- a/cmds/incident_helper/src/parsers/CpuFreqParser.cpp
+++ b/cmds/incident_helper/src/parsers/CpuFreqParser.cpp
@@ -62,15 +62,15 @@ CpuFreqParser::Parse(const int in, const int out) const
ProtoOutputStream proto;
long jiffyHz = sysconf(_SC_CLK_TCK);
- proto.write(CpuFreq::JIFFY_HZ, (int)jiffyHz);
+ proto.write(CpuFreqProto::JIFFY_HZ, (int)jiffyHz);
for (int i=0; i<numCpus; i++) {
- long long token = proto.start(CpuFreq::CPU_FREQS);
- proto.write(CpuFreqStats::CPU_NAME, header[i+1]);
+ long long token = proto.start(CpuFreqProto::CPU_FREQS);
+ proto.write(CpuFreqProto::Stats::CPU_NAME, header[i+1]);
for (vector<pair<int, long long>>::iterator it = cpucores[i].begin(); it != cpucores[i].end(); it++) {
- long long stateToken = proto.start(CpuFreqStats::TIMES);
- proto.write(CpuFreqStats::TimeInState::STATE_KHZ, it->first);
- proto.write(CpuFreqStats::TimeInState::TIME_JIFFY, it->second);
+ long long stateToken = proto.start(CpuFreqProto::Stats::TIMES);
+ proto.write(CpuFreqProto::Stats::TimeInState::STATE_KHZ, it->first);
+ proto.write(CpuFreqProto::Stats::TimeInState::TIME_JIFFY, it->second);
proto.end(stateToken);
}
proto.end(token);
diff --git a/cmds/incident_helper/src/parsers/CpuInfoParser.cpp b/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
index d73de54d8c5d..b2b431c62866 100644
--- a/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
+++ b/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
@@ -54,11 +54,11 @@ CpuInfoParser::Parse(const int in, const int out) const
bool nextToUsage = false;
ProtoOutputStream proto;
- Table table(CpuInfo::Task::_FIELD_NAMES, CpuInfo::Task::_FIELD_IDS, CpuInfo::Task::_FIELD_COUNT);
- table.addEnumTypeMap("s", CpuInfo::Task::_ENUM_STATUS_NAMES,
- CpuInfo::Task::_ENUM_STATUS_VALUES, CpuInfo::Task::_ENUM_STATUS_COUNT);
- table.addEnumTypeMap("pcy", CpuInfo::Task::_ENUM_POLICY_NAMES,
- CpuInfo::Task::_ENUM_POLICY_VALUES, CpuInfo::Task::_ENUM_POLICY_COUNT);
+ Table table(CpuInfoProto::Task::_FIELD_NAMES, CpuInfoProto::Task::_FIELD_IDS, CpuInfoProto::Task::_FIELD_COUNT);
+ table.addEnumTypeMap("s", CpuInfoProto::Task::_ENUM_STATUS_NAMES,
+ CpuInfoProto::Task::_ENUM_STATUS_VALUES, CpuInfoProto::Task::_ENUM_STATUS_COUNT);
+ table.addEnumTypeMap("pcy", CpuInfoProto::Task::_ENUM_POLICY_NAMES,
+ CpuInfoProto::Task::_ENUM_POLICY_VALUES, CpuInfoProto::Task::_ENUM_POLICY_COUNT);
// parse line by line
while (reader.readLine(&line)) {
@@ -67,33 +67,33 @@ CpuInfoParser::Parse(const int in, const int out) const
nline++;
if (stripPrefix(&line, "Tasks:")) {
- writeSuffixLine(&proto, CpuInfo::TASK_STATS, line, COMMA_DELIMITER,
- CpuInfo::TaskStats::_FIELD_COUNT,
- CpuInfo::TaskStats::_FIELD_NAMES,
- CpuInfo::TaskStats::_FIELD_IDS);
+ writeSuffixLine(&proto, CpuInfoProto::TASK_STATS, line, COMMA_DELIMITER,
+ CpuInfoProto::TaskStats::_FIELD_COUNT,
+ CpuInfoProto::TaskStats::_FIELD_NAMES,
+ CpuInfoProto::TaskStats::_FIELD_IDS);
continue;
}
if (stripPrefix(&line, "Mem:")) {
- writeSuffixLine(&proto, CpuInfo::MEM, line, COMMA_DELIMITER,
- CpuInfo::MemStats::_FIELD_COUNT,
- CpuInfo::MemStats::_FIELD_NAMES,
- CpuInfo::MemStats::_FIELD_IDS);
+ writeSuffixLine(&proto, CpuInfoProto::MEM, line, COMMA_DELIMITER,
+ CpuInfoProto::MemStats::_FIELD_COUNT,
+ CpuInfoProto::MemStats::_FIELD_NAMES,
+ CpuInfoProto::MemStats::_FIELD_IDS);
continue;
}
if (stripPrefix(&line, "Swap:")) {
- writeSuffixLine(&proto, CpuInfo::SWAP, line, COMMA_DELIMITER,
- CpuInfo::MemStats::_FIELD_COUNT,
- CpuInfo::MemStats::_FIELD_NAMES,
- CpuInfo::MemStats::_FIELD_IDS);
+ writeSuffixLine(&proto, CpuInfoProto::SWAP, line, COMMA_DELIMITER,
+ CpuInfoProto::MemStats::_FIELD_COUNT,
+ CpuInfoProto::MemStats::_FIELD_NAMES,
+ CpuInfoProto::MemStats::_FIELD_IDS);
nextToSwap = true;
continue;
}
if (nextToSwap) {
- writeSuffixLine(&proto, CpuInfo::CPU_USAGE, line, DEFAULT_WHITESPACE,
- CpuInfo::CpuUsage::_FIELD_COUNT,
- CpuInfo::CpuUsage::_FIELD_NAMES,
- CpuInfo::CpuUsage::_FIELD_IDS);
+ writeSuffixLine(&proto, CpuInfoProto::CPU_USAGE, line, DEFAULT_WHITESPACE,
+ CpuInfoProto::CpuUsage::_FIELD_COUNT,
+ CpuInfoProto::CpuUsage::_FIELD_NAMES,
+ CpuInfoProto::CpuUsage::_FIELD_IDS);
nextToUsage = true;
nextToSwap = false;
continue;
@@ -138,7 +138,7 @@ CpuInfoParser::Parse(const int in, const int out) const
continue;
}
- long long token = proto.start(CpuInfo::TASKS);
+ long long token = proto.start(CpuInfoProto::TASKS);
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d fails to insert field %s with value %s\n",
diff --git a/cmds/incident_helper/src/parsers/KernelWakesParser.cpp b/cmds/incident_helper/src/parsers/KernelWakesParser.cpp
index cae51abbe57f..28816ea75a75 100644
--- a/cmds/incident_helper/src/parsers/KernelWakesParser.cpp
+++ b/cmds/incident_helper/src/parsers/KernelWakesParser.cpp
@@ -33,7 +33,9 @@ KernelWakesParser::Parse(const int in, const int out) const
int nline = 0;
ProtoOutputStream proto;
- Table table(WakeupSourceProto::_FIELD_NAMES, WakeupSourceProto::_FIELD_IDS, WakeupSourceProto::_FIELD_COUNT);
+ Table table(KernelWakeSourcesProto::WakeupSource::_FIELD_NAMES,
+ KernelWakeSourcesProto::WakeupSource::_FIELD_IDS,
+ KernelWakeSourcesProto::WakeupSource::_FIELD_COUNT);
// parse line by line
while (reader.readLine(&line)) {
@@ -57,7 +59,7 @@ KernelWakesParser::Parse(const int in, const int out) const
continue;
}
- long long token = proto.start(KernelWakeSources::WAKEUP_SOURCES);
+ long long token = proto.start(KernelWakeSourcesProto::WAKEUP_SOURCES);
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d has bad value %s of %s\n",
diff --git a/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp b/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
index f1b93ff9ec41..45a0e7b459d2 100644
--- a/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
+++ b/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
@@ -33,7 +33,9 @@ PageTypeInfoParser::Parse(const int in, const int out) const
header_t blockHeader;
ProtoOutputStream proto;
- Table table(BlockProto::_FIELD_NAMES, BlockProto::_FIELD_IDS, BlockProto::_FIELD_COUNT);
+ Table table(PageTypeInfoProto::Block::_FIELD_NAMES,
+ PageTypeInfoProto::Block::_FIELD_IDS,
+ PageTypeInfoProto::Block::_FIELD_COUNT);
while (reader.readLine(&line)) {
if (line.empty()) {
@@ -44,11 +46,11 @@ PageTypeInfoParser::Parse(const int in, const int out) const
if (stripPrefix(&line, "Page block order:")) {
pageBlockOrder = toInt(line);
- proto.write(PageTypeInfo::PAGE_BLOCK_ORDER, pageBlockOrder);
+ proto.write(PageTypeInfoProto::PAGE_BLOCK_ORDER, pageBlockOrder);
continue;
}
if (stripPrefix(&line, "Pages per block:")) {
- proto.write(PageTypeInfo::PAGES_PER_BLOCK, toInt(line));
+ proto.write(PageTypeInfoProto::PAGES_PER_BLOCK, toInt(line));
continue;
}
if (stripPrefix(&line, "Free pages count per migrate type at order")) {
@@ -62,14 +64,14 @@ PageTypeInfoParser::Parse(const int in, const int out) const
record_t record = parseRecord(line, COMMA_DELIMITER);
if (migrateTypeSession && record.size() == 3) {
- long long token = proto.start(PageTypeInfo::MIGRATE_TYPES);
+ long long token = proto.start(PageTypeInfoProto::MIGRATE_TYPES);
// expect part 0 starts with "Node"
if (stripPrefix(&record[0], "Node")) {
- proto.write(MigrateTypeProto::NODE, toInt(record[0]));
+ proto.write(PageTypeInfoProto::MigrateType::NODE, toInt(record[0]));
} else return BAD_VALUE;
// expect part 1 starts with "zone"
if (stripPrefix(&record[1], "zone")) {
- proto.write(MigrateTypeProto::ZONE, record[1]);
+ proto.write(PageTypeInfoProto::MigrateType::ZONE, record[1]);
} else return BAD_VALUE;
// expect part 2 starts with "type"
if (stripPrefix(&record[2], "type")) {
@@ -83,22 +85,22 @@ PageTypeInfoParser::Parse(const int in, const int out) const
int pageCountsSize = pageBlockOrder + 2;
if ((int)pageCounts.size() != pageCountsSize) return BAD_VALUE;
- proto.write(MigrateTypeProto::TYPE, pageCounts[0]);
+ proto.write(PageTypeInfoProto::MigrateType::TYPE, pageCounts[0]);
for (auto i=1; i<pageCountsSize; i++) {
- proto.write(MigrateTypeProto::FREE_PAGES_COUNT, toInt(pageCounts[i]));
+ proto.write(PageTypeInfoProto::MigrateType::FREE_PAGES_COUNT, toInt(pageCounts[i]));
}
} else return BAD_VALUE;
proto.end(token);
} else if (!blockHeader.empty() && record.size() == 2) {
- long long token = proto.start(PageTypeInfo::BLOCKS);
+ long long token = proto.start(PageTypeInfoProto::BLOCKS);
if (stripPrefix(&record[0], "Node")) {
- proto.write(BlockProto::NODE, toInt(record[0]));
+ proto.write(PageTypeInfoProto::Block::NODE, toInt(record[0]));
} else return BAD_VALUE;
if (stripPrefix(&record[1], "zone")) {
record_t blockCounts = parseRecord(record[1]);
- proto.write(BlockProto::ZONE, blockCounts[0]);
+ proto.write(PageTypeInfoProto::Block::ZONE, blockCounts[0]);
for (size_t i=0; i<blockHeader.size(); i++) {
if (!table.insertField(&proto, blockHeader[i], blockCounts[i+1])) {
diff --git a/cmds/incident_helper/src/parsers/ProcrankParser.cpp b/cmds/incident_helper/src/parsers/ProcrankParser.cpp
index a4eb0fdfd988..c1c458e69ddf 100644
--- a/cmds/incident_helper/src/parsers/ProcrankParser.cpp
+++ b/cmds/incident_helper/src/parsers/ProcrankParser.cpp
@@ -33,7 +33,7 @@ ProcrankParser::Parse(const int in, const int out) const
int nline = 0;
ProtoOutputStream proto;
- Table table(ProcessProto::_FIELD_NAMES, ProcessProto::_FIELD_IDS, ProcessProto::_FIELD_COUNT);
+ Table table(ProcrankProto::Process::_FIELD_NAMES, ProcrankProto::Process::_FIELD_IDS, ProcrankProto::Process::_FIELD_COUNT);
string zram, ram, total;
// parse line by line
@@ -66,7 +66,7 @@ ProcrankParser::Parse(const int in, const int out) const
continue;
}
- long long token = proto.start(Procrank::PROCESSES);
+ long long token = proto.start(ProcrankProto::PROCESSES);
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d has bad value %s of %s\n",
@@ -77,23 +77,23 @@ ProcrankParser::Parse(const int in, const int out) const
}
// add summary
- long long token = proto.start(Procrank::SUMMARY);
+ long long token = proto.start(ProcrankProto::SUMMARY);
if (!total.empty()) {
record = parseRecord(total);
- long long token = proto.start(SummaryProto::TOTAL);
+ long long token = proto.start(ProcrankProto::Summary::TOTAL);
for (int i=(int)record.size(); i>0; i--) {
table.insertField(&proto, header[header.size() - i].c_str(), record[record.size() - i].c_str());
}
proto.end(token);
}
if (!zram.empty()) {
- long long token = proto.start(SummaryProto::ZRAM);
- proto.write(ZramProto::RAW_TEXT, zram);
+ long long token = proto.start(ProcrankProto::Summary::ZRAM);
+ proto.write(ProcrankProto::Summary::Zram::RAW_TEXT, zram);
proto.end(token);
}
if (!ram.empty()) {
- long long token = proto.start(SummaryProto::RAM);
- proto.write(RamProto::RAW_TEXT, ram);
+ long long token = proto.start(ProcrankProto::Summary::RAM);
+ proto.write(ProcrankProto::Summary::Ram::RAW_TEXT, ram);
proto.end(token);
}
proto.end(token);
diff --git a/cmds/incident_helper/src/parsers/PsParser.cpp b/cmds/incident_helper/src/parsers/PsParser.cpp
index e9014cacfa0b..420775fb5f04 100644
--- a/cmds/incident_helper/src/parsers/PsParser.cpp
+++ b/cmds/incident_helper/src/parsers/PsParser.cpp
@@ -33,12 +33,12 @@ status_t PsParser::Parse(const int in, const int out) const {
int diff = 0;
ProtoOutputStream proto;
- Table table(PsDumpProto::Process::_FIELD_NAMES, PsDumpProto::Process::_FIELD_IDS, PsDumpProto::Process::_FIELD_COUNT);
+ Table table(PsProto::Process::_FIELD_NAMES, PsProto::Process::_FIELD_IDS, PsProto::Process::_FIELD_COUNT);
const char* pcyNames[] = { "fg", "bg", "ta" };
- const int pcyValues[] = {PsDumpProto::Process::POLICY_FG, PsDumpProto::Process::POLICY_BG, PsDumpProto::Process::POLICY_TA};
+ const int pcyValues[] = {PsProto::Process::POLICY_FG, PsProto::Process::POLICY_BG, PsProto::Process::POLICY_TA};
table.addEnumTypeMap("pcy", pcyNames, pcyValues, 3);
const char* sNames[] = { "D", "R", "S", "T", "t", "X", "Z" };
- const int sValues[] = {PsDumpProto::Process::STATE_D, PsDumpProto::Process::STATE_R, PsDumpProto::Process::STATE_S, PsDumpProto::Process::STATE_T, PsDumpProto::Process::STATE_TRACING, PsDumpProto::Process::STATE_X, PsDumpProto::Process::STATE_Z};
+ const int sValues[] = {PsProto::Process::STATE_D, PsProto::Process::STATE_R, PsProto::Process::STATE_S, PsProto::Process::STATE_T, PsProto::Process::STATE_TRACING, PsProto::Process::STATE_X, PsProto::Process::STATE_Z};
table.addEnumTypeMap("s", sNames, sValues, 7);
// Parse line by line
@@ -71,7 +71,7 @@ status_t PsParser::Parse(const int in, const int out) const {
continue;
}
- long long token = proto.start(PsDumpProto::PROCESSES);
+ long long token = proto.start(PsProto::PROCESSES);
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d has bad value %s of %s\n",
diff --git a/cmds/incident_helper/tests/CpuFreqParser_test.cpp b/cmds/incident_helper/tests/CpuFreqParser_test.cpp
index 82deee42687f..0839a7e45edd 100644
--- a/cmds/incident_helper/tests/CpuFreqParser_test.cpp
+++ b/cmds/incident_helper/tests/CpuFreqParser_test.cpp
@@ -52,14 +52,14 @@ protected:
TEST_F(CpuFreqParserTest, Success) {
const string testFile = kTestDataPath + "cpufreq.txt";
CpuFreqParser parser;
- CpuFreq expected;
+ CpuFreqProto expected;
long jiffyHz = sysconf(_SC_CLK_TCK);
expected.set_jiffy_hz(jiffyHz);
- CpuFreqStats::TimeInState* state;
+ CpuFreqProto::Stats::TimeInState* state;
- CpuFreqStats* cpu0 = expected.add_cpu_freqs();
+ CpuFreqProto::Stats* cpu0 = expected.add_cpu_freqs();
cpu0->set_cpu_name("cpu0");
state = cpu0->add_times();
state->set_state_khz(307200);
@@ -71,7 +71,7 @@ TEST_F(CpuFreqParserTest, Success) {
state->set_state_khz(768000);
state->set_time_jiffy(22652);
- CpuFreqStats* cpu1 = expected.add_cpu_freqs();
+ CpuFreqProto::Stats* cpu1 = expected.add_cpu_freqs();
cpu1->set_cpu_name("cpu1");
state = cpu1->add_times();
state->set_state_khz(307200);
@@ -83,7 +83,7 @@ TEST_F(CpuFreqParserTest, Success) {
state->set_state_khz(768000);
state->set_time_jiffy(22652);
- CpuFreqStats* cpu2 = expected.add_cpu_freqs();
+ CpuFreqProto::Stats* cpu2 = expected.add_cpu_freqs();
cpu2->set_cpu_name("cpu2");
state = cpu2->add_times();
state->set_state_khz(307200);
@@ -98,7 +98,7 @@ TEST_F(CpuFreqParserTest, Success) {
state->set_state_khz(825600);
state->set_time_jiffy(13173);
- CpuFreqStats* cpu3 = expected.add_cpu_freqs();
+ CpuFreqProto::Stats* cpu3 = expected.add_cpu_freqs();
cpu3->set_cpu_name("cpu3");
state = cpu3->add_times();
state->set_state_khz(307200);
diff --git a/cmds/incident_helper/tests/CpuInfoParser_test.cpp b/cmds/incident_helper/tests/CpuInfoParser_test.cpp
index 8dce53e46492..2e50d631715e 100644
--- a/cmds/incident_helper/tests/CpuInfoParser_test.cpp
+++ b/cmds/incident_helper/tests/CpuInfoParser_test.cpp
@@ -52,28 +52,28 @@ protected:
TEST_F(CpuInfoParserTest, Success) {
const string testFile = kTestDataPath + "cpuinfo.txt";
CpuInfoParser parser;
- CpuInfo expected;
+ CpuInfoProto expected;
- CpuInfo::TaskStats* taskStats = expected.mutable_task_stats();
+ CpuInfoProto::TaskStats* taskStats = expected.mutable_task_stats();
taskStats->set_total(2038);
taskStats->set_running(1);
taskStats->set_sleeping(2033);
taskStats->set_stopped(0);
taskStats->set_zombie(0);
- CpuInfo::MemStats* mem = expected.mutable_mem();
+ CpuInfoProto::MemStats* mem = expected.mutable_mem();
mem->set_total(3842668);
mem->set_used(3761936);
mem->set_free(80732);
mem->set_buffers(220188);
- CpuInfo::MemStats* swap = expected.mutable_swap();
+ CpuInfoProto::MemStats* swap = expected.mutable_swap();
swap->set_total(524284);
swap->set_used(25892);
swap->set_free(498392);
swap->set_cached(1316952);
- CpuInfo::CpuUsage* usage = expected.mutable_cpu_usage();
+ CpuInfoProto::CpuUsage* usage = expected.mutable_cpu_usage();
usage->set_cpu(400);
usage->set_user(17);
usage->set_nice(0);
@@ -85,59 +85,59 @@ TEST_F(CpuInfoParserTest, Success) {
usage->set_host(0);
// This is a special line which is able to be parsed by the CpuInfoParser
- CpuInfo::Task* task1 = expected.add_tasks();
+ CpuInfoProto::Task* task1 = expected.add_tasks();
task1->set_pid(29438);
task1->set_tid(29438);
task1->set_user("rootabcdefghij");
task1->set_pr("20");
task1->set_ni(0);
task1->set_cpu(57.9);
- task1->set_s(CpuInfo::Task::STATUS_R);
+ task1->set_s(CpuInfoProto::Task::STATUS_R);
task1->set_virt("14M");
task1->set_res("3.8M");
- task1->set_pcy(CpuInfo::Task::POLICY_UNKNOWN);
+ task1->set_pcy(CpuInfoProto::Task::POLICY_UNKNOWN);
task1->set_cmd("top test");
task1->set_name("top");
- CpuInfo::Task* task2 = expected.add_tasks();
+ CpuInfoProto::Task* task2 = expected.add_tasks();
task2->set_pid(916);
task2->set_tid(916);
task2->set_user("system");
task2->set_pr("18");
task2->set_ni(-2);
task2->set_cpu(1.4);
- task2->set_s(CpuInfo::Task::STATUS_S);
+ task2->set_s(CpuInfoProto::Task::STATUS_S);
task2->set_virt("4.6G");
task2->set_res("404M");
- task2->set_pcy(CpuInfo::Task::POLICY_fg);
+ task2->set_pcy(CpuInfoProto::Task::POLICY_fg);
task2->set_cmd("system_server");
task2->set_name("system_server");
- CpuInfo::Task* task3 = expected.add_tasks();
+ CpuInfoProto::Task* task3 = expected.add_tasks();
task3->set_pid(28);
task3->set_tid(28);
task3->set_user("root");
task3->set_pr("-2");
task3->set_ni(0);
task3->set_cpu(1.4);
- task3->set_s(CpuInfo::Task::STATUS_S);
+ task3->set_s(CpuInfoProto::Task::STATUS_S);
task3->set_virt("0");
task3->set_res("0");
- task3->set_pcy(CpuInfo::Task::POLICY_bg);
+ task3->set_pcy(CpuInfoProto::Task::POLICY_bg);
task3->set_cmd("rcuc/3");
task3->set_name("[rcuc/3]");
- CpuInfo::Task* task4 = expected.add_tasks();
+ CpuInfoProto::Task* task4 = expected.add_tasks();
task4->set_pid(27);
task4->set_tid(27);
task4->set_user("root");
task4->set_pr("RT");
task4->set_ni(0);
task4->set_cpu(1.4);
- task4->set_s(CpuInfo::Task::STATUS_S);
+ task4->set_s(CpuInfoProto::Task::STATUS_S);
task4->set_virt("0");
task4->set_res("0");
- task4->set_pcy(CpuInfo::Task::POLICY_ta);
+ task4->set_pcy(CpuInfoProto::Task::POLICY_ta);
task4->set_cmd("migration/3");
task4->set_name("[migration/3]");
diff --git a/cmds/incident_helper/tests/KernelWakesParser_test.cpp b/cmds/incident_helper/tests/KernelWakesParser_test.cpp
index a98c62bd6024..f92d81361eab 100644
--- a/cmds/incident_helper/tests/KernelWakesParser_test.cpp
+++ b/cmds/incident_helper/tests/KernelWakesParser_test.cpp
@@ -52,14 +52,14 @@ protected:
TEST_F(KernelWakesParserTest, Short) {
const string testFile = kTestDataPath + "kernel_wakeups_short.txt";
KernelWakesParser parser;
- KernelWakeSources expected;
+ KernelWakeSourcesProto expected;
- WakeupSourceProto* record1 = expected.add_wakeup_sources();
+ KernelWakeSourcesProto::WakeupSource* record1 = expected.add_wakeup_sources();
record1->set_name("ab");
record1->set_active_count(8);
record1->set_last_change(123456123456LL);
- WakeupSourceProto* record2 = expected.add_wakeup_sources();
+ KernelWakeSourcesProto::WakeupSource* record2 = expected.add_wakeup_sources();
record2->set_name("df");
record2->set_active_count(143);
record2->set_last_change(0LL);
@@ -76,9 +76,9 @@ TEST_F(KernelWakesParserTest, Short) {
TEST_F(KernelWakesParserTest, Normal) {
const string testFile = kTestDataPath + "kernel_wakeups.txt";
KernelWakesParser parser;
- KernelWakeSources expected;
+ KernelWakeSourcesProto expected;
- WakeupSourceProto* record1 = expected.add_wakeup_sources();
+ KernelWakeSourcesProto::WakeupSource* record1 = expected.add_wakeup_sources();
record1->set_name("ipc000000ab_ATFWD-daemon");
record1->set_active_count(8);
record1->set_event_count(8);
@@ -90,7 +90,7 @@ TEST_F(KernelWakesParserTest, Normal) {
record1->set_last_change(131348LL);
record1->set_prevent_suspend_time(0LL);
- WakeupSourceProto* record2 = expected.add_wakeup_sources();
+ KernelWakeSourcesProto::WakeupSource* record2 = expected.add_wakeup_sources();
record2->set_name("ipc000000aa_ATFWD-daemon");
record2->set_active_count(143);
record2->set_event_count(143);
diff --git a/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp b/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp
index a9e6e816c6c5..9bad7be4a07e 100644
--- a/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp
+++ b/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp
@@ -52,12 +52,12 @@ protected:
TEST_F(PageTypeInfoParserTest, Success) {
const string testFile = kTestDataPath + "pagetypeinfo.txt";
PageTypeInfoParser parser;
- PageTypeInfo expected;
+ PageTypeInfoProto expected;
expected.set_page_block_order(10);
expected.set_pages_per_block(1024);
- MigrateTypeProto* mt1 = expected.add_migrate_types();
+ PageTypeInfoProto::MigrateType* mt1 = expected.add_migrate_types();
mt1->set_node(0);
mt1->set_zone("DMA");
mt1->set_type("Unmovable");
@@ -66,7 +66,7 @@ TEST_F(PageTypeInfoParserTest, Success) {
mt1->add_free_pages_count(arr1[i]);
}
- MigrateTypeProto* mt2 = expected.add_migrate_types();
+ PageTypeInfoProto::MigrateType* mt2 = expected.add_migrate_types();
mt2->set_node(0);
mt2->set_zone("Normal");
mt2->set_type("Reclaimable");
@@ -75,7 +75,7 @@ TEST_F(PageTypeInfoParserTest, Success) {
mt2->add_free_pages_count(arr2[i]);
}
- BlockProto* block1 = expected.add_blocks();
+ PageTypeInfoProto::Block* block1 = expected.add_blocks();
block1->set_node(0);
block1->set_zone("DMA");
block1->set_unmovable(74);
@@ -86,7 +86,7 @@ TEST_F(PageTypeInfoParserTest, Success) {
block1->set_isolate(0);
- BlockProto* block2 = expected.add_blocks();
+ PageTypeInfoProto::Block* block2 = expected.add_blocks();
block2->set_node(0);
block2->set_zone("Normal");
block2->set_unmovable(70);
diff --git a/cmds/incident_helper/tests/ProcrankParser_test.cpp b/cmds/incident_helper/tests/ProcrankParser_test.cpp
index 76b25d7f8f47..0b567aec9597 100644
--- a/cmds/incident_helper/tests/ProcrankParser_test.cpp
+++ b/cmds/incident_helper/tests/ProcrankParser_test.cpp
@@ -52,9 +52,9 @@ protected:
TEST_F(ProcrankParserTest, HasSwapInfo) {
const string testFile = kTestDataPath + "procrank.txt";
ProcrankParser parser;
- Procrank expected;
+ ProcrankProto expected;
- ProcessProto* process1 = expected.add_processes();
+ ProcrankProto::Process* process1 = expected.add_processes();
process1->set_pid(1119);
process1->set_vss(2607640);
process1->set_rss(339564);
@@ -66,7 +66,7 @@ TEST_F(ProcrankParserTest, HasSwapInfo) {
process1->set_zswap(10);
process1->set_cmdline("system_server");
- ProcessProto* process2 = expected.add_processes();
+ ProcrankProto::Process* process2 = expected.add_processes();
process2->set_pid(649);
process2->set_vss(11016);
process2->set_rss(1448);
@@ -78,7 +78,7 @@ TEST_F(ProcrankParserTest, HasSwapInfo) {
process2->set_zswap(75);
process2->set_cmdline("/vendor/bin/qseecomd");
- ProcessProto* total = expected.mutable_summary()->mutable_total();
+ ProcrankProto::Process* total = expected.mutable_summary()->mutable_total();
total->set_pss(1201993);
total->set_uss(935300);
total->set_swap(88164);
@@ -104,9 +104,9 @@ TEST_F(ProcrankParserTest, HasSwapInfo) {
TEST_F(ProcrankParserTest, NoSwapInfo) {
const string testFile = kTestDataPath + "procrank_short.txt";
ProcrankParser parser;
- Procrank expected;
+ ProcrankProto expected;
- ProcessProto* process1 = expected.add_processes();
+ ProcrankProto::Process* process1 = expected.add_processes();
process1->set_pid(1119);
process1->set_vss(2607640);
process1->set_rss(339564);
@@ -114,7 +114,7 @@ TEST_F(ProcrankParserTest, NoSwapInfo) {
process1->set_uss(114216);
process1->set_cmdline("system_server");
- ProcessProto* process2 = expected.add_processes();
+ ProcrankProto::Process* process2 = expected.add_processes();
process2->set_pid(649);
process2->set_vss(11016);
process2->set_rss(1448);
@@ -122,7 +122,7 @@ TEST_F(ProcrankParserTest, NoSwapInfo) {
process2->set_uss(48);
process2->set_cmdline("/vendor/bin/qseecomd");
- ProcessProto* total = expected.mutable_summary()->mutable_total();
+ ProcrankProto::Process* total = expected.mutable_summary()->mutable_total();
total->set_pss(1201993);
total->set_uss(935300);
total->set_cmdline("TOTAL");
diff --git a/cmds/incident_helper/tests/PsParser_test.cpp b/cmds/incident_helper/tests/PsParser_test.cpp
index 1f03a7f3a332..114d63472ffc 100644
--- a/cmds/incident_helper/tests/PsParser_test.cpp
+++ b/cmds/incident_helper/tests/PsParser_test.cpp
@@ -52,10 +52,10 @@ protected:
TEST_F(PsParserTest, Normal) {
const string testFile = kTestDataPath + "ps.txt";
PsParser parser;
- PsDumpProto expected;
- PsDumpProto got;
+ PsProto expected;
+ PsProto got;
- PsDumpProto::Process* record1 = expected.add_processes();
+ PsProto::Process* record1 = expected.add_processes();
record1->set_label("u:r:init:s0");
record1->set_user("root");
record1->set_pid(1);
@@ -65,16 +65,16 @@ TEST_F(PsParserTest, Normal) {
record1->set_rss(2636);
record1->set_wchan("SyS_epoll_wait");
record1->set_addr("0");
- record1->set_s(PsDumpProto_Process_ProcessStateCode_STATE_S);
+ record1->set_s(PsProto_Process_ProcessStateCode_STATE_S);
record1->set_pri(19);
record1->set_ni(0);
record1->set_rtprio("-");
- record1->set_sch(PsDumpProto_Process_SchedulingPolicy_SCH_NORMAL);
- record1->set_pcy(PsDumpProto::Process::POLICY_FG);
+ record1->set_sch(PsProto_Process_SchedulingPolicy_SCH_NORMAL);
+ record1->set_pcy(PsProto::Process::POLICY_FG);
record1->set_time("00:00:01");
record1->set_cmd("init");
- PsDumpProto::Process* record2 = expected.add_processes();
+ PsProto::Process* record2 = expected.add_processes();
record2->set_label("u:r:kernel:s0");
record2->set_user("root");
record2->set_pid(2);
@@ -84,16 +84,16 @@ TEST_F(PsParserTest, Normal) {
record2->set_rss(0);
record2->set_wchan("kthreadd");
record2->set_addr("0");
- record2->set_s(PsDumpProto_Process_ProcessStateCode_STATE_S);
+ record2->set_s(PsProto_Process_ProcessStateCode_STATE_S);
record2->set_pri(19);
record2->set_ni(0);
record2->set_rtprio("-");
- record2->set_sch(PsDumpProto_Process_SchedulingPolicy_SCH_NORMAL);
- record2->set_pcy(PsDumpProto::Process::POLICY_FG);
+ record2->set_sch(PsProto_Process_SchedulingPolicy_SCH_NORMAL);
+ record2->set_pcy(PsProto::Process::POLICY_FG);
record2->set_time("00:00:00");
record2->set_cmd("kthreadd");
- PsDumpProto::Process* record3 = expected.add_processes();
+ PsProto::Process* record3 = expected.add_processes();
record3->set_label("u:r:surfaceflinger:s0");
record3->set_user("system");
record3->set_pid(499);
@@ -103,16 +103,16 @@ TEST_F(PsParserTest, Normal) {
record3->set_rss(22024);
record3->set_wchan("futex_wait_queue_me");
record3->set_addr("0");
- record3->set_s(PsDumpProto_Process_ProcessStateCode_STATE_S);
+ record3->set_s(PsProto_Process_ProcessStateCode_STATE_S);
record3->set_pri(42);
record3->set_ni(-9);
record3->set_rtprio("2");
- record3->set_sch(PsDumpProto_Process_SchedulingPolicy_SCH_FIFO);
- record3->set_pcy(PsDumpProto::Process::POLICY_FG);
+ record3->set_sch(PsProto_Process_SchedulingPolicy_SCH_FIFO);
+ record3->set_pcy(PsProto::Process::POLICY_FG);
record3->set_time("00:00:00");
record3->set_cmd("EventThread");
- PsDumpProto::Process* record4 = expected.add_processes();
+ PsProto::Process* record4 = expected.add_processes();
record4->set_label("u:r:hal_gnss_default:s0");
record4->set_user("gps");
record4->set_pid(670);
@@ -122,16 +122,16 @@ TEST_F(PsParserTest, Normal) {
record4->set_rss(7272);
record4->set_wchan("poll_schedule_timeout");
record4->set_addr("0");
- record4->set_s(PsDumpProto_Process_ProcessStateCode_STATE_S);
+ record4->set_s(PsProto_Process_ProcessStateCode_STATE_S);
record4->set_pri(19);
record4->set_ni(0);
record4->set_rtprio("-");
- record4->set_sch(PsDumpProto_Process_SchedulingPolicy_SCH_NORMAL);
- record4->set_pcy(PsDumpProto::Process::POLICY_FG);
+ record4->set_sch(PsProto_Process_SchedulingPolicy_SCH_NORMAL);
+ record4->set_pcy(PsProto::Process::POLICY_FG);
record4->set_time("00:00:00");
record4->set_cmd("Loc_hal_worker");
- PsDumpProto::Process* record5 = expected.add_processes();
+ PsProto::Process* record5 = expected.add_processes();
record5->set_label("u:r:platform_app:s0:c512,c768");
record5->set_user("u0_a48");
record5->set_pid(1660);
@@ -141,16 +141,16 @@ TEST_F(PsParserTest, Normal) {
record5->set_rss(138328);
record5->set_wchan("binder_thread_read");
record5->set_addr("0");
- record5->set_s(PsDumpProto_Process_ProcessStateCode_STATE_S);
+ record5->set_s(PsProto_Process_ProcessStateCode_STATE_S);
record5->set_pri(35);
record5->set_ni(-16);
record5->set_rtprio("-");
- record5->set_sch(PsDumpProto_Process_SchedulingPolicy_SCH_NORMAL);
- record5->set_pcy(PsDumpProto::Process::POLICY_TA);
+ record5->set_sch(PsProto_Process_SchedulingPolicy_SCH_NORMAL);
+ record5->set_pcy(PsProto::Process::POLICY_TA);
record5->set_time("00:00:00");
record5->set_cmd("HwBinder:1660_1");
- PsDumpProto::Process* record6 = expected.add_processes();
+ PsProto::Process* record6 = expected.add_processes();
record6->set_label("u:r:perfd:s0");
record6->set_user("root");
record6->set_pid(1939);
@@ -160,16 +160,16 @@ TEST_F(PsParserTest, Normal) {
record6->set_rss(2088);
record6->set_wchan("__skb_recv_datagram");
record6->set_addr("7b9782fd14");
- record6->set_s(PsDumpProto_Process_ProcessStateCode_STATE_S);
+ record6->set_s(PsProto_Process_ProcessStateCode_STATE_S);
record6->set_pri(19);
record6->set_ni(0);
record6->set_rtprio("-");
- record6->set_sch(PsDumpProto_Process_SchedulingPolicy_SCH_NORMAL);
- record6->set_pcy(PsDumpProto::Process::POLICY_UNKNOWN);
+ record6->set_sch(PsProto_Process_SchedulingPolicy_SCH_NORMAL);
+ record6->set_pcy(PsProto::Process::POLICY_UNKNOWN);
record6->set_time("00:00:00");
record6->set_cmd("perfd");
- PsDumpProto::Process* record7 = expected.add_processes();
+ PsProto::Process* record7 = expected.add_processes();
record7->set_label("u:r:perfd:s0");
record7->set_user("root");
record7->set_pid(1939);
@@ -179,16 +179,16 @@ TEST_F(PsParserTest, Normal) {
record7->set_rss(2088);
record7->set_wchan("do_sigtimedwait");
record7->set_addr("7b9782ff6c");
- record7->set_s(PsDumpProto_Process_ProcessStateCode_STATE_S);
+ record7->set_s(PsProto_Process_ProcessStateCode_STATE_S);
record7->set_pri(19);
record7->set_ni(0);
record7->set_rtprio("-");
- record7->set_sch(PsDumpProto_Process_SchedulingPolicy_SCH_NORMAL);
- record7->set_pcy(PsDumpProto::Process::POLICY_UNKNOWN);
+ record7->set_sch(PsProto_Process_SchedulingPolicy_SCH_NORMAL);
+ record7->set_pcy(PsProto::Process::POLICY_UNKNOWN);
record7->set_time("00:00:00");
record7->set_cmd("POSIX timer 0");
- PsDumpProto::Process* record8 = expected.add_processes();
+ PsProto::Process* record8 = expected.add_processes();
record8->set_label("u:r:shell:s0");
record8->set_user("shell");
record8->set_pid(2645);
@@ -198,12 +198,12 @@ TEST_F(PsParserTest, Normal) {
record8->set_rss(2972);
record8->set_wchan("0");
record8->set_addr("7f67a2f8b4");
- record8->set_s(PsDumpProto_Process_ProcessStateCode_STATE_R);
+ record8->set_s(PsProto_Process_ProcessStateCode_STATE_R);
record8->set_pri(19);
record8->set_ni(0);
record8->set_rtprio("-");
- record8->set_sch(PsDumpProto_Process_SchedulingPolicy_SCH_NORMAL);
- record8->set_pcy(PsDumpProto::Process::POLICY_FG);
+ record8->set_sch(PsProto_Process_SchedulingPolicy_SCH_NORMAL);
+ record8->set_pcy(PsProto::Process::POLICY_FG);
record8->set_time("00:00:00");
record8->set_cmd("ps");
@@ -221,8 +221,8 @@ TEST_F(PsParserTest, Normal) {
} else {
int n = got.processes_size();
for (int i = 0; i < n; i++) {
- PsDumpProto::Process g = got.processes(i);
- PsDumpProto::Process e = expected.processes(i);
+ PsProto::Process g = got.processes(i);
+ PsProto::Process e = expected.processes(i);
if (g.label() != e.label()) {
fprintf(stderr, "prcs[%d]: Invalid label. Got %s, want %s\n", i, g.label().c_str(), e.label().c_str());