[fuchsia_system_metrics] Have CPU send data to Cobalt as histograms to reduce data sent
Corresponding fuchsia change:
https://fuchsia-review.googlesource.com/c/fuchsia/+/349331
Bug: 40088
Change-Id: I44163f46f7316a99f67c3538c08af1269f909192
diff --git a/fuchsia/fuchsia_system_metrics/metrics.yaml b/fuchsia/fuchsia_system_metrics/metrics.yaml
index 7aa9c23..cb4e38d 100644
--- a/fuchsia/fuchsia_system_metrics/metrics.yaml
+++ b/fuchsia/fuchsia_system_metrics/metrics.yaml
@@ -213,6 +213,7 @@
expiration_date: "2020/10/25"
#####################################################################
+# ****** WILL DEPRECATE. Use id 8 below instead. ******
# fuchsia CPU% * 100 averaged over all cores taken per sec
#
# For every second, a syscall is made to fetch the CPU idle time for
@@ -239,11 +240,6 @@
#####################################################################
# fuchsia_cpu_usage
#####################################################################
- - report_name: fuchsia_cpu_percentage_numeric_aggr_experimental
- id: 3690145731 # legacy long report_id
- report_type: NUMERIC_AGGREGATION
- percentiles: [5, 10, 90, 95, 99]
- system_profile_field: [BOARD_NAME, PRODUCT_NAME, ARCH, SYSTEM_VERSION, OS, CHANNEL]
- report_name: fuchsia_cpu_percentage_histogram_experimental
id: 1375790990 # legacy long report_id
report_type: INT_RANGE_HISTOGRAM
@@ -351,3 +347,43 @@
meta_data:
max_release_stage: GA
expiration_date: "2020/10/25"
+
+
+#####################################################################
+# fuchsia CPU% * 100 averaged over all cores taken per sec
+#
+# For every second, a syscall is made to fetch the CPU idle time for
+# each CPU core. With that, we calculate the CPU% which is
+# (busy time / 1 sec * 100) for each core. Assuming all cores are
+# the same, we take the average CPU% over all cores.
+# Note that Cobalt only take integer input, so we further multiply the
+# average CPU% by 100 to get 2 decimal places.
+# We aggregate 10 minutes of data before flushing them into Cobalt in
+# one FIDL call.
+# Estimated number of events per day is 3 * (24 * 60)/10 = 432.
+#####################################################################
+- id: 8
+ metric_name: cpu_percentage
+ metric_type: INT_HISTOGRAM
+ metric_dimensions:
+ - dimension: device_state
+ event_codes:
+ 0: Unknown
+ 1: Idle
+ 2: Active
+ int_buckets:
+ linear:
+ floor: 0
+ num_buckets: 1000 # 0.00% - 100.00%.
+ step_size: 10 # 0.10%
+ reports:
+ #####################################################################
+ # fuchsia_cpu_usage
+ #####################################################################
+ - report_name: cpu_percentage_histogram
+ id: 1
+ report_type: INT_RANGE_HISTOGRAM
+ system_profile_field: [BOARD_NAME, PRODUCT_NAME, ARCH, SYSTEM_VERSION, OS, CHANNEL]
+ meta_data:
+ max_release_stage: GA
+ expiration_date: "2020/12/17"