1/*
2 * Copyright (C) 2022 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 = "proto2";
18
19package carwatchdog;
20
21// Represents a whole or partial calendar date, such as a birthday. The time of
22// day and time zone are either specified elsewhere or are insignificant. The
23// date is relative to the Gregorian Calendar. This can represent one of the
24// following:
25//
26// * A full date, with non-zero year, month, and day values
27// * A month and day value, with a zero year, such as an anniversary
28// * A year on its own, with zero month and day values
29// * A year and month value, with a zero day, such as a credit card expiration
30// date
31//
32// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and
33// `google.protobuf.Timestamp`.
34//
35// Copied from:
36// https://github.com/googleapis/googleapis/blob/master/google/type/date.proto
37message Date {
38  // Year of the date. Must be from 1 to 9999, or 0 to specify a date without
39  // a year.
40  optional int32 year = 1;
41
42  // Month of a year. Must be from 1 to 12, or 0 to specify a year without a
43  // month and day.
44  optional int32 month = 2;
45
46  // Day of a month. Must be from 1 to 31 and valid for the year and month, or 0
47  // to specify a year by itself or a year and month where the day isn't
48  // significant.
49  optional int32 day = 3;
50}
51
52// Represents a time of day. The date and time zone are either not significant
53// or are specified elsewhere. An API may choose to allow leap seconds. Related
54// types are [google.type.Date][google.type.Date] and
55// `google.protobuf.Timestamp`.
56//
57// Copied from:
58// https://github.com/googleapis/googleapis/blob/master/google/type/timeofday.proto
59message TimeOfDay {
60  // Hours of day in 24 hour format. Should be from 0 to 23. An API may choose
61  // to allow the value "24:00:00" for scenarios like business closing time.
62  optional int32 hours = 1;
63
64  // Minutes of hour of day. Must be from 0 to 59.
65  optional int32 minutes = 2;
66
67  // Seconds of minutes of the time. Must normally be from 0 to 59. An API may
68  // allow the value 60 if it allows leap-seconds.
69  optional int32 seconds = 3;
70
71  // Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
72  optional int32 nanos = 4;
73}
74
75message ProcessCpuStats {
76  optional string command = 1;
77  optional int32 cpu_time_ms = 2;
78  optional float package_cpu_time_percent = 3;
79  optional int64 cpu_cycles = 4;
80}
81
82message PackageCpuStats {
83  optional int32 user_id = 1;
84  optional string package_name = 2;
85  optional int32 cpu_time_ms = 3;
86  optional float total_cpu_time_percent = 4;
87  optional int64 cpu_cycles = 5;
88  repeated ProcessCpuStats process_cpu_stats = 6;
89}
90
91message PackageStorageIoStats {
92  optional int32 user_id = 1;
93  optional string package_name = 2;
94  optional int64 fg_bytes = 3;
95  optional float fg_bytes_percent = 4;
96  optional int32 fg_fsync = 5;
97  optional float fg_fsync_percent = 6;
98  optional int64 bg_bytes = 7;
99  optional float bg_bytes_percent = 8;
100  optional int32 bg_fsync = 9;
101  optional float bg_fsync_percent = 10;
102}
103
104message StatsCollection {
105  optional int32 id = 1;
106  optional Date date = 2;
107  optional TimeOfDay time = 3;
108  optional int32 total_cpu_time_ms = 4;
109  optional int32 idle_cpu_time_ms = 5;
110  optional int32 io_wait_time_ms = 6;
111  optional int64 context_switches = 7;
112  optional int32 io_blocked_processes = 8;
113  repeated PackageCpuStats package_cpu_stats = 9;
114  optional int64 total_cpu_cycles = 10;
115  optional int32 major_page_faults = 11;
116  repeated PackageStorageIoStats package_storage_io_read_stats = 12;
117  repeated PackageStorageIoStats package_storage_io_write_stats = 13;
118}
119
120message SystemEventStats {
121  repeated StatsCollection collections = 1;
122}
123
124message PerformanceStats {
125  optional SystemEventStats boot_time_stats = 1;
126  repeated SystemEventStats user_switch_stats = 2;
127  optional SystemEventStats custom_collection_stats = 3;
128  optional SystemEventStats last_n_minutes_stats = 4;
129}
130