1/* 2 * Copyright (C) 2020 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 21message AndroidNetworkMetric { 22 message PacketStatistic { 23 // Packet count. 24 optional int64 packets = 1; 25 26 // Packet Bytes. 27 optional int64 bytes = 2; 28 29 // Timestamp when first packet received or transmitted. 30 optional int64 first_packet_timestamp_ns = 3; 31 32 // Timestamp when last packet received or transmitted. 33 optional int64 last_packet_timestamp_ns = 4; 34 35 // Interval between first & last packet. The minimum interval is 10ms. 36 optional int64 interval_ns = 5; 37 38 // Data Speed. 39 optional double data_rate_kbps = 6; 40 } 41 42 message CorePacketStatistic { 43 optional uint32 id = 1; 44 optional PacketStatistic packet_statistic = 2; 45 } 46 47 message Rx { 48 // Total packets statistic. 49 optional PacketStatistic total = 1; 50 51 // Per core packets statistic. 52 repeated CorePacketStatistic core = 2; 53 54 // GRO aggregation ratio. 55 optional string gro_aggregation_ratio = 3; 56 } 57 58 message Tx { 59 // Total packets statistic. 60 optional PacketStatistic total = 1; 61 62 // Per core packets statistic. 63 repeated CorePacketStatistic core = 2; 64 } 65 66 message NetDevice { 67 // Network device name. 68 optional string name = 1; 69 70 // Ingress traffic statistic. 71 optional Rx rx = 2; 72 73 // Egress traffic statistic 74 optional Tx tx = 3; 75 } 76 77 message NetRxActionStatistic { 78 // SoftIrq NET_RX action count. 79 optional int64 count = 1; 80 81 // SoftIrq NET_RX action was running in millisecond. 82 optional double runtime_ms = 2; 83 84 // SoftIrq NET_RX action average running time. 85 optional double avg_runtime_ms = 3; 86 87 // CPU megacycles (i.e. cycles divided by 1e6). 88 optional int64 mcycles = 4; 89 90 // Average weighted CPU frequency by the time the NET_RX Action 91 // running at each frequency. 92 optional int64 avg_freq_khz = 5; 93 } 94 95 message NetTxActionStatistic { 96 // SoftIrq NET_TX action count. 97 optional int64 count = 1; 98 99 // SoftIrq NET_TX action was running in millisecond. 100 optional double runtime_ms = 2; 101 102 // SoftIrq NET_TX action average running time. 103 optional double avg_runtime_ms = 3; 104 105 // CPU megacycles (i.e. cycles divided by 1e6). 106 optional int64 mcycles = 4; 107 108 // Average weighted CPU frequency by the time the NET_TX Action 109 // running at each frequency. 110 optional int64 avg_freq_khz = 5; 111 } 112 113 message IpiActionStatistic { 114 // SoftIrq IPI action count. 115 optional int64 count = 1; 116 117 // SoftIrq IPI action was running in millisecond. 118 optional double runtime_ms = 2; 119 120 // SoftIrq IPI action average running time. 121 optional double avg_runtime_ms = 3; 122 } 123 124 message CoreNetRxActionStatistic { 125 optional uint32 id = 1; 126 optional NetRxActionStatistic net_rx_action_statistic = 2; 127 } 128 129 message CoreNetTxActionStatistic { 130 optional uint32 id = 1; 131 optional NetTxActionStatistic net_tx_action_statistic = 2; 132 } 133 134 message NetRxAction { 135 // Total NET_RX action statistics. 136 optional NetRxActionStatistic total = 1; 137 138 // Per core NET_RX action statistics. 139 repeated CoreNetRxActionStatistic core = 2; 140 141 // The average packet time moves through the kernel stack. 142 optional double avg_interstack_latency_ms = 3; 143 } 144 145 message NetTxAction { 146 // Total NET_TX action statistics. 147 optional NetTxActionStatistic total = 1; 148 149 // Per core NET_TX action statistics. 150 repeated CoreNetTxActionStatistic core = 2; 151 } 152 153 message IpiAction { 154 // Total IPI action statistics. 155 optional IpiActionStatistic total = 1; 156 } 157 158 // Network device metrics. 159 repeated NetDevice net_devices = 1; 160 161 // SoftIrq NET_RX action metrics. 162 optional NetRxAction net_rx_action = 2; 163 164 // Packet retransmission rate. 165 optional double retransmission_rate = 3; 166 167 // Kfree Skb rate (i.e. kfree_skb count divided by the packet count from all 168 // net devices). 169 optional double kfree_skb_rate = 4; 170 171 // SoftIrq NET_TX action metrics. 172 optional NetTxAction net_tx_action = 5; 173 174 // SoftIrq IPI action metrics. 175 optional IpiAction ipi_action = 6; 176} 177