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