Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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 | package android.os; |
| 18 | |
John Reck | 6be2cab | 2016-10-03 14:38:06 -0700 | [diff] [blame] | 19 | import dalvik.annotation.optimization.FastNative; |
| 20 | |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 21 | /** |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 22 | * Writes trace events to the system trace buffer. These trace events can be |
| 23 | * collected and visualized using the Systrace tool. |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 24 | * |
Scott Main | c468240 | 2013-06-13 12:38:55 -0700 | [diff] [blame] | 25 | * <p>This tracing mechanism is independent of the method tracing mechanism |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 26 | * offered by {@link Debug#startMethodTracing}. In particular, it enables |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 27 | * tracing of events that occur across multiple processes. |
Scott Main | c468240 | 2013-06-13 12:38:55 -0700 | [diff] [blame] | 28 | * <p>For information about using the Systrace tool, read <a |
| 29 | * href="{@docRoot}tools/debugging/systrace.html">Analyzing Display and Performance |
| 30 | * with Systrace</a>. |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 31 | */ |
| 32 | public final class Trace { |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 33 | /* |
| 34 | * Writes trace events to the kernel trace buffer. These trace events can be |
| 35 | * collected using the "atrace" program for offline analysis. |
| 36 | */ |
| 37 | |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 38 | private static final String TAG = "Trace"; |
| 39 | |
Alex Ray | 8a6787b | 2012-11-14 18:08:49 -0800 | [diff] [blame] | 40 | // These tags must be kept in sync with system/core/include/cutils/trace.h. |
Jeff Brown | 3edf527 | 2014-08-14 19:25:14 -0700 | [diff] [blame] | 41 | // They should also be added to frameworks/native/cmds/atrace/atrace.cpp. |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 42 | /** @hide */ |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 43 | public static final long TRACE_TAG_NEVER = 0; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 44 | /** @hide */ |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 45 | public static final long TRACE_TAG_ALWAYS = 1L << 0; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 46 | /** @hide */ |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 47 | public static final long TRACE_TAG_GRAPHICS = 1L << 1; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 48 | /** @hide */ |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 49 | public static final long TRACE_TAG_INPUT = 1L << 2; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 50 | /** @hide */ |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 51 | public static final long TRACE_TAG_VIEW = 1L << 3; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 52 | /** @hide */ |
Chris Craik | 192a65e | 2012-04-16 16:08:40 -0700 | [diff] [blame] | 53 | public static final long TRACE_TAG_WEBVIEW = 1L << 4; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 54 | /** @hide */ |
Dianne Hackborn | 1ded0b1 | 2012-04-26 14:14:50 -0700 | [diff] [blame] | 55 | public static final long TRACE_TAG_WINDOW_MANAGER = 1L << 5; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 56 | /** @hide */ |
Dianne Hackborn | 1ded0b1 | 2012-04-26 14:14:50 -0700 | [diff] [blame] | 57 | public static final long TRACE_TAG_ACTIVITY_MANAGER = 1L << 6; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 58 | /** @hide */ |
Andy Stadler | 09b45a3 | 2012-05-03 15:00:49 -0700 | [diff] [blame] | 59 | public static final long TRACE_TAG_SYNC_MANAGER = 1L << 7; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 60 | /** @hide */ |
Glenn Kasten | ed853fc | 2012-05-07 11:05:55 -0700 | [diff] [blame] | 61 | public static final long TRACE_TAG_AUDIO = 1L << 8; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 62 | /** @hide */ |
Jamie Gennis | 24dae6c | 2012-05-11 04:43:35 -0700 | [diff] [blame] | 63 | public static final long TRACE_TAG_VIDEO = 1L << 9; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 64 | /** @hide */ |
Eino-Ville Talvala | 9c0d9cf | 2012-05-31 15:49:31 -0700 | [diff] [blame] | 65 | public static final long TRACE_TAG_CAMERA = 1L << 10; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 66 | /** @hide */ |
Alex Ray | 8a6787b | 2012-11-14 18:08:49 -0800 | [diff] [blame] | 67 | public static final long TRACE_TAG_HAL = 1L << 11; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 68 | /** @hide */ |
| 69 | public static final long TRACE_TAG_APP = 1L << 12; |
Dianne Hackborn | f7be480 | 2013-04-12 14:52:58 -0700 | [diff] [blame] | 70 | /** @hide */ |
| 71 | public static final long TRACE_TAG_RESOURCES = 1L << 13; |
Jamie Gennis | 0cc84ce | 2013-05-07 15:22:31 -0700 | [diff] [blame] | 72 | /** @hide */ |
| 73 | public static final long TRACE_TAG_DALVIK = 1L << 14; |
Tim Murray | 6d7a53c | 2013-05-23 16:59:23 -0700 | [diff] [blame] | 74 | /** @hide */ |
| 75 | public static final long TRACE_TAG_RS = 1L << 15; |
Brigid Smith | 461ac24 | 2014-05-28 14:13:41 -0700 | [diff] [blame] | 76 | /** @hide */ |
| 77 | public static final long TRACE_TAG_BIONIC = 1L << 16; |
Jeff Brown | 3edf527 | 2014-08-14 19:25:14 -0700 | [diff] [blame] | 78 | /** @hide */ |
| 79 | public static final long TRACE_TAG_POWER = 1L << 17; |
Todd Kennedy | 114beb2 | 2015-08-03 09:56:07 -0700 | [diff] [blame] | 80 | /** @hide */ |
| 81 | public static final long TRACE_TAG_PACKAGE_MANAGER = 1L << 18; |
Yasuhiro Matsuda | 1ab43d5 | 2015-06-30 17:07:32 +0900 | [diff] [blame] | 82 | /** @hide */ |
| 83 | public static final long TRACE_TAG_SYSTEM_SERVER = 1L << 19; |
Greg Hackmann | e12350f | 2014-12-01 14:31:21 -0800 | [diff] [blame] | 84 | /** @hide */ |
| 85 | public static final long TRACE_TAG_DATABASE = 1L << 20; |
Felipe Leme | 873a83a | 2016-09-07 11:34:10 -0700 | [diff] [blame] | 86 | /** @hide */ |
| 87 | public static final long TRACE_TAG_NETWORK = 1L << 21; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 88 | |
Andy McFadden | 325be8a | 2012-10-29 16:42:41 -0700 | [diff] [blame] | 89 | private static final long TRACE_TAG_NOT_READY = 1L << 63; |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 90 | private static final int MAX_SECTION_NAME_LEN = 127; |
Dianne Hackborn | 83e6eb1 | 2012-05-08 14:53:24 -0700 | [diff] [blame] | 91 | |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 92 | // Must be volatile to avoid word tearing. |
Andy McFadden | 325be8a | 2012-10-29 16:42:41 -0700 | [diff] [blame] | 93 | private static volatile long sEnabledTags = TRACE_TAG_NOT_READY; |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 94 | |
| 95 | private static native long nativeGetEnabledTags(); |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 96 | private static native void nativeSetAppTracingAllowed(boolean allowed); |
Jamie Gennis | 6ad0452 | 2013-04-15 18:53:24 -0700 | [diff] [blame] | 97 | private static native void nativeSetTracingEnabled(boolean allowed); |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 98 | |
John Reck | 6be2cab | 2016-10-03 14:38:06 -0700 | [diff] [blame] | 99 | @FastNative |
| 100 | private static native void nativeTraceCounter(long tag, String name, int value); |
| 101 | @FastNative |
| 102 | private static native void nativeTraceBegin(long tag, String name); |
| 103 | @FastNative |
| 104 | private static native void nativeTraceEnd(long tag); |
| 105 | @FastNative |
| 106 | private static native void nativeAsyncTraceBegin(long tag, String name, int cookie); |
| 107 | @FastNative |
| 108 | private static native void nativeAsyncTraceEnd(long tag, String name, int cookie); |
| 109 | |
Dianne Hackborn | a53de06 | 2012-05-08 18:53:51 -0700 | [diff] [blame] | 110 | static { |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 111 | // We configure two separate change callbacks, one in Trace.cpp and one here. The |
| 112 | // native callback reads the tags from the system property, and this callback |
| 113 | // reads the value that the native code retrieved. It's essential that the native |
| 114 | // callback executes first. |
| 115 | // |
| 116 | // The system provides ordering through a priority level. Callbacks made through |
| 117 | // SystemProperties.addChangeCallback currently have a negative priority, while |
| 118 | // our native code is using a priority of zero. |
Dianne Hackborn | a53de06 | 2012-05-08 18:53:51 -0700 | [diff] [blame] | 119 | SystemProperties.addChangeCallback(new Runnable() { |
| 120 | @Override public void run() { |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 121 | cacheEnabledTags(); |
Dianne Hackborn | a53de06 | 2012-05-08 18:53:51 -0700 | [diff] [blame] | 122 | } |
| 123 | }); |
| 124 | } |
| 125 | |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 126 | private Trace() { |
| 127 | } |
| 128 | |
| 129 | /** |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 130 | * Caches a copy of the enabled-tag bits. The "master" copy is held by the native code, |
| 131 | * and comes from the PROPERTY_TRACE_TAG_ENABLEFLAGS property. |
| 132 | * <p> |
| 133 | * If the native code hasn't yet read the property, we will cause it to do one-time |
| 134 | * initialization. We don't want to do this during class init, because this class is |
| 135 | * preloaded, so all apps would be stuck with whatever the zygote saw. (The zygote |
| 136 | * doesn't see the system-property update broadcasts.) |
| 137 | * <p> |
| 138 | * We want to defer initialization until the first use by an app, post-zygote. |
| 139 | * <p> |
| 140 | * We're okay if multiple threads call here simultaneously -- the native state is |
| 141 | * synchronized, and sEnabledTags is volatile (prevents word tearing). |
| 142 | */ |
| 143 | private static long cacheEnabledTags() { |
| 144 | long tags = nativeGetEnabledTags(); |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 145 | sEnabledTags = tags; |
| 146 | return tags; |
| 147 | } |
| 148 | |
| 149 | /** |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 150 | * Returns true if a trace tag is enabled. |
| 151 | * |
| 152 | * @param traceTag The trace tag to check. |
| 153 | * @return True if the trace tag is valid. |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 154 | * |
| 155 | * @hide |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 156 | */ |
| 157 | public static boolean isTagEnabled(long traceTag) { |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 158 | long tags = sEnabledTags; |
Andy McFadden | 325be8a | 2012-10-29 16:42:41 -0700 | [diff] [blame] | 159 | if (tags == TRACE_TAG_NOT_READY) { |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 160 | tags = cacheEnabledTags(); |
| 161 | } |
| 162 | return (tags & traceTag) != 0; |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | /** |
| 166 | * Writes trace message to indicate the value of a given counter. |
| 167 | * |
| 168 | * @param traceTag The trace tag. |
| 169 | * @param counterName The counter name to appear in the trace. |
| 170 | * @param counterValue The counter value. |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 171 | * |
| 172 | * @hide |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 173 | */ |
| 174 | public static void traceCounter(long traceTag, String counterName, int counterValue) { |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 175 | if (isTagEnabled(traceTag)) { |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 176 | nativeTraceCounter(traceTag, counterName, counterValue); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | /** |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 181 | * Set whether application tracing is allowed for this process. This is intended to be set |
| 182 | * once at application start-up time based on whether the application is debuggable. |
| 183 | * |
| 184 | * @hide |
| 185 | */ |
| 186 | public static void setAppTracingAllowed(boolean allowed) { |
| 187 | nativeSetAppTracingAllowed(allowed); |
| 188 | |
| 189 | // Setting whether app tracing is allowed may change the tags, so we update the cached |
| 190 | // tags here. |
| 191 | cacheEnabledTags(); |
| 192 | } |
| 193 | |
| 194 | /** |
Jamie Gennis | 6ad0452 | 2013-04-15 18:53:24 -0700 | [diff] [blame] | 195 | * Set whether tracing is enabled in this process. Tracing is disabled shortly after Zygote |
| 196 | * initializes and re-enabled after processes fork from Zygote. This is done because Zygote |
| 197 | * has no way to be notified about changes to the tracing tags, and if Zygote ever reads and |
| 198 | * caches the tracing tags, forked processes will inherit those stale tags. |
| 199 | * |
| 200 | * @hide |
| 201 | */ |
| 202 | public static void setTracingEnabled(boolean enabled) { |
| 203 | nativeSetTracingEnabled(enabled); |
| 204 | |
| 205 | // Setting whether tracing is enabled may change the tags, so we update the cached tags |
| 206 | // here. |
| 207 | cacheEnabledTags(); |
| 208 | } |
| 209 | |
| 210 | /** |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 211 | * Writes a trace message to indicate that a given section of code has |
| 212 | * begun. Must be followed by a call to {@link #traceEnd} using the same |
| 213 | * tag. |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 214 | * |
| 215 | * @param traceTag The trace tag. |
| 216 | * @param methodName The method name to appear in the trace. |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 217 | * |
| 218 | * @hide |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 219 | */ |
| 220 | public static void traceBegin(long traceTag, String methodName) { |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 221 | if (isTagEnabled(traceTag)) { |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 222 | nativeTraceBegin(traceTag, methodName); |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Writes a trace message to indicate that the current method has ended. |
| 228 | * Must be called exactly once for each call to {@link #traceBegin} using the same tag. |
| 229 | * |
| 230 | * @param traceTag The trace tag. |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 231 | * |
| 232 | * @hide |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 233 | */ |
| 234 | public static void traceEnd(long traceTag) { |
Andy McFadden | d11ca4d | 2012-10-22 16:16:06 -0700 | [diff] [blame] | 235 | if (isTagEnabled(traceTag)) { |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 236 | nativeTraceEnd(traceTag); |
| 237 | } |
| 238 | } |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 239 | |
| 240 | /** |
Romain Guy | 9425f92 | 2013-04-10 16:35:48 -0700 | [diff] [blame] | 241 | * Writes a trace message to indicate that a given section of code has |
| 242 | * begun. Must be followed by a call to {@link #asyncTraceEnd} using the same |
| 243 | * tag. Unlike {@link #traceBegin(long, String)} and {@link #traceEnd(long)}, |
| 244 | * asynchronous events do not need to be nested. The name and cookie used to |
| 245 | * begin an event must be used to end it. |
| 246 | * |
| 247 | * @param traceTag The trace tag. |
| 248 | * @param methodName The method name to appear in the trace. |
| 249 | * @param cookie Unique identifier for distinguishing simultaneous events |
| 250 | * |
| 251 | * @hide |
| 252 | */ |
| 253 | public static void asyncTraceBegin(long traceTag, String methodName, int cookie) { |
| 254 | if (isTagEnabled(traceTag)) { |
| 255 | nativeAsyncTraceBegin(traceTag, methodName, cookie); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Writes a trace message to indicate that the current method has ended. |
| 261 | * Must be called exactly once for each call to {@link #asyncTraceBegin(long, String, int)} |
| 262 | * using the same tag, name and cookie. |
| 263 | * |
| 264 | * @param traceTag The trace tag. |
| 265 | * @param methodName The method name to appear in the trace. |
| 266 | * @param cookie Unique identifier for distinguishing simultaneous events |
| 267 | * |
| 268 | * @hide |
| 269 | */ |
| 270 | public static void asyncTraceEnd(long traceTag, String methodName, int cookie) { |
| 271 | if (isTagEnabled(traceTag)) { |
| 272 | nativeAsyncTraceEnd(traceTag, methodName, cookie); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | /** |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 277 | * Writes a trace message to indicate that a given section of code has begun. This call must |
Jamie Gennis | 5800fc8 | 2013-04-09 18:37:22 -0700 | [diff] [blame] | 278 | * be followed by a corresponding call to {@link #endSection()} on the same thread. |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 279 | * |
| 280 | * <p class="note"> At this time the vertical bar character '|', newline character '\n', and |
| 281 | * null character '\0' are used internally by the tracing mechanism. If sectionName contains |
| 282 | * these characters they will be replaced with a space character in the trace. |
| 283 | * |
| 284 | * @param sectionName The name of the code section to appear in the trace. This may be at |
| 285 | * most 127 Unicode code units long. |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 286 | */ |
Jamie Gennis | 5800fc8 | 2013-04-09 18:37:22 -0700 | [diff] [blame] | 287 | public static void beginSection(String sectionName) { |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 288 | if (isTagEnabled(TRACE_TAG_APP)) { |
| 289 | if (sectionName.length() > MAX_SECTION_NAME_LEN) { |
| 290 | throw new IllegalArgumentException("sectionName is too long"); |
| 291 | } |
| 292 | nativeTraceBegin(TRACE_TAG_APP, sectionName); |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Writes a trace message to indicate that a given section of code has ended. This call must |
Jamie Gennis | 5800fc8 | 2013-04-09 18:37:22 -0700 | [diff] [blame] | 298 | * be preceeded by a corresponding call to {@link #beginSection(String)}. Calling this method |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 299 | * will mark the end of the most recently begun section of code, so care must be taken to |
Jamie Gennis | 5800fc8 | 2013-04-09 18:37:22 -0700 | [diff] [blame] | 300 | * ensure that beginSection / endSection pairs are properly nested and called from the same |
| 301 | * thread. |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 302 | */ |
Jamie Gennis | 5800fc8 | 2013-04-09 18:37:22 -0700 | [diff] [blame] | 303 | public static void endSection() { |
Jamie Gennis | f9c7d6b | 2013-03-25 14:18:25 -0700 | [diff] [blame] | 304 | if (isTagEnabled(TRACE_TAG_APP)) { |
| 305 | nativeTraceEnd(TRACE_TAG_APP); |
| 306 | } |
| 307 | } |
Jeff Brown | 481c157 | 2012-03-09 14:41:15 -0800 | [diff] [blame] | 308 | } |