1/* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto3"; 18 19package android.automotive.watchdog; 20 21option java_multiple_files = true; 22option java_package = "android.automotive.watchdog"; 23 24// Represents the performance stats captured by the CarWatchdog daemon. 25message PerformanceStats { 26 optional StatsCollection boot_time_stats = 1; 27 optional StatsCollection wake_up_stats = 2; 28 repeated UserSwitchStatsCollection user_switch_stats = 3; 29 optional StatsCollection last_n_minutes_stats = 4; 30 optional StatsCollection custom_collection_stats = 5; 31 // Deprecated field #6. Do not use this field position. 32 reserved 6; 33} 34 35// Represents the performance stats captured during a single event as a record. 36message StatsCollection { 37 optional int64 collection_interval_millis = 1; 38 repeated StatsRecord records = 2; 39} 40 41// Represents user switch performance stats captured during a single event. 42message UserSwitchStatsCollection { 43 optional int32 to_user_id = 1; 44 optional int32 from_user_id = 2; 45 optional StatsCollection user_switch_collection = 3; 46} 47 48// Represents the performance stats captured during a single poll. 49message StatsRecord { 50 optional int32 id = 1; 51 optional Date date = 2; 52 optional TimeOfDay time = 3; 53 optional SystemWideStats system_wide_stats = 4; 54 repeated PackageCpuStats package_cpu_stats = 5; 55 repeated PackageStorageIoStats package_storage_io_read_stats = 6; 56 repeated PackageStorageIoStats package_storage_io_write_stats = 7; 57 repeated PackageTaskStateStats package_task_state_stats = 8; 58 repeated PackageMajorPageFaults package_major_page_faults = 9; 59} 60 61// Represents the system-wide performance summary stats. 62message SystemWideStats { 63 optional int32 io_wait_time_millis = 1; 64 optional int32 idle_cpu_time_millis = 2; 65 optional int32 total_cpu_time_millis = 3; 66 optional int64 total_cpu_cycles = 4; 67 optional int64 total_context_switches = 5; 68 optional int32 total_io_blocked_processes = 6; 69 optional int32 total_major_page_faults = 7; 70 optional StorageIoStats total_storage_io_stats = 8; 71} 72 73// Represents the CPU stats for a user package. 74message PackageCpuStats { 75 message CpuStats { 76 optional int32 cpu_time_millis = 1; 77 optional int64 cpu_cycles = 2; 78 } 79 80 message ProcessCpuStats { 81 optional string command = 1; 82 optional CpuStats cpu_stats = 2; 83 } 84 85 optional UserPackageInfo user_package_info = 1; 86 optional CpuStats cpu_stats = 2; 87 repeated ProcessCpuStats process_cpu_stats = 3; 88} 89 90// Represents the storage I/O stats for a user package. 91message PackageStorageIoStats { 92 optional UserPackageInfo user_package_info = 1; 93 optional StorageIoStats storage_io_stats = 2; 94} 95 96message StorageIoStats { 97 optional int64 fg_bytes = 1; 98 optional int32 fg_fsync = 2; 99 optional int64 bg_bytes = 3; 100 optional int32 bg_fsync = 4; 101} 102 103// Represents the task state stats for a user package. 104message PackageTaskStateStats { 105 message ProcessTaskStateStats { 106 optional string command = 1; 107 optional int32 io_blocked_task_count = 2; 108 } 109 110 optional UserPackageInfo user_package_info = 1; 111 optional int32 io_blocked_task_count = 2; 112 optional int32 total_task_count = 3; 113 repeated ProcessTaskStateStats process_task_state_stats = 4; 114} 115 116// Represents the major page fault stats for a user package. 117message PackageMajorPageFaults { 118 optional UserPackageInfo user_package_info = 1; 119 optional int32 major_page_faults_count = 2; 120} 121 122message UserPackageInfo { 123 optional int32 user_id = 1; 124 optional string package_name = 2; 125} 126 127// Represents a whole or partial calendar date, such as a birthday. The time of 128// day and time zone are either specified elsewhere or are insignificant. The 129// date is relative to the Gregorian Calendar. This can represent one of the 130// following: 131// 132// * A full date, with non-zero year, month, and day values 133// * A month and day value, with a zero year, such as an anniversary 134// * A year on its own, with zero month and day values 135// * A year and month value, with a zero day, such as a credit card expiration 136// date 137// 138// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and 139// `google.protobuf.Timestamp`. 140// 141// Copied from: 142// https://github.com/googleapis/googleapis/blob/master/google/type/date.proto 143message Date { 144 // Year of the date. Must be from 1 to 9999, or 0 to specify a date without 145 // a year. 146 optional int32 year = 1; 147 148 // Month of a year. Must be from 1 to 12, or 0 to specify a year without a 149 // month and day. 150 optional int32 month = 2; 151 152 // Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 153 // to specify a year by itself or a year and month where the day isn't 154 // significant. 155 optional int32 day = 3; 156} 157 158// Represents a time of day. The date and time zone are either not significant 159// or are specified elsewhere. An API may choose to allow leap seconds. Related 160// types are [google.type.Date][google.type.Date] and 161// `google.protobuf.Timestamp`. 162// 163// Copied from: 164// https://github.com/googleapis/googleapis/blob/master/google/type/timeofday.proto 165message TimeOfDay { 166 // Hours of day in 24 hour format. Should be from 0 to 23. An API may choose 167 // to allow the value "24:00:00" for scenarios like business closing time. 168 optional int32 hours = 1; 169 170 // Minutes of hour of day. Must be from 0 to 59. 171 optional int32 minutes = 2; 172 173 // Seconds of minutes of the time. Must normally be from 0 to 59. An API may 174 // allow the value 60 if it allows leap-seconds. 175 optional int32 seconds = 3; 176 177 // Modified from nanoseconds. 178 // Fractions of seconds in milliseconds. Must be from 0 to 999. 179 optional int32 millis = 4; 180} 181