1 /* 2 * Copyright (C) 2015 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 18 #ifndef ANDROID_NATIVE_TRACE_H 19 #define ANDROID_NATIVE_TRACE_H 20 21 #include <stdbool.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** 28 * Returns true if tracing is enabled. Use this signal to avoid expensive computation only necessary 29 * when tracing is enabled. 30 */ 31 bool ATrace_isEnabled(); 32 33 /** 34 * Writes a tracing message to indicate that the given section of code has begun. This call must be 35 * followed by a corresponding call to endSection() on the same thread. 36 * 37 * Note: At this time the vertical bar character '|' and newline character '\n' are used internally 38 * by the tracing mechanism. If sectionName contains these characters they will be replaced with a 39 * space character in the trace. 40 */ 41 void ATrace_beginSection(const char* sectionName); 42 43 /** 44 * Writes a tracing message to indicate that a given section of code has ended. This call must be 45 * preceeded by a corresponding call to beginSection(char*) on the same thread. Calling this method 46 * will mark the end of the most recently begun section of code, so care must be taken to ensure 47 * that beginSection / endSection pairs are properly nested and called from the same thread. 48 */ 49 void ATrace_endSection(); 50 51 #ifdef __cplusplus 52 }; 53 #endif 54 55 #endif // ANDROID_NATIVE_TRACE_H 56