1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
// This file was generated by Cobalt's Registry parser based on the registry YAML
// in the cobalt_config repository. Edit the YAML there to make changes.
pub mod power_manager_metrics {
pub const CUSTOMER_NAME: &str = "fuchsia";
pub const CUSTOMER_ID: u32 = 1;
pub const PROJECT_NAME: &str = "power";
pub const PROJECT_ID: u32 = 3;

// Linear bucket constants for raw_temperature_migrated
pub const RAW_TEMPERATURE_MIGRATED_INT_BUCKETS_FLOOR: i64 = 20;
pub const RAW_TEMPERATURE_MIGRATED_INT_BUCKETS_NUM_BUCKETS: u32 = 80;
pub const RAW_TEMPERATURE_MIGRATED_INT_BUCKETS_STEP_SIZE: u32 = 1;

// Linear bucket constants for min_power_consumption
pub const MIN_POWER_CONSUMPTION_INT_BUCKETS_FLOOR: i64 = 0;
pub const MIN_POWER_CONSUMPTION_INT_BUCKETS_NUM_BUCKETS: u32 = 100;
pub const MIN_POWER_CONSUMPTION_INT_BUCKETS_STEP_SIZE: u32 = 50;

// Linear bucket constants for max_power_consumption
pub const MAX_POWER_CONSUMPTION_INT_BUCKETS_FLOOR: i64 = 0;
pub const MAX_POWER_CONSUMPTION_INT_BUCKETS_NUM_BUCKETS: u32 = 100;
pub const MAX_POWER_CONSUMPTION_INT_BUCKETS_STEP_SIZE: u32 = 50;

// Linear bucket constants for avg_power_consumption
pub const AVG_POWER_CONSUMPTION_INT_BUCKETS_FLOOR: i64 = 0;
pub const AVG_POWER_CONSUMPTION_INT_BUCKETS_NUM_BUCKETS: u32 = 100;
pub const AVG_POWER_CONSUMPTION_INT_BUCKETS_STEP_SIZE: u32 = 50;

// Linear bucket constants for median_power_consumption
pub const MEDIAN_POWER_CONSUMPTION_INT_BUCKETS_FLOOR: i64 = 0;
pub const MEDIAN_POWER_CONSUMPTION_INT_BUCKETS_NUM_BUCKETS: u32 = 100;
pub const MEDIAN_POWER_CONSUMPTION_INT_BUCKETS_STEP_SIZE: u32 = 50;

// Metric ID Constants
// thermal_limit_result_migrated
pub const THERMAL_LIMIT_RESULT_MIGRATED_METRIC_ID: u32 = 105;
// raw_temperature_migrated
pub const RAW_TEMPERATURE_MIGRATED_METRIC_ID: u32 = 106;
// min_power_consumption
pub const MIN_POWER_CONSUMPTION_METRIC_ID: u32 = 1004;
// max_power_consumption
pub const MAX_POWER_CONSUMPTION_METRIC_ID: u32 = 1005;
// avg_power_consumption
pub const AVG_POWER_CONSUMPTION_METRIC_ID: u32 = 1006;
// median_power_consumption
pub const MEDIAN_POWER_CONSUMPTION_METRIC_ID: u32 = 1007;

// Enum for power (Metric Dimension result)
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
pub enum PowerMetricDimensionResult {
  Mitigated = 0,
  Shutdown = 1,
}

impl cobalt_client::traits::AsEventCode for PowerMetricDimensionResult {
  fn as_event_code(&self) -> u32 {
    *self as u32
  }
}
// Alias for thermal_limit_result_migrated (Metric Dimension result) which has the same event codes
pub use PowerMetricDimensionResult as ThermalLimitResultMigratedMetricDimensionResult;

// Enum for power (Metric Dimension sensor)
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
pub enum PowerMetricDimensionSensor {
  Ambient = 0,
  ThermalPolicyInput1 = 1,
}

impl cobalt_client::traits::AsEventCode for PowerMetricDimensionSensor {
  fn as_event_code(&self) -> u32 {
    *self as u32
  }
}
// Alias for raw_temperature_migrated (Metric Dimension sensor) which has the same event codes
pub use PowerMetricDimensionSensor as RawTemperatureMigratedMetricDimensionSensor;

// Enum for power (Metric Dimension sensor_target)
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
pub enum PowerMetricDimensionSensorTarget {
  Unknown = 0,
  Mlb = 1,
  Audio = 2,
}

impl cobalt_client::traits::AsEventCode for PowerMetricDimensionSensorTarget {
  fn as_event_code(&self) -> u32 {
    *self as u32
  }
}
// Alias for min_power_consumption (Metric Dimension sensor_target) which has the same event codes
pub use PowerMetricDimensionSensorTarget as MinPowerConsumptionMetricDimensionSensorTarget;

// Alias for max_power_consumption (Metric Dimension sensor_target) which has the same event codes
pub use PowerMetricDimensionSensorTarget as MaxPowerConsumptionMetricDimensionSensorTarget;

// Alias for avg_power_consumption (Metric Dimension sensor_target) which has the same event codes
pub use PowerMetricDimensionSensorTarget as AvgPowerConsumptionMetricDimensionSensorTarget;

// Alias for median_power_consumption (Metric Dimension sensor_target) which has the same event codes
pub use PowerMetricDimensionSensorTarget as MedianPowerConsumptionMetricDimensionSensorTarget;

// Enum for power (Metric Dimension idleness)
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
pub enum PowerMetricDimensionIdleness {
  Unknown = 0,
  Idle = 1,
  Active = 2,
}

impl cobalt_client::traits::AsEventCode for PowerMetricDimensionIdleness {
  fn as_event_code(&self) -> u32 {
    *self as u32
  }
}
// Alias for min_power_consumption (Metric Dimension idleness) which has the same event codes
pub use PowerMetricDimensionIdleness as MinPowerConsumptionMetricDimensionIdleness;

// Alias for max_power_consumption (Metric Dimension idleness) which has the same event codes
pub use PowerMetricDimensionIdleness as MaxPowerConsumptionMetricDimensionIdleness;

// Alias for avg_power_consumption (Metric Dimension idleness) which has the same event codes
pub use PowerMetricDimensionIdleness as AvgPowerConsumptionMetricDimensionIdleness;

// Alias for median_power_consumption (Metric Dimension idleness) which has the same event codes
pub use PowerMetricDimensionIdleness as MedianPowerConsumptionMetricDimensionIdleness;

#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
pub struct MinPowerConsumptionEventCodes {
  pub sensor_target: MinPowerConsumptionMetricDimensionSensorTarget,
  pub idleness: MinPowerConsumptionMetricDimensionIdleness,
}

impl cobalt_client::traits::AsEventCodes for MinPowerConsumptionEventCodes {
  fn as_event_codes(&self) -> Vec<u32> {
    use cobalt_client::traits::AsEventCode;
    vec![
      self.sensor_target.as_event_code(),
      self.idleness.as_event_code(),
    ]
  }
}

#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
pub struct MaxPowerConsumptionEventCodes {
  pub sensor_target: MaxPowerConsumptionMetricDimensionSensorTarget,
  pub idleness: MaxPowerConsumptionMetricDimensionIdleness,
}

impl cobalt_client::traits::AsEventCodes for MaxPowerConsumptionEventCodes {
  fn as_event_codes(&self) -> Vec<u32> {
    use cobalt_client::traits::AsEventCode;
    vec![
      self.sensor_target.as_event_code(),
      self.idleness.as_event_code(),
    ]
  }
}

#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
pub struct AvgPowerConsumptionEventCodes {
  pub sensor_target: AvgPowerConsumptionMetricDimensionSensorTarget,
  pub idleness: AvgPowerConsumptionMetricDimensionIdleness,
}

impl cobalt_client::traits::AsEventCodes for AvgPowerConsumptionEventCodes {
  fn as_event_codes(&self) -> Vec<u32> {
    use cobalt_client::traits::AsEventCode;
    vec![
      self.sensor_target.as_event_code(),
      self.idleness.as_event_code(),
    ]
  }
}

#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
pub struct MedianPowerConsumptionEventCodes {
  pub sensor_target: MedianPowerConsumptionMetricDimensionSensorTarget,
  pub idleness: MedianPowerConsumptionMetricDimensionIdleness,
}

impl cobalt_client::traits::AsEventCodes for MedianPowerConsumptionEventCodes {
  fn as_event_codes(&self) -> Vec<u32> {
    use cobalt_client::traits::AsEventCode;
    vec![
      self.sensor_target.as_event_code(),
      self.idleness.as_event_code(),
    ]
  }
}

}