1/* 2 * Copyright (C) 2017 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 com.android.internal.protolog; 20 21option java_multiple_files = true; 22 23import "frameworks/base/core/proto/android/privacy.proto"; 24 25/* represents a single log entry */ 26message ProtoLogMessage { 27 option (.android.msg_privacy).dest = DEST_LOCAL; 28 29 /* log statement identifier, created from message string and log level. */ 30 optional sfixed32 message_hash_legacy = 1 [deprecated = true]; 31 /* log time, relative to the elapsed system time clock. */ 32 optional fixed64 elapsed_realtime_nanos = 2; 33 /* string parameters passed to the log call. */ 34 repeated string str_params = 3; 35 /* integer parameters passed to the log call. */ 36 repeated sint64 sint64_params = 4 [packed=true]; 37 /* floating point parameters passed to the log call. */ 38 repeated double double_params = 5 [packed=true]; 39 /* boolean parameters passed to the log call. */ 40 repeated bool boolean_params = 6 [packed=true]; 41 42 /* log statement identifier, created from message string and log level. */ 43 optional sfixed64 message_hash = 7; 44} 45 46/* represents a log file containing ProtoLog log entries. 47 Encoded, it should start with 0x9 0x50 0x52 0x4f 0x54 0x4f 0x4c 0x4f 0x47 (.PROTOLOG), such 48 that they can be easily identified. */ 49message ProtoLogFileProto { 50 option (.android.msg_privacy).dest = DEST_LOCAL; 51 52 /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L 53 (this is needed because enums have to be 32 bits and there's no nice way to put 64bit 54 constants into .proto files. */ 55 enum MagicNumber { 56 INVALID = 0; 57 MAGIC_NUMBER_L = 0x544f5250; /* PROT (little-endian ASCII) */ 58 MAGIC_NUMBER_H = 0x474f4c4f; /* OLOG (little-endian ASCII) */ 59 } 60 61 /* the magic number header */ 62 optional fixed64 magic_number = 1; 63 /* log proto version. */ 64 optional string version = 2; 65 /* offset between real-time clock and elapsed system time clock in milliseconds. 66 Calculated as: (System.currentTimeMillis() - (SystemClock.elapsedRealtimeNanos() / 1000000) */ 67 optional fixed64 realTimeToElapsedTimeOffsetMillis = 3; 68 /* log entries */ 69 repeated ProtoLogMessage log = 4; 70} 71