| Chris Craik | 6a40d67 | 2015-06-09 17:28:05 -0700 | [diff] [blame] | 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 |  | 
| Quddus Chong | 0e40c14 | 2017-02-23 14:51:09 -0800 | [diff] [blame] | 17 | /** | 
| Dan Albert | a0a2595 | 2018-04-13 14:43:35 -0700 | [diff] [blame] | 18 |  * @addtogroup Tracing | 
 | 19 |  * @{ | 
 | 20 |  */ | 
 | 21 |  | 
 | 22 | /** | 
| Quddus Chong | 0e40c14 | 2017-02-23 14:51:09 -0800 | [diff] [blame] | 23 |  * @file trace.h | 
 | 24 |  * @brief Writes trace events to the system trace buffer. | 
 | 25 |  * | 
 | 26 |  * These trace events can be collected and visualized using the Systrace tool. | 
 | 27 |  * For information about using the Systrace tool, read <a href="https://developer.android.com/studio/profile/systrace.html">Analyzing UI Performance with Systrace</a>. | 
 | 28 |  */ | 
| Chris Craik | 6a40d67 | 2015-06-09 17:28:05 -0700 | [diff] [blame] | 29 |  | 
 | 30 | #ifndef ANDROID_NATIVE_TRACE_H | 
 | 31 | #define ANDROID_NATIVE_TRACE_H | 
 | 32 |  | 
 | 33 | #include <stdbool.h> | 
| Dan Albert | 494ed55 | 2016-09-23 15:57:45 -0700 | [diff] [blame] | 34 | #include <sys/cdefs.h> | 
| Chris Craik | 6a40d67 | 2015-06-09 17:28:05 -0700 | [diff] [blame] | 35 |  | 
 | 36 | #ifdef __cplusplus | 
 | 37 | extern "C" { | 
 | 38 | #endif | 
 | 39 |  | 
 | 40 | /** | 
 | 41 |  * Returns true if tracing is enabled. Use this signal to avoid expensive computation only necessary | 
 | 42 |  * when tracing is enabled. | 
 | 43 |  */ | 
| Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 44 | bool ATrace_isEnabled() __INTRODUCED_IN(23); | 
| Chris Craik | 6a40d67 | 2015-06-09 17:28:05 -0700 | [diff] [blame] | 45 |  | 
 | 46 | /** | 
 | 47 |  * Writes a tracing message to indicate that the given section of code has begun. This call must be | 
 | 48 |  * followed by a corresponding call to endSection() on the same thread. | 
 | 49 |  * | 
 | 50 |  * Note: At this time the vertical bar character '|' and newline character '\n' are used internally | 
 | 51 |  * by the tracing mechanism. If sectionName contains these characters they will be replaced with a | 
 | 52 |  * space character in the trace. | 
 | 53 |  */ | 
| Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 54 | void ATrace_beginSection(const char* sectionName) __INTRODUCED_IN(23); | 
| Chris Craik | 6a40d67 | 2015-06-09 17:28:05 -0700 | [diff] [blame] | 55 |  | 
 | 56 | /** | 
 | 57 |  * Writes a tracing message to indicate that a given section of code has ended. This call must be | 
 | 58 |  * preceeded by a corresponding call to beginSection(char*) on the same thread. Calling this method | 
 | 59 |  * will mark the end of the most recently begun section of code, so care must be taken to ensure | 
 | 60 |  * that beginSection / endSection pairs are properly nested and called from the same thread. | 
 | 61 |  */ | 
| Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 62 | void ATrace_endSection() __INTRODUCED_IN(23); | 
| Dan Albert | 494ed55 | 2016-09-23 15:57:45 -0700 | [diff] [blame] | 63 |  | 
| Chris Craik | 6a40d67 | 2015-06-09 17:28:05 -0700 | [diff] [blame] | 64 | #ifdef __cplusplus | 
 | 65 | }; | 
 | 66 | #endif | 
 | 67 |  | 
 | 68 | #endif // ANDROID_NATIVE_TRACE_H | 
| Dan Albert | a0a2595 | 2018-04-13 14:43:35 -0700 | [diff] [blame] | 69 |  | 
 | 70 | /** @} */ |