Stay organized with collections
Save and categorize content based on your preferences.
Tracing
Summary
Functions
|
ATrace_beginAsyncSection(const char *sectionName, int32_t cookie)
|
void
Writes a trace message to indicate that a given section of code has begun.
|
ATrace_beginSection(const char *sectionName)
|
void
Writes a tracing message to indicate that the given section of code has begun.
|
ATrace_endAsyncSection(const char *sectionName, int32_t cookie)
|
void
Writes a trace message to indicate that the current method has ended.
|
ATrace_endSection()
|
void
Writes a tracing message to indicate that a given section of code has ended.
|
ATrace_isEnabled()
|
bool
Returns true if tracing is enabled.
|
ATrace_setCounter(const char *counterName, int64_t counterValue)
|
void
Writes trace message to indicate the value of a given counter.
|
Functions
ATrace_beginAsyncSection
Declared in android/trace.h
void ATrace_beginAsyncSection(
const char *sectionName,
int32_t cookie
)
Writes a trace message to indicate that a given section of code has begun.
Must be followed by a call to ATrace_endAsyncSection with the same methodName and cookie. Unlike ATrace_beginSection and ATrace_endSection, asynchronous events do not need to be nested. The name and cookie used to begin an event must be used to end it.
Available since API level 29.
Details |
Parameters |
sectionName
|
The method name to appear in the trace.
|
cookie
|
Unique identifier for distinguishing simultaneous events
|
|
ATrace_beginSection
Declared in android/trace.h
void ATrace_beginSection(
const char *sectionName
)
Writes a tracing message to indicate that the given section of code has begun.
This call must be followed by a corresponding call to ATrace_endSection on the same thread.
Note: At this time the vertical bar character '|' and newline character '\n' are used internally by the tracing mechanism. If sectionName
contains these characters they will be replaced with a space character in the trace.
Available since API level 23.
ATrace_endAsyncSection
Declared in android/trace.h
void ATrace_endAsyncSection(
const char *sectionName,
int32_t cookie
)
Writes a trace message to indicate that the current method has ended.
Must be called exactly once for each call to ATrace_beginAsyncSection using the same name and cookie.
Available since API level 29.
Details |
Parameters |
sectionName
|
The method name to appear in the trace.
|
cookie
|
Unique identifier for distinguishing simultaneous events
|
|
ATrace_endSection
Declared in android/trace.h
void ATrace_endSection()
Writes a tracing message to indicate that a given section of code has ended.
This call must be preceeded by a corresponding call to ATrace_beginSection on the same thread. Calling this method will mark the end of the most recently begun section of code, so care must be taken to ensure that ATrace_beginSection/ATrace_endSection pairs are properly nested and called from the same thread.
Available since API level 23.
ATrace_isEnabled
Declared in android/trace.h
bool ATrace_isEnabled()
Returns true if tracing is enabled.
Use this to avoid expensive computation only necessary when tracing is enabled.
Available since API level 23.
ATrace_setCounter
Declared in android/trace.h
void ATrace_setCounter(
const char *counterName,
int64_t counterValue
)
Writes trace message to indicate the value of a given counter.
Available since API level 29.
Details |
Parameters |
counterName
|
The counter name to appear in the trace.
|
counterValue
|
The counter value.
|
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-11-19 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-19 UTC."],[],[],null,["# Tracing\n=======\n\nSummary\n-------\n\n| ### Functions ||\n|-----------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|\n| [ATrace_beginAsyncSection](#group___tracing_1gac4becb4be939b590913adc7ebb5b8428)`(const char *sectionName, int32_t cookie)` | `void` Writes a trace message to indicate that a given section of code has begun. |\n| [ATrace_beginSection](#group___tracing_1ga13768bfdb5d90166ec50bc41235e2797)`(const char *sectionName)` | `void` Writes a tracing message to indicate that the given section of code has begun. |\n| [ATrace_endAsyncSection](#group___tracing_1gabc6f8b943c0469a827abd8533b2ab4b6)`(const char *sectionName, int32_t cookie)` | `void` Writes a trace message to indicate that the current method has ended. |\n| [ATrace_endSection](#group___tracing_1gacd849f3cdbe927673c0ad8740c369aed)`()` | `void` Writes a tracing message to indicate that a given section of code has ended. |\n| [ATrace_isEnabled](#group___tracing_1gad839953d2c6d4189ec80f7b028f7f778)`()` | `bool` Returns true if tracing is enabled. |\n| [ATrace_setCounter](#group___tracing_1ga8a31ac945206b18a394d2fcb536c06fb)`(const char *counterName, int64_t counterValue)` | `void` Writes trace message to indicate the value of a given counter. |\n\nFunctions\n---------\n\n### ATrace_beginAsyncSection\n\nDeclared in `android/trace.h` \n\n```gdscript\nvoid ATrace_beginAsyncSection(\n const char *sectionName,\n int32_t cookie\n)\n``` \nWrites a trace message to indicate that a given section of code has begun.\n\nMust be followed by a call to [ATrace_endAsyncSection](/ndk/reference/group/tracing#group___tracing_1gabc6f8b943c0469a827abd8533b2ab4b6) with the same methodName and cookie. Unlike [ATrace_beginSection](/ndk/reference/group/tracing#group___tracing_1ga13768bfdb5d90166ec50bc41235e2797) and [ATrace_endSection](/ndk/reference/group/tracing#group___tracing_1gacd849f3cdbe927673c0ad8740c369aed), asynchronous events do not need to be nested. The name and cookie used to begin an event must be used to end it.\n\nAvailable since API level 29.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |---------------|----------------------------------------------------------| | `sectionName` | The method name to appear in the trace. | | `cookie` | Unique identifier for distinguishing simultaneous events | |\n\n### ATrace_beginSection\n\nDeclared in `android/trace.h` \n\n```gdscript\nvoid ATrace_beginSection(\n const char *sectionName\n)\n``` \nWrites a tracing message to indicate that the given section of code has begun.\n\nThis call must be followed by a corresponding call to [ATrace_endSection](/ndk/reference/group/tracing#group___tracing_1gacd849f3cdbe927673c0ad8740c369aed) on the same thread.\n\nNote: At this time the vertical bar character '\\|' and newline character '\\\\n' are used internally by the tracing mechanism. If `sectionName` contains these characters they will be replaced with a space character in the trace.\n\nAvailable since API level 23. \n\n### ATrace_endAsyncSection\n\nDeclared in `android/trace.h` \n\n```gdscript\nvoid ATrace_endAsyncSection(\n const char *sectionName,\n int32_t cookie\n)\n``` \nWrites a trace message to indicate that the current method has ended.\n\nMust be called exactly once for each call to [ATrace_beginAsyncSection](/ndk/reference/group/tracing#group___tracing_1gac4becb4be939b590913adc7ebb5b8428) using the same name and cookie.\n\nAvailable since API level 29.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |---------------|----------------------------------------------------------| | `sectionName` | The method name to appear in the trace. | | `cookie` | Unique identifier for distinguishing simultaneous events | |\n\n### ATrace_endSection\n\nDeclared in `android/trace.h` \n\n```scdoc\nvoid ATrace_endSection()\n``` \nWrites a tracing message to indicate that a given section of code has ended.\n\nThis call must be preceeded by a corresponding call to [ATrace_beginSection](/ndk/reference/group/tracing#group___tracing_1ga13768bfdb5d90166ec50bc41235e2797) on the same thread. Calling this method will mark the end of the most recently begun section of code, so care must be taken to ensure that [ATrace_beginSection](/ndk/reference/group/tracing#group___tracing_1ga13768bfdb5d90166ec50bc41235e2797)/[ATrace_endSection](/ndk/reference/group/tracing#group___tracing_1gacd849f3cdbe927673c0ad8740c369aed) pairs are properly nested and called from the same thread.\n\nAvailable since API level 23. \n\n### ATrace_isEnabled\n\nDeclared in `android/trace.h` \n\n```scdoc\nbool ATrace_isEnabled()\n``` \nReturns true if tracing is enabled.\n\nUse this to avoid expensive computation only necessary when tracing is enabled.\n\nAvailable since API level 23. \n\n### ATrace_setCounter\n\nDeclared in `android/trace.h` \n\n```gdscript\nvoid ATrace_setCounter(\n const char *counterName,\n int64_t counterValue\n)\n``` \nWrites trace message to indicate the value of a given counter.\n\nAvailable since API level 29.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |----------------|------------------------------------------| | `counterName` | The counter name to appear in the trace. | | `counterValue` | The counter value. | |"]]