• 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
19import "protos/perfetto/common/builtin_clock.proto";
20
21package perfetto.protos;
22
23// A snapshot of clock readings to allow for trace alignment.
24message ClockSnapshot {
25  message Clock {
26    // DEPRECATED. This enum has moved to ../common/builtin_clock.proto.
27    enum BuiltinClocks {
28      UNKNOWN = 0;
29      REALTIME = 1;
30      REALTIME_COARSE = 2;
31      MONOTONIC = 3;
32      MONOTONIC_COARSE = 4;
33      MONOTONIC_RAW = 5;
34      BOOTTIME = 6;
35      BUILTIN_CLOCK_MAX_ID = 63;
36
37      reserved 7, 8;
38    }
39
40    // Clock IDs have the following semantic:
41    // [1, 63]:    Builtin types, see BuiltinClock from
42    //             ../common/builtin_clock.proto.
43    // [64, 127]:  User-defined clocks. These clocks are sequence-scoped. They
44    //             are only valid within the same |trusted_packet_sequence_id|
45    //             (i.e. only for TracePacket(s) emitted by the same TraceWriter
46    //             that emitted the clock snapshot).
47    // [128, MAX]: Reserved for future use. The idea is to allow global clock
48    //             IDs and setting this ID to hash(full_clock_name) & ~127.
49    optional uint32 clock_id = 1;
50
51    // Absolute timestamp. Unit is ns unless specified otherwise by the
52    // unit_multiplier_ns field below.
53    optional uint64 timestamp = 2;
54
55    // When true each TracePacket's timestamp should be interpreted as a delta
56    // from the last TracePacket's timestamp (referencing this clock) emitted by
57    // the same packet_sequence_id. Should only be used for user-defined
58    // sequence-local clocks. The first packet timestamp after each
59    // ClockSnapshot that contains this clock is relative to the |timestamp| in
60    // the ClockSnapshot.
61    optional bool is_incremental = 3;
62
63    // Allows to specify a custom unit different than the default (ns) for this
64    // clock domain. A multiplier of 1000 means that a timestamp = 3 should be
65    // interpreted as 3000 ns = 3 us. All snapshots for the same clock within a
66    // trace need to use the same unit.
67    optional uint64 unit_multiplier_ns = 4;
68  }
69  repeated Clock clocks = 1;
70
71  // The authoritative clock domain for the trace. Defaults to BOOTTIME, but can
72  // be overridden in TraceConfig's builtin_data_sources. Trace processor will
73  // attempt to translate packet/event timestamps from various data sources (and
74  // their chosen clock domains) to this domain during import.
75  optional BuiltinClock primary_trace_clock = 2;
76}
77