1/*
2 * Copyright (C) 2019 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
21// Describes a thread's attributes. Emitted as part of a TrackDescriptor,
22// usually by the thread's trace writer.
23//
24// Next id: 9.
25message ThreadDescriptor {
26  optional int32 pid = 1;
27  optional int32 tid = 2;
28
29  optional string thread_name = 5;
30
31  // ---------------------------------------------------------------------------
32  // Deprecated / legacy fields, which will be removed in the future:
33  // ---------------------------------------------------------------------------
34
35  enum ChromeThreadType {
36    CHROME_THREAD_UNSPECIFIED = 0;
37
38    CHROME_THREAD_MAIN = 1;
39    CHROME_THREAD_IO = 2;
40
41    // Scheduler:
42    CHROME_THREAD_POOL_BG_WORKER = 3;
43    CHROME_THREAD_POOL_FG_WORKER = 4;
44    CHROME_THREAD_POOL_FB_BLOCKING = 5;
45    CHROME_THREAD_POOL_BG_BLOCKING = 6;
46    CHROME_THREAD_POOL_SERVICE = 7;
47
48    // Compositor:
49    CHROME_THREAD_COMPOSITOR = 8;
50    CHROME_THREAD_VIZ_COMPOSITOR = 9;
51    CHROME_THREAD_COMPOSITOR_WORKER = 10;
52
53    // Renderer:
54    CHROME_THREAD_SERVICE_WORKER = 11;
55
56    // Tracing related threads:
57    CHROME_THREAD_MEMORY_INFRA = 50;
58    CHROME_THREAD_SAMPLING_PROFILER = 51;
59  };
60  optional ChromeThreadType chrome_thread_type = 4;
61
62  // Deprecated. Use ClockSnapshot in combination with TracePacket's timestamp
63  // and timestamp_clock_id fields instead.
64  optional int64 reference_timestamp_us = 6;
65
66  // Absolute reference values. Clock values in subsequent TrackEvents can be
67  // encoded accumulatively and relative to these. This reduces their var-int
68  // encoding size.
69  // TODO(eseckler): Deprecated. Replace these with ClockSnapshot encoding.
70  optional int64 reference_thread_time_us = 7;
71  optional int64 reference_thread_instruction_count = 8;
72
73  // To support old UI. New UI should determine default sorting by thread_type.
74  optional int32 legacy_sort_index = 3;
75}
76