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 = "proto2"; 18 19package perfetto.protos; 20 21import "protos/perfetto/metrics/android/cpu_metric.proto"; 22 23// These metrices collects various function and thread 24// usage within androd's codec framework. This can give an 25// idea about performance and cpu usage when using codec 26// framework 27message AndroidCodecMetrics { 28 29 // profile details in messages 30 message Detail { 31 // was thread_name 32 reserved 1; 33 // total time 34 optional int64 total_cpu_ns = 2; 35 // CPU time ( time 'Running' on cpu) 36 optional int64 running_cpu_ns = 3; 37 // avg running time for the trace duration 38 optional int64 avg_running_cpu_ns = 9; 39 // Total CPU cycles 40 optional int64 total_cpu_cycles = 4; 41 // avg CPU cycles per call 42 optional int64 avg_cpu_cycles = 8; 43 // avg time for this slice type 44 optional int64 avg_time_ns = 5; 45 optional int32 count = 6; 46 message Latency { 47 optional int64 max_us = 1; 48 optional int64 min_us = 2; 49 optional int64 avg_us = 3; 50 optional int64 agg_us = 4; 51 optional uint32 count = 5; 52 } 53 optional Latency self = 7; 54 } 55 56 // These are traces and could indicate framework queue latency 57 // buffer-packing, buffer-preprocess, buffer post-process 58 // latency etc. These metrics are monitored to track quality. 59 // Same message can come from different 60 // processes. 61 message CodecFunction { 62 // codec string 63 optional string codec_string = 1; 64 message Process { 65 optional string name = 1; 66 message Thread { 67 optional string name = 1; 68 optional Detail detail = 2; 69 } 70 optional Thread thread = 2; 71 } 72 optional Process process = 2; 73 } 74 75 // This message can indicate overall cpu 76 // utilization of codec framework threads. 77 message CpuUsage { 78 // name of process using codec framework 79 optional string process_name = 1; 80 message ThreadInfo { 81 // name of the codec thread 82 optional string name = 1; 83 message Details { 84 // total cpu usage of the codec thread 85 optional int64 thread_cpu_ns = 1; 86 // can be number of codec framework thread 87 optional uint32 num_threads = 2; 88 // core type data info used by codec thread 89 repeated AndroidCpuMetric.CoreTypeData core_data = 3; 90 } 91 optional Details info = 2; 92 } 93 optional ThreadInfo thread = 2; 94 // was thread_cpu_us 95 reserved 3; 96 } 97 98 // Rail details 99 message Rail { 100 // name of rail 101 optional string name = 1; 102 // energy and power details of this rail 103 message Info { 104 // energy from this rail for codec use 105 optional double energy = 1; 106 // power consumption in this rail for codec use 107 optional double power_mw = 2; 108 } 109 optional Info info = 2; 110 } 111 112 // have the energy usage for the codec running time 113 message Energy { 114 // total energy taken by the system during this time 115 optional double total_energy = 1; 116 // total time for this energy is calculated 117 optional int64 duration = 2; 118 // for this session 119 optional double power_mw = 3; 120 // enery breakdown by subsystem 121 repeated Rail rail = 4; 122 } 123 124 repeated CpuUsage cpu_usage = 1; 125 repeated CodecFunction codec_function = 2; 126 optional Energy energy = 3; 127} 128