1// Copyright (C) 2024 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15import {time, duration} from '../base/time'; 16import {SliceSqlId} from '../components/sql_utils/core_types'; 17 18export interface Flow { 19 id: number; 20 21 begin: FlowPoint; 22 end: FlowPoint; 23 dur: duration; 24 25 // Whether this flow connects a slice with its descendant. 26 flowToDescendant: boolean; 27 28 category?: string; 29 name?: string; 30} 31 32export interface FlowPoint { 33 trackId: number; 34 trackUri?: string; 35 36 sliceName: string; 37 sliceCategory: string; 38 sliceId: SliceSqlId; 39 sliceStartTs: time; 40 sliceEndTs: time; 41 // Thread and process info. Only set in sliceSelected not in areaSelected as 42 // the latter doesn't display per-flow info and it'd be a waste to join 43 // additional tables for undisplayed info in that case. Nothing precludes 44 // adding this in a future iteration however. 45 threadName: string; 46 processName: string; 47 48 depth: number; 49 50 // TODO(altimin): Ideally we should have a generic mechanism for allowing to 51 // customise the name here, but for now we are hardcording a few 52 // Chrome-specific bits in the query here. 53 sliceChromeCustomName?: string; 54} 55 56export type FlowDirection = 'Forward' | 'Backward'; 57