1 /* 2 * Copyright (C) 2019 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 17 #ifndef INCLUDE_PERFETTO_TRACING_BUFFER_EXHAUSTED_POLICY_H_ 18 #define INCLUDE_PERFETTO_TRACING_BUFFER_EXHAUSTED_POLICY_H_ 19 20 namespace perfetto { 21 22 // Determines how SharedMemoryArbiterImpl::GetNewChunk() behaves when no free 23 // chunks are available. 24 enum class BufferExhaustedPolicy { 25 // SharedMemoryArbiterImpl::GetNewChunk() will stall if no free SMB chunk is 26 // available and wait for the tracing service to free one. Note that this 27 // requires that messages the arbiter sends to the tracing service (from any 28 // TraceWriter thread) will be received by it, even if all TraceWriter threads 29 // are stalled. 30 kStall, 31 32 // SharedMemoryArbiterImpl::GetNewChunk() will return an invalid chunk if no 33 // free SMB chunk is available. In this case, the TraceWriter will fall back 34 // to a garbage chunk and drop written data until acquiring a future chunk 35 // succeeds again. 36 kDrop, 37 38 // TODO(eseckler): Switch to kDrop by default and change the Android code to 39 // explicitly request kStall instead. 40 kDefault = kStall 41 }; 42 43 } // namespace perfetto 44 45 #endif // INCLUDE_PERFETTO_TRACING_BUFFER_EXHAUSTED_POLICY_H_ 46