Blacklist truncated atoms instead of whitelistnig

We used a whitelist to determine which atoms should have their
timestamps truncated to the nearest 5 minutes. This changes the logic
to a blacklist so that we can get fine grained timestamps from vendor and
mainline atoms. Also reserves a range for atoms that need to be
truncated in the future.

Bug: 134574701
Test: inspected generated statslog.cpp file to make sure it had the
correct blacklist
Test: testdrive on ScreenStateChanged to ensure timestamps are preserved
when they should be
Test: testdrive on CallStateChanged to ensure timestamps are truncated
when they should be.

Change-Id: Id3468542c830cdf41395a94c77f7df0b46cd11b7
This commit is contained in:
Tej Singh
2019-06-05 18:10:12 -07:00
parent 2aa255a746
commit 29ac601429
6 changed files with 28 additions and 30 deletions

View File

@@ -131,14 +131,10 @@ static void write_atoms_info_cpp(FILE *out, const Atoms &atoms) {
"mobile_bytes_transfer"};
fprintf(out,
"const std::set<int> "
"AtomsInfo::kNotTruncatingTimestampAtomWhiteList = {\n");
for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
atom != atoms.decls.end(); atom++) {
if (kTruncatingAtomNames.find(atom->name) ==
kTruncatingAtomNames.end()) {
string constant = make_constant_name(atom->name);
fprintf(out, " %s,\n", constant.c_str());
}
"AtomsInfo::kTruncatingTimestampAtomBlackList = {\n");
for (set<string>::const_iterator blacklistedAtom = kTruncatingAtomNames.begin();
blacklistedAtom != kTruncatingAtomNames.end(); blacklistedAtom++) {
fprintf(out, " %s,\n", make_constant_name(*blacklistedAtom).c_str());
}
fprintf(out, "};\n");
fprintf(out, "\n");
@@ -840,7 +836,7 @@ write_stats_log_header(FILE* out, const Atoms& atoms, const AtomDecl &attributio
fprintf(out, "struct AtomsInfo {\n");
fprintf(out,
" const static std::set<int> "
"kNotTruncatingTimestampAtomWhiteList;\n");
"kTruncatingTimestampAtomBlackList;\n");
fprintf(out, " const static std::map<int, int> kAtomsWithUidField;\n");
fprintf(out,
" const static std::set<int> kAtomsWithAttributionChain;\n");