Loading cmds/statsd/src/atom_field_options.proto +7 −7 Original line number Diff line number Diff line Loading @@ -36,8 +36,8 @@ enum StateField { // exclusive state field, and any number of primary key fields. // For example, // message UidProcessStateChanged { // optional int32 uid = 1 [(stateFieldOption).option = PRIMARY]; // optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE]; // optional int32 uid = 1 [(state_field_option).option = PRIMARY]; // optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE]; // } // Each of this UidProcessStateChanged atom represents a state change for a specific uid. // A new state automatically overrides the previous state. Loading @@ -46,16 +46,16 @@ enum StateField { // the primary key. // For example: // message ThreadStateChanged { // optional int32 pid = 1 [(stateFieldOption).option = PRIMARY]; // optional int32 tid = 2 [(stateFieldOption).option = PRIMARY]; // optional int32 state = 3 [(stateFieldOption).option = EXCLUSIVE]; // optional int32 pid = 1 [(state_field_option).option = PRIMARY]; // optional int32 tid = 2 [(state_field_option).option = PRIMARY]; // optional int32 state = 3 [(state_field_option).option = EXCLUSIVE]; // } // // Sometimes, there is no primary key field, when the state is GLOBAL. // For example, // // message ScreenStateChanged { // optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE]; // optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE]; // } // // Only fields of primary types can be annotated. AttributionNode cannot be primary keys (and they Loading @@ -66,7 +66,7 @@ message StateAtomFieldOption { extend google.protobuf.FieldOptions { // Flags to decorate an atom that presents a state change. optional StateAtomFieldOption stateFieldOption = 50000; optional StateAtomFieldOption state_field_option = 50000; // Flags to decorate the uid fields in an atom. optional bool is_uid = 50001 [default = false]; Loading cmds/statsd/src/atoms.proto +6 −6 Original line number Diff line number Diff line Loading @@ -274,7 +274,7 @@ message ThermalThrottlingStateChanged { */ message ScreenStateChanged { // New screen state, from frameworks/base/core/proto/android/view/enums.proto. optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE]; optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE]; } /** Loading @@ -285,10 +285,10 @@ message ScreenStateChanged { * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java */ message UidProcessStateChanged { optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true]; optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true]; // The state, from frameworks/base/core/proto/android/app/enums.proto. optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE]; optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE]; } /** Loading Loading @@ -320,7 +320,7 @@ message ActivityManagerSleepStateChanged { ASLEEP = 1; AWAKE = 2; } optional State state = 1 [(stateFieldOption).option = EXCLUSIVE]; optional State state = 1 [(state_field_option).option = EXCLUSIVE]; } /** Loading @@ -339,7 +339,7 @@ message MemoryFactorStateChanged { CRITICAL = 4; // critical memory. } optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE]; optional State factor = 1 [(state_field_option).option = EXCLUSIVE]; } /** Loading Loading @@ -1940,7 +1940,7 @@ message LmkKillOccurred { */ message AppDied { // timestamp(elapsedRealtime) of record creation optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE]; optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE]; } /** Loading tools/stats_log_api_gen/Collation.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -251,7 +251,7 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl, } atomDecl->fields.push_back(atField); if (field->options().GetExtension(os::statsd::stateFieldOption).option() == if (field->options().GetExtension(os::statsd::state_field_option).option() == os::statsd::StateField::PRIMARY) { if (javaType == JAVA_TYPE_UNKNOWN || javaType == JAVA_TYPE_ATTRIBUTION_CHAIN || Loading @@ -261,7 +261,7 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl, atomDecl->primaryFields.push_back(it->first); } if (field->options().GetExtension(os::statsd::stateFieldOption).option() == if (field->options().GetExtension(os::statsd::state_field_option).option() == os::statsd::StateField::EXCLUSIVE) { if (javaType == JAVA_TYPE_UNKNOWN || javaType == JAVA_TYPE_ATTRIBUTION_CHAIN || Loading tools/stats_log_api_gen/test.proto +12 −12 Original line number Diff line number Diff line Loading @@ -127,33 +127,33 @@ message GoodStateAtoms { // The atom has only primary field but no exclusive state field. message BadStateAtom1 { optional int32 uid = 1 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; } // Only primative types can be annotated. message BadStateAtom2 { repeated android.os.statsd.AttributionNode attribution = 1 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; optional int32 state = 2 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; } // Having 2 exclusive state field in the atom means the atom is badly designed. // E.g., putting bluetooth state and wifi state in the same atom. message BadStateAtom3 { optional int32 uid = 1 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; optional int32 state = 2 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; optional int32 state2 = 3 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; } message GoodStateAtom1 { optional int32 uid = 1 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; optional int32 state = 2 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; } // Atoms can have exclusive state field, but no primary field. That means Loading @@ -161,16 +161,16 @@ message GoodStateAtom1 { message GoodStateAtom2 { optional int32 uid = 1; optional int32 state = 2 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; } // We can have more than one primary fields. That means their combination is a // primary key. message GoodStateAtom3 { optional int32 uid = 1 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; optional int32 tid = 2 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; optional int32 state = 3 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; } No newline at end of file Loading
cmds/statsd/src/atom_field_options.proto +7 −7 Original line number Diff line number Diff line Loading @@ -36,8 +36,8 @@ enum StateField { // exclusive state field, and any number of primary key fields. // For example, // message UidProcessStateChanged { // optional int32 uid = 1 [(stateFieldOption).option = PRIMARY]; // optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE]; // optional int32 uid = 1 [(state_field_option).option = PRIMARY]; // optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE]; // } // Each of this UidProcessStateChanged atom represents a state change for a specific uid. // A new state automatically overrides the previous state. Loading @@ -46,16 +46,16 @@ enum StateField { // the primary key. // For example: // message ThreadStateChanged { // optional int32 pid = 1 [(stateFieldOption).option = PRIMARY]; // optional int32 tid = 2 [(stateFieldOption).option = PRIMARY]; // optional int32 state = 3 [(stateFieldOption).option = EXCLUSIVE]; // optional int32 pid = 1 [(state_field_option).option = PRIMARY]; // optional int32 tid = 2 [(state_field_option).option = PRIMARY]; // optional int32 state = 3 [(state_field_option).option = EXCLUSIVE]; // } // // Sometimes, there is no primary key field, when the state is GLOBAL. // For example, // // message ScreenStateChanged { // optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE]; // optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE]; // } // // Only fields of primary types can be annotated. AttributionNode cannot be primary keys (and they Loading @@ -66,7 +66,7 @@ message StateAtomFieldOption { extend google.protobuf.FieldOptions { // Flags to decorate an atom that presents a state change. optional StateAtomFieldOption stateFieldOption = 50000; optional StateAtomFieldOption state_field_option = 50000; // Flags to decorate the uid fields in an atom. optional bool is_uid = 50001 [default = false]; Loading
cmds/statsd/src/atoms.proto +6 −6 Original line number Diff line number Diff line Loading @@ -274,7 +274,7 @@ message ThermalThrottlingStateChanged { */ message ScreenStateChanged { // New screen state, from frameworks/base/core/proto/android/view/enums.proto. optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE]; optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE]; } /** Loading @@ -285,10 +285,10 @@ message ScreenStateChanged { * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java */ message UidProcessStateChanged { optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true]; optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true]; // The state, from frameworks/base/core/proto/android/app/enums.proto. optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE]; optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE]; } /** Loading Loading @@ -320,7 +320,7 @@ message ActivityManagerSleepStateChanged { ASLEEP = 1; AWAKE = 2; } optional State state = 1 [(stateFieldOption).option = EXCLUSIVE]; optional State state = 1 [(state_field_option).option = EXCLUSIVE]; } /** Loading @@ -339,7 +339,7 @@ message MemoryFactorStateChanged { CRITICAL = 4; // critical memory. } optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE]; optional State factor = 1 [(state_field_option).option = EXCLUSIVE]; } /** Loading Loading @@ -1940,7 +1940,7 @@ message LmkKillOccurred { */ message AppDied { // timestamp(elapsedRealtime) of record creation optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE]; optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE]; } /** Loading
tools/stats_log_api_gen/Collation.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -251,7 +251,7 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl, } atomDecl->fields.push_back(atField); if (field->options().GetExtension(os::statsd::stateFieldOption).option() == if (field->options().GetExtension(os::statsd::state_field_option).option() == os::statsd::StateField::PRIMARY) { if (javaType == JAVA_TYPE_UNKNOWN || javaType == JAVA_TYPE_ATTRIBUTION_CHAIN || Loading @@ -261,7 +261,7 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl, atomDecl->primaryFields.push_back(it->first); } if (field->options().GetExtension(os::statsd::stateFieldOption).option() == if (field->options().GetExtension(os::statsd::state_field_option).option() == os::statsd::StateField::EXCLUSIVE) { if (javaType == JAVA_TYPE_UNKNOWN || javaType == JAVA_TYPE_ATTRIBUTION_CHAIN || Loading
tools/stats_log_api_gen/test.proto +12 −12 Original line number Diff line number Diff line Loading @@ -127,33 +127,33 @@ message GoodStateAtoms { // The atom has only primary field but no exclusive state field. message BadStateAtom1 { optional int32 uid = 1 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; } // Only primative types can be annotated. message BadStateAtom2 { repeated android.os.statsd.AttributionNode attribution = 1 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; optional int32 state = 2 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; } // Having 2 exclusive state field in the atom means the atom is badly designed. // E.g., putting bluetooth state and wifi state in the same atom. message BadStateAtom3 { optional int32 uid = 1 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; optional int32 state = 2 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; optional int32 state2 = 3 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; } message GoodStateAtom1 { optional int32 uid = 1 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; optional int32 state = 2 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; } // Atoms can have exclusive state field, but no primary field. That means Loading @@ -161,16 +161,16 @@ message GoodStateAtom1 { message GoodStateAtom2 { optional int32 uid = 1; optional int32 state = 2 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; } // We can have more than one primary fields. That means their combination is a // primary key. message GoodStateAtom3 { optional int32 uid = 1 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; optional int32 tid = 2 [(android.os.statsd.stateFieldOption).option = PRIMARY]; [(android.os.statsd.state_field_option).option = PRIMARY]; optional int32 state = 3 [(android.os.statsd.stateFieldOption).option = EXCLUSIVE]; [(android.os.statsd.state_field_option).option = EXCLUSIVE]; } No newline at end of file