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