1-- 2-- Copyright 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-- https://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-- Android network packet events (from android.network_packets data source). 17-- 18-- @column ts Timestamp in nanoseconds. 19-- @column dur Duration (non-zero only in aggregate events) 20-- @column track_name The track name (interface and direction) 21-- @column package_name Traffic package source (or uid=$X if not found) 22-- @column iface Traffic interface name (linux interface name) 23-- @column direction Traffic direction ('Transmitted' or 'Received') 24-- @column packet_count Number of packets in this event 25-- @column packet_length Number of bytes in this event (wire size) 26-- @column packet_transport Transport used for traffic in this event 27-- @column packet_tcp_flags TCP flags used by tcp frames in this event 28-- @column socket_tag The Android traffic tag of the network socket 29-- @column socket_uid The Linux user id of the network socket 30-- @column local_port The local port number (for udp or tcp only) 31-- @column remote_port The remote port number (for udp or tcp only) 32CREATE VIEW android_network_packets AS 33SELECT 34 ts, 35 dur, 36 track.name AS track_name, 37 slice.name AS package_name, 38 str_split(track.name, ' ', 0) AS iface, 39 str_split(track.name, ' ', 1) AS direction, 40 ifnull(extract_arg(arg_set_id, 'packet_count'), 1) AS packet_count, 41 extract_arg(arg_set_id, 'packet_length') AS packet_length, 42 extract_arg(arg_set_id, 'packet_transport') AS packet_transport, 43 extract_arg(arg_set_id, 'packet_tcp_flags') AS packet_tcp_flags, 44 extract_arg(arg_set_id, 'socket_tag') AS socket_tag, 45 extract_arg(arg_set_id, 'socket_uid') AS socket_uid, 46 extract_arg(arg_set_id, 'local_port') AS local_port, 47 extract_arg(arg_set_id, 'remote_port') AS remote_port 48FROM slice 49JOIN track 50 ON slice.track_id = track.id 51WHERE (track.name GLOB '* Transmitted' OR 52 track.name GLOB '* Received'); 53