• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2018 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/metrics.proto";
22
23// This file defines the schema for {,un}marshalling arguments and return values
24// when interfacing to the trace processor binary interface.
25
26// The Trace Processor can be used in three modes:
27// 1. Fully native from C++ or directly using trace_processor_shell.
28//    In this case, this file isn't really relevant because no binary
29//    marshalling is involved. Look at include/trace_processor/trace_processor.h
30//    for the public C++ API definition.
31// 2. Using WASM within the HTML ui. In this case these messages are used to
32//    {,un}marshall calls made through the JS<>WASM interop in
33//    src/trace_processor/rpc/wasm_bridge.cc .
34// 3. Using the HTTP+RPC interface, by running trace_processor_shell -D.
35//    In this case these messages are used to {,un}marshall HTTP requests and
36//    response made through src/trace_processor/rpc/httpd.cc .
37
38// Input for the /raw_query endpoint.
39message RawQueryArgs {
40  optional string sql_query = 1;
41
42  // Wall time when the query was queued. Used only for query stats.
43  optional uint64 time_queued_ns = 2;
44}
45
46// Output for the /raw_query endpoint.
47message RawQueryResult {
48  message ColumnDesc {
49    optional string name = 1;
50    enum Type {
51      UNKNOWN = 0;
52      LONG = 1;
53      DOUBLE = 2;
54      STRING = 3;
55    }
56    optional Type type = 2;
57  }
58  message ColumnValues {
59    // Only one of this field will be filled for each column (according to the
60    // corresponding descriptor) and that one will have precisely |num_records|
61    // elements.
62    repeated int64 long_values = 1;
63    repeated double double_values = 2;
64    repeated string string_values = 3;
65
66    // This will be set to true or false depending on whether the data at the
67    // given index is NULL.
68    repeated bool is_nulls = 4;
69  }
70  repeated ColumnDesc column_descriptors = 1;
71  optional uint64 num_records = 2;
72  repeated ColumnValues columns = 3;
73  optional string error = 4;
74  optional uint64 execution_time_ns = 5;
75}
76
77// Input for the /status endpoint.
78message StatusArgs {}
79
80// Output for the /status endpoint.
81message StatusResult {
82  // If present and not empty, a trace is already loaded already. This happens
83  // when using the HTTP+RPC mode nad passing a trace file to the shell, via
84  // trace_processor_shell -D trace_file.pftrace .
85  optional string loaded_trace_name = 1;
86}
87
88// Input for the /compute_metric endpoint.
89message ComputeMetricArgs {
90  repeated string metric_names = 1;
91}
92
93// Output for the /compute_metric endpoint.
94message ComputeMetricResult {
95  optional perfetto.protos.TraceMetrics metrics = 1;
96  optional string error = 2;
97}
98
99// Input for the /enable_metatrace endpoint.
100message EnableMetatraceArgs {}
101
102// Output for the /enable_metatrace endpoint.
103message EnableMetatraceResult {}
104
105// Input for the /disable_and_read_metatrace endpoint.
106message DisableAndReadMetatraceArgs {}
107
108// Output for the /disable_and_read_metatrace endpoint.
109message DisableAndReadMetatraceResult {
110  // Bytes of perfetto.protos.Trace message. Stored as bytes
111  // to avoid adding a dependency on trace.proto.
112  optional bytes metatrace = 1;
113  optional string error = 2;
114}
115