Loading cmds/statsd/src/atoms.proto +3 −0 Original line number Diff line number Diff line Loading @@ -424,6 +424,9 @@ message Atom { UserLifecycleJourneyReported user_lifecycle_journey_reported = 264 [(module) = "framework"]; UserLifecycleEventOccurred user_lifecycle_event_occurred = 265 [(module) = "framework"]; SdkExtensionStatus sdk_extension_status = 354; // StatsdStats tracks platform atoms with ids upto 500. // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value. } // Pulled events will start at field 10000. Loading cmds/statsd/src/guardrail/StatsdStats.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ const std::map<int, std::pair<size_t, size_t>> StatsdStats::kAtomDimensionKeySiz }; StatsdStats::StatsdStats() { mPushedAtomStats.resize(android::util::kMaxPushedAtomId + 1); mPushedAtomStats.resize(kMaxPushedAtomId + 1); mStartTimeSec = getWallClockSec(); } Loading Loading @@ -448,7 +448,7 @@ void StatsdStats::notePullExceedMaxDelay(int pullAtomId) { void StatsdStats::noteAtomLogged(int atomId, int32_t timeSec) { lock_guard<std::mutex> lock(mLock); if (atomId <= android::util::kMaxPushedAtomId) { if (atomId <= kMaxPushedAtomId) { mPushedAtomStats[atomId]++; } else { if (mNonPlatformPushedAtomStats.size() < kMaxNonPlatformPushedAtoms) { Loading cmds/statsd/src/guardrail/StatsdStats.h +4 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,10 @@ public: // Maximum number of pushed atoms statsd stats will track above kMaxPushedAtomId. static const int kMaxNonPlatformPushedAtoms = 100; // Maximum atom id value that we consider a platform pushed atom. // This should be updated once highest pushed atom id in atoms.proto approaches this value. static const int kMaxPushedAtomId = 500; // Atom id that is the start of the pulled atoms. static const int kPullAtomStartTag = 10000; Loading cmds/statsd/tests/guardrail/StatsdStats_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -254,8 +254,8 @@ TEST(StatsdStatsTest, TestAtomLog) { TEST(StatsdStatsTest, TestNonPlatformAtomLog) { StatsdStats stats; time_t now = time(nullptr); int newAtom1 = android::util::kMaxPushedAtomId + 1; int newAtom2 = android::util::kMaxPushedAtomId + 2; int newAtom1 = StatsdStats::kMaxPushedAtomId + 1; int newAtom2 = StatsdStats::kMaxPushedAtomId + 2; stats.noteAtomLogged(newAtom1, now + 1); stats.noteAtomLogged(newAtom1, now + 2); Loading tools/stats_log_api_gen/Collation.cpp +0 −7 Original line number Diff line number Diff line Loading @@ -478,7 +478,6 @@ static void populateFieldNumberToAtomDeclSet(const shared_ptr<AtomDecl>& atomDec int collate_atoms(const Descriptor* descriptor, const string& moduleName, Atoms* atoms) { int errorCount = 0; int maxPushedAtomId = 2; for (int i = 0; i < descriptor->field_count(); i++) { const FieldDescriptor* atomField = descriptor->field(i); Loading Loading @@ -563,14 +562,8 @@ int collate_atoms(const Descriptor* descriptor, const string& moduleName, Atoms* atoms->non_chained_decls.insert(nonChainedAtomDecl); } if (atomDecl->code < PULL_ATOM_START_ID && atomDecl->code > maxPushedAtomId) { maxPushedAtomId = atomDecl->code; } } atoms->maxPushedAtomId = maxPushedAtomId; if (dbg) { printf("signatures = [\n"); for (SignatureInfoMap::const_iterator it = atoms->signatureInfoMap.begin(); Loading Loading
cmds/statsd/src/atoms.proto +3 −0 Original line number Diff line number Diff line Loading @@ -424,6 +424,9 @@ message Atom { UserLifecycleJourneyReported user_lifecycle_journey_reported = 264 [(module) = "framework"]; UserLifecycleEventOccurred user_lifecycle_event_occurred = 265 [(module) = "framework"]; SdkExtensionStatus sdk_extension_status = 354; // StatsdStats tracks platform atoms with ids upto 500. // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value. } // Pulled events will start at field 10000. Loading
cmds/statsd/src/guardrail/StatsdStats.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ const std::map<int, std::pair<size_t, size_t>> StatsdStats::kAtomDimensionKeySiz }; StatsdStats::StatsdStats() { mPushedAtomStats.resize(android::util::kMaxPushedAtomId + 1); mPushedAtomStats.resize(kMaxPushedAtomId + 1); mStartTimeSec = getWallClockSec(); } Loading Loading @@ -448,7 +448,7 @@ void StatsdStats::notePullExceedMaxDelay(int pullAtomId) { void StatsdStats::noteAtomLogged(int atomId, int32_t timeSec) { lock_guard<std::mutex> lock(mLock); if (atomId <= android::util::kMaxPushedAtomId) { if (atomId <= kMaxPushedAtomId) { mPushedAtomStats[atomId]++; } else { if (mNonPlatformPushedAtomStats.size() < kMaxNonPlatformPushedAtoms) { Loading
cmds/statsd/src/guardrail/StatsdStats.h +4 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,10 @@ public: // Maximum number of pushed atoms statsd stats will track above kMaxPushedAtomId. static const int kMaxNonPlatformPushedAtoms = 100; // Maximum atom id value that we consider a platform pushed atom. // This should be updated once highest pushed atom id in atoms.proto approaches this value. static const int kMaxPushedAtomId = 500; // Atom id that is the start of the pulled atoms. static const int kPullAtomStartTag = 10000; Loading
cmds/statsd/tests/guardrail/StatsdStats_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -254,8 +254,8 @@ TEST(StatsdStatsTest, TestAtomLog) { TEST(StatsdStatsTest, TestNonPlatformAtomLog) { StatsdStats stats; time_t now = time(nullptr); int newAtom1 = android::util::kMaxPushedAtomId + 1; int newAtom2 = android::util::kMaxPushedAtomId + 2; int newAtom1 = StatsdStats::kMaxPushedAtomId + 1; int newAtom2 = StatsdStats::kMaxPushedAtomId + 2; stats.noteAtomLogged(newAtom1, now + 1); stats.noteAtomLogged(newAtom1, now + 2); Loading
tools/stats_log_api_gen/Collation.cpp +0 −7 Original line number Diff line number Diff line Loading @@ -478,7 +478,6 @@ static void populateFieldNumberToAtomDeclSet(const shared_ptr<AtomDecl>& atomDec int collate_atoms(const Descriptor* descriptor, const string& moduleName, Atoms* atoms) { int errorCount = 0; int maxPushedAtomId = 2; for (int i = 0; i < descriptor->field_count(); i++) { const FieldDescriptor* atomField = descriptor->field(i); Loading Loading @@ -563,14 +562,8 @@ int collate_atoms(const Descriptor* descriptor, const string& moduleName, Atoms* atoms->non_chained_decls.insert(nonChainedAtomDecl); } if (atomDecl->code < PULL_ATOM_START_ID && atomDecl->code > maxPushedAtomId) { maxPushedAtomId = atomDecl->code; } } atoms->maxPushedAtomId = maxPushedAtomId; if (dbg) { printf("signatures = [\n"); for (SignatureInfoMap::const_iterator it = atoms->signatureInfoMap.begin(); Loading