aboutsummaryrefslogtreecommitdiff
path: root/protos/perfetto/trace/clock_snapshot.proto
blob: 12ce1b65f75087b4a419bff9fe7599bccd55561f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto2";
option optimize_for = LITE_RUNTIME;

package perfetto.protos;

// A snapshot of clock readings to allow for trace alignment.
message ClockSnapshot {
  message Clock {
    enum BuiltinClocks {
      UNKNOWN = 0;
      REALTIME = 1;
      REALTIME_COARSE = 2;
      MONOTONIC = 3;
      MONOTONIC_COARSE = 4;
      MONOTONIC_RAW = 5;
      BOOTTIME = 6;
      PROCESS_CPUTIME = 7;
      THREAD_CPUTIME = 8;
      BUILTIN_CLOCK_MAX_ID = 63;
    }

    // Clock IDs have the following semantic:
    // [1, 63]:    Builtin types, see BuiltinClocks above.
    // [64, 127]:  User-defined clocks. These clocks are sequence-scoped. They
    //             are only valid within the same |trusted_packet_sequence_id|
    //             (i.e. only for TracePacket(s) emitted by the same TraceWriter
    //             that emitted the clock snapshot).
    // [128, MAX]: Reserved for future use. The idea is to allow global clock
    //             IDs and setting this ID to hash(full_clock_name) & ~127.
    optional uint32 clock_id = 1;

    // Unit is ns unless specified otherwise by the resolution_* fields below.
    optional uint64 timestamp = 2;

    // TODO(eseckler): the fields below and sequence-scoped clock IDs are not
    // supported yet by the trace processor.

    // When true the timestamp should be interpreted as a delta from the last
    // TracePacket's timestamp emitted by the same packet_sequence_id.
    // The first packet timestamp after a ClockSnapshot is relative to the last
    // ClockSnapshot seen on the packet sequence.
    // optional bool is_incremental = 3;

    // Allows to specify a custom unit different than the default (ns)
    // for this clock domain. A multiplier of 1000 means that a timestamp = 3
    // should be interpreted as 3000 ns = 3 us.
    // optional uint64 unit_multiplier_ns = 4;
  }
  repeated Clock clocks = 1;
}