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";
18package perfetto.protos;
19
20import "protos/perfetto/common/android_log_constants.proto";
21
22message AndroidLogPacket {
23  message LogEvent {
24    // The log buffer (e.g. MAIN, SYSTEM, RADIO) the event comes from.
25    optional AndroidLogId log_id = 1;
26
27    // PID (TGID), TID and UID of the task that emitted the event.
28    optional int32 pid = 2;
29    optional int32 tid = 3;
30    optional int32 uid = 4;
31
32    // Timestamp [ns]. The clock source is CLOCK_REALTIME, unlike many other
33    // Perfetto trace events that instead use CLOCK_BOOTTIME. The trace
34    // processor will take care of realigning clocks using the ClockSnapshot(s).
35    optional uint64 timestamp = 5;
36
37    // When log_id == LID_EVENTS, |tag| corresponds to the event name defined in
38    // the second column of /system/etc/event-log-tags. For all other events,
39    // |tag| is the app-specified argument passed to __android_log_write().
40    optional string tag = 6;
41
42    // Empty when log_id == LID_EVENTS.
43    optional AndroidLogPriority prio = 7;
44
45    // Empty when log_id == LID_EVENTS.
46    optional string message = 8;
47
48    message Arg {
49      optional string name = 1;
50      oneof value {
51        int64 int_value = 2;
52        float float_value = 3;
53        string string_value = 4;
54      }
55    }
56    // Only populated when log_id == LID_EVENTS.
57    repeated Arg args = 9;
58  }
59
60  repeated LogEvent events = 1;
61
62  // Stats are emitted only upon Flush() and are monotonic (i.e. they are
63  // absolute counters since the beginning of the lifetime of the tracing
64  // session and NOT relative to the previous Stats snapshot).
65  message Stats {
66    // Total number of log events seen, including errors and skipped entries
67    // (num of events stored in the trace = total - failed - skipped).
68    optional uint64 num_total = 1;
69
70    // Parser failures.
71    optional uint64 num_failed = 2;
72
73    // Messages skipped due to filters.
74    optional uint64 num_skipped = 3;
75  }
76  optional Stats stats = 2;
77}
78