xref: /aosp_15_r20/external/perfetto/ui/src/public/trace_info.ts (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
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} from '../base/time';
16
17export interface TraceInfo {
18  readonly traceTitle: string; // File name and size of the current trace.
19  readonly traceUrl: string; // URL of the Trace.
20
21  readonly start: time;
22  readonly end: time;
23
24  // This is the ts value at the time of the Unix epoch.
25  // Normally some large negative value, because the unix epoch is normally in
26  // the past compared to ts=0.
27  readonly realtimeOffset: time;
28
29  // This is the timestamp that we should use for our offset when in UTC mode.
30  // Usually the most recent UTC midnight compared to the trace start time.
31  readonly utcOffset: time;
32
33  // Trace TZ is like UTC but keeps into account also the timezone_off_mins
34  // recorded into the trace, to show timestamps in the device local time.
35  readonly traceTzOffset: time;
36
37  // The list of CPUs in the trace
38  readonly cpus: number[];
39
40  // The number of import/analysis errors present in the `stats` table.
41  readonly importErrors: number;
42
43  // The trace type inferred by TraceProcessor (e.g. 'proto', 'json, ...).
44  // See TraceTypeToString() in src/trace_processor/util/trace_type.cc for
45  // all the available types.
46  readonly traceType?: string;
47
48  // True if the trace contains any ftrace data (sched or other ftrace events).
49  readonly hasFtrace: boolean;
50
51  // The UUID of the trace. This is generated by TraceProcessor by either
52  // looking at the TraceUuid packet emitted by traced or, as a fallback, by
53  // hashing the first KB of the trace. This can be an empty string in rare
54  // cases (e.g., opening an empty trace).
55  readonly uuid: string;
56
57  // Wheteher the current trace has been successfully stored into cache storage.
58  readonly cached: boolean;
59
60  // Returns true if the current trace can be downloaded via getTraceFile().
61  // The trace isn't downloadable in the following cases:
62  // - It comes from a source (e.g. HTTP+RPC) that doesn't support re-download
63  //   due to technical limitations.
64  // - Download is disabled because the trace was pushed via postMessage and
65  //   the caller has asked to disable downloads.
66  readonly downloadable: boolean;
67}
68