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"; 18option optimize_for = LITE_RUNTIME; 19 20package perfetto.protos; 21 22message CommitDataRequest { 23 // When |chunks_to_move| is present, the producer is requesting the service to 24 // move the given chunks form the share memory buffer into the central 25 // trace buffer(s). 26 message ChunksToMove { 27 // The 0-based index of the page in the Shared Memory Buffer. 28 optional uint32 page = 1; 29 30 // The 0-based chunk index [0..13] within the page. 31 optional uint32 chunk = 2; 32 33 // The target buffer it should be moved onto. The service will check that 34 // the producer is allowed to write into that buffer before the move. 35 optional uint32 target_buffer = 3; 36 } 37 repeated ChunksToMove chunks_to_move = 1; 38 39 // Used to patch chunks that have already been sent to the service. The chunk 40 // might not be in the shared memory buffer anymore as it could have been 41 // moved by the service in response to a prior CommitDataRequest. 42 // It is perfectly valid to patch a chunk that is being notified in the same 43 // message (a chunk can show up both in the |changed_pages| and |patches| 44 // field within the same CommitDataRequest message). 45 // In other words, |chunks_to_patch| is always processed after 46 // |chunks_to_move|. 47 message ChunkToPatch { 48 message Patch { 49 // Offset in bytes from the start of the chunk payload. e.g., offset == 0 50 // corresponds to the first byte of the first packet (or fragment) in the 51 // chunk. 52 optional uint32 offset = 1; 53 54 // Bytes to patch at the given offset. 55 optional bytes data = 2; 56 } 57 58 optional uint32 target_buffer = 1; 59 60 // {WriterID, ChunkID} uniquely identify a chunk for the current producer. 61 optional uint32 writer_id = 2; 62 optional uint32 chunk_id = 3; 63 64 // List of patches to apply to the given chunk. 65 repeated Patch patches = 4; 66 67 // When true more patches will follow in future requests and the chunk 68 // should be still considered as patch-pending. When false the chunk becomes 69 // eligible for reading. 70 optional bool has_more_patches = 5; 71 } 72 repeated ChunkToPatch chunks_to_patch = 2; 73 74 // Optional. If this commit is made in response to a Flush(id) request coming 75 // from the service, copy back the id of the request so the service can tell 76 // when the flush happened. 77 optional uint64 flush_request_id = 3; 78} 79