diff options
Diffstat (limited to 'cmds/statsd/src/atom_field_options.proto')
-rw-r--r-- | cmds/statsd/src/atom_field_options.proto | 85 |
1 files changed, 56 insertions, 29 deletions
diff --git a/cmds/statsd/src/atom_field_options.proto b/cmds/statsd/src/atom_field_options.proto index 16c936c41559..ff5717e4fa78 100644 --- a/cmds/statsd/src/atom_field_options.proto +++ b/cmds/statsd/src/atom_field_options.proto @@ -23,45 +23,72 @@ option java_outer_classname = "AtomFieldOptions"; import "google/protobuf/descriptor.proto"; -enum StateField { - // Default value for fields that are not primary or exclusive state. - STATE_FIELD_UNSET = 0; - // Fields that represent the key that the state belongs to. - PRIMARY = 1; - // The field that represents the state. It's an exclusive state. - EXCLUSIVE = 2; -} - -// Used to annotate an atom that reprsents a state change. A state change atom must have exactly ONE -// exclusive state field, and any number of primary key fields. -// For example, -// message UidProcessStateChanged { -// optional int32 uid = 1 [(state_field_option).option = PRIMARY]; -// optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE]; +// Used to annotate an atom that represents a state change. A state change atom must have exactly +// ONE exclusive state field, and any number of primary key fields. For example, message +// UidProcessStateChanged { +// optional int32 uid = 1 [(state_field_option).primary_field = true]; +// optional android.app.ProcessStateEnum state = +// 2 [(state_field_option).exclusive_state = true]; // } -// Each of this UidProcessStateChanged atom represents a state change for a specific uid. +// Each UidProcessStateChanged atom event represents a state change for a specific uid. // A new state automatically overrides the previous state. // -// If the atom has 2 or more primary fields, it means the combination of the primary fields are -// the primary key. +// If the atom has 2 or more primary fields, it means the combination of the +// primary fields are the primary key. // For example: // message ThreadStateChanged { -// 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]; +// optional int32 pid = 1 [(state_field_option).primary_field = true]; +// optional int32 tid = 2 [(state_field_option).primary_field = true]; +// optional int32 state = 3 [(state_field_option).exclusive_state = true]; // } // // Sometimes, there is no primary key field, when the state is GLOBAL. // For example, -// // message ScreenStateChanged { -// optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE]; +// optional android.view.DisplayStateEnum state = +// 1 [(state_field_option).exclusive_state = true]; // } // -// Only fields of primary types can be annotated. AttributionNode cannot be primary keys (and they -// usually are not). +// For state atoms with attribution chain, sometimes the primary key is the first uid in the chain. +// For example: +// message AudioStateChanged { +// repeated AttributionNode attribution_node = 1 +// [(stateFieldOption).primary_field_first_uid = true]; +// +// enum State { +// OFF = 0; +// ON = 1; +// // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes). +// RESET = 2; +// } +// optional State state = 2 [(stateFieldOption).exclusive_state = true]; +// } message StateAtomFieldOption { - optional StateField option = 1 [default = STATE_FIELD_UNSET]; + // Fields that represent the key that the state belongs to. + // Used on simple proto fields. Do not use on attribution chains. + optional bool primary_field = 1 [default = false]; + + // The field that represents the state. It's an exclusive state. + optional bool exclusive_state = 2 [default = false]; + + // Used on an attribution chain field to indicate that the first uid is the + // primary field. + optional bool primary_field_first_uid = 3 [default = false]; + + // Note: We cannot annotate directly on the enums because many enums are imported from other + // proto files in the platform. proto-lite cc library does not support annotations unfortunately + + // Knowing the default state value allows state trackers to remove entries that become the + // default state. If there is no default value specified, the default value is unknown, and all + // states will be tracked in memory. + optional int32 default_state_value = 4; + + // A reset state signals all states go to default value. For example, BLE reset means all active + // BLE scans are to be turned off. + optional int32 trigger_state_reset_value = 5; + + // If the state change needs to count nesting. + optional bool nested = 6 [default = true]; } // Used to generate StatsLog.write APIs. @@ -83,7 +110,7 @@ extend google.protobuf.FieldOptions { optional LogMode log_mode = 50002 [default = MODE_AUTOMATIC]; - optional bool allow_from_any_uid = 50003 [default = false]; + repeated string module = 50004; - optional string log_from_module = 50004; -}
\ No newline at end of file + optional bool truncate_timestamp = 50005 [default = false]; +} |