Loading cmds/statsd/src/FieldValue.h +5 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,11 @@ inline Matcher getSimpleMatcher(int32_t tag, size_t field) { return Matcher(Field(tag, getSimpleField(field)), 0xff7f0000); } inline Matcher getFirstUidMatcher(int32_t atomId) { int32_t pos[] = {1, 1, 1}; return Matcher(Field(atomId, pos, 2), 0xff7f7f7f); } /** * A wrapper for a union type to contain multiple types of values. * Loading cmds/statsd/src/atom_field_options.proto +2 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ enum StateField { PRIMARY = 1; // The field that represents the state. It's an exclusive state. EXCLUSIVE = 2; PRIMARY_FIELD_FIRST_UID = 3; } // Used to annotate an atom that reprsents a state change. A state change atom must have exactly ONE Loading cmds/statsd/src/atoms.proto +6 −4 Original line number Diff line number Diff line Loading @@ -908,14 +908,16 @@ message CameraStateChanged { * TODO */ message WakelockStateChanged { repeated AttributionNode attribution_node = 1; repeated AttributionNode attribution_node = 1 [(state_field_option).option = PRIMARY_FIELD_FIRST_UID]; // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock. // From frameworks/base/core/proto/android/os/enums.proto. optional android.os.WakeLockLevelEnum type = 2; optional android.os.WakeLockLevelEnum type = 2 [(state_field_option).option = PRIMARY]; ; // The wakelock tag (Called tag in the Java API, sometimes name elsewhere). optional string tag = 3; optional string tag = 3 [(state_field_option).option = PRIMARY]; enum State { RELEASE = 0; Loading @@ -923,7 +925,7 @@ message WakelockStateChanged { CHANGE_RELEASE = 2; CHANGE_ACQUIRE = 3; } optional State state = 4; optional State state = 4 [(state_field_option).option = EXCLUSIVE]; } /** Loading cmds/statsd/src/state/StateTracker.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -28,10 +28,14 @@ namespace statsd { StateTracker::StateTracker(const int32_t atomId, const util::StateAtomFieldOptions& stateAtomInfo) : mAtomId(atomId), mStateField(getSimpleMatcher(atomId, stateAtomInfo.exclusiveField)) { // create matcher for each primary field // TODO(tsaichristine): b/142108433 handle when primary field is first uid in chain for (const auto& primary : stateAtomInfo.primaryFields) { Matcher matcher = getSimpleMatcher(atomId, primary); for (const auto& primaryField : stateAtomInfo.primaryFields) { if (primaryField == util::FIRST_UID_IN_CHAIN) { Matcher matcher = getFirstUidMatcher(atomId); mPrimaryFields.push_back(matcher); } else { Matcher matcher = getSimpleMatcher(atomId, primaryField); mPrimaryFields.push_back(matcher); } } // TODO(tsaichristine): b/142108433 set default state, reset state, and nesting Loading cmds/statsd/src/state/StateTracker.h +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ private: int32_t mDefaultState = kStateUnknown; int32_t mResetState; int32_t mResetState = kStateUnknown; // Maps primary key to state value info std::unordered_map<HashableDimensionKey, StateValueInfo> mStateMap; Loading Loading
cmds/statsd/src/FieldValue.h +5 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,11 @@ inline Matcher getSimpleMatcher(int32_t tag, size_t field) { return Matcher(Field(tag, getSimpleField(field)), 0xff7f0000); } inline Matcher getFirstUidMatcher(int32_t atomId) { int32_t pos[] = {1, 1, 1}; return Matcher(Field(atomId, pos, 2), 0xff7f7f7f); } /** * A wrapper for a union type to contain multiple types of values. * Loading
cmds/statsd/src/atom_field_options.proto +2 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ enum StateField { PRIMARY = 1; // The field that represents the state. It's an exclusive state. EXCLUSIVE = 2; PRIMARY_FIELD_FIRST_UID = 3; } // Used to annotate an atom that reprsents a state change. A state change atom must have exactly ONE Loading
cmds/statsd/src/atoms.proto +6 −4 Original line number Diff line number Diff line Loading @@ -908,14 +908,16 @@ message CameraStateChanged { * TODO */ message WakelockStateChanged { repeated AttributionNode attribution_node = 1; repeated AttributionNode attribution_node = 1 [(state_field_option).option = PRIMARY_FIELD_FIRST_UID]; // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock. // From frameworks/base/core/proto/android/os/enums.proto. optional android.os.WakeLockLevelEnum type = 2; optional android.os.WakeLockLevelEnum type = 2 [(state_field_option).option = PRIMARY]; ; // The wakelock tag (Called tag in the Java API, sometimes name elsewhere). optional string tag = 3; optional string tag = 3 [(state_field_option).option = PRIMARY]; enum State { RELEASE = 0; Loading @@ -923,7 +925,7 @@ message WakelockStateChanged { CHANGE_RELEASE = 2; CHANGE_ACQUIRE = 3; } optional State state = 4; optional State state = 4 [(state_field_option).option = EXCLUSIVE]; } /** Loading
cmds/statsd/src/state/StateTracker.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -28,10 +28,14 @@ namespace statsd { StateTracker::StateTracker(const int32_t atomId, const util::StateAtomFieldOptions& stateAtomInfo) : mAtomId(atomId), mStateField(getSimpleMatcher(atomId, stateAtomInfo.exclusiveField)) { // create matcher for each primary field // TODO(tsaichristine): b/142108433 handle when primary field is first uid in chain for (const auto& primary : stateAtomInfo.primaryFields) { Matcher matcher = getSimpleMatcher(atomId, primary); for (const auto& primaryField : stateAtomInfo.primaryFields) { if (primaryField == util::FIRST_UID_IN_CHAIN) { Matcher matcher = getFirstUidMatcher(atomId); mPrimaryFields.push_back(matcher); } else { Matcher matcher = getSimpleMatcher(atomId, primaryField); mPrimaryFields.push_back(matcher); } } // TODO(tsaichristine): b/142108433 set default state, reset state, and nesting Loading
cmds/statsd/src/state/StateTracker.h +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ private: int32_t mDefaultState = kStateUnknown; int32_t mResetState; int32_t mResetState = kStateUnknown; // Maps primary key to state value info std::unordered_map<HashableDimensionKey, StateValueInfo> mStateMap; Loading