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// Metadata for chrome traces.
22message ChromeMetadataPacket {
23  optional BackgroundTracingMetadata background_tracing_metadata = 1;
24
25  // Version code of Chrome used by Android's Play Store. This field is only set
26  // on Android.
27  optional int32 chrome_version_code = 2;
28
29  // Comma separated list of enabled categories for tracing. The list of
30  // possible category strings are listed in code
31  // base/trace_event/builtin_categories.h.
32  optional string enabled_categories = 3;
33}
34
35// Metadata related to background tracing scenarios, states and triggers.
36message BackgroundTracingMetadata {
37  // Information about a trigger rule defined in the experiment config.
38  message TriggerRule {
39    enum TriggerType {
40      TRIGGER_UNSPECIFIED = 0;
41
42      // Traces are triggered by specific range of values of an UMA histogram.
43      MONITOR_AND_DUMP_WHEN_SPECIFIC_HISTOGRAM_AND_VALUE = 1;
44
45      // Traces are triggered by specific named events in chromium codebase,
46      // like "second-update-failure".
47      MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED = 2;
48    }
49    optional TriggerType trigger_type = 1;
50
51    // Configuration of histogram trigger.
52    message HistogramRule {
53      // UMA histogram name hash, same as HistogramEventProto.name_hash.
54      optional fixed64 histogram_name_hash = 1;
55
56      // Range of values of the histogram that activates trigger.
57      optional int64 histogram_min_trigger = 2;
58      optional int64 histogram_max_trigger = 3;
59    }
60    optional HistogramRule histogram_rule = 2;
61
62    // Configuration of named trigger.
63    message NamedRule {
64      enum EventType {
65        UNSPECIFIED = 0;
66        SESSION_RESTORE = 1;
67        NAVIGATION = 2;
68        STARTUP = 3;
69        REACHED_CODE = 4;
70        CONTENT_TRIGGER = 5;
71
72        TEST_RULE = 1000;
73      }
74      optional EventType event_type = 1;
75
76      // If |event_type| is CONTENT_TRIGGER, then this stores the hash of the
77      // content-trigger that actually fired.
78      optional fixed64 content_trigger_name_hash = 2;
79    }
80    optional NamedRule named_rule = 3;
81  }
82
83  // Specifies the rule that caused the trace to be uploaded.
84  optional TriggerRule triggered_rule = 1;
85
86  // List of all active triggers in current session, when trace was triggered.
87  repeated TriggerRule active_rules = 2;
88}
89