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 // function thread 32 optional string thread_name = 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 // CPU cycles 38 optional int64 cpu_cycles = 4; 39 } 40 41 // These are traces and could indicate framework queue latency 42 // buffer-packing, buffer-preprocess, buffer post-process 43 // latency etc. These metrics are monitored to track quality. 44 // Same message can come from different 45 // processes. 46 message CodecFunction { 47 // codec string 48 optional string codec_string = 1; 49 // process_name 50 optional string process_name = 2; 51 // details 52 optional Detail detail = 3; 53 } 54 55 // This message can indicate overall cpu 56 // utilization of codec framework threads. 57 message CpuUsage { 58 // name of process using codec framework 59 optional string process_name = 1; 60 // name of the codec thread 61 optional string thread_name = 2; 62 // was thread_cpu_us 63 reserved 3; 64 // total cpu usage of the codec thread 65 optional int64 thread_cpu_ns = 6; 66 // can be number of codec framework thread 67 optional uint32 num_threads = 4; 68 // core type data info used by codec thread 69 repeated AndroidCpuMetric.CoreTypeData core_data = 5; 70 } 71 72 // Rail details 73 message Rail { 74 // name of rail 75 optional string name = 1; 76 // energy and power details of this rail 77 message Info { 78 // energy from this rail for codec use 79 optional double energy = 1; 80 // power consumption in this rail for codec use 81 optional double power_mw = 2; 82 } 83 optional Info info = 2; 84 } 85 86 // have the energy usage for the codec running time 87 message Energy { 88 // total energy taken by the system during this time 89 optional double total_energy = 1; 90 // total time for this energy is calculated 91 optional int64 duration = 2; 92 // for this session 93 optional double power_mw = 3; 94 // enery breakdown by subsystem 95 repeated Rail rail = 4; 96 } 97 98 repeated CpuUsage cpu_usage = 1; 99 repeated CodecFunction codec_function = 2; 100 optional Energy energy = 3; 101 102} 103