ProfilingManager Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
This class allows the caller to: <ul> <li>Request profiling and listen for results.
[Android.Runtime.Register("android/os/ProfilingManager", ApiSince=35, DoNotGenerateAcw=true)]
public sealed class ProfilingManager : Java.Lang.Object
[<Android.Runtime.Register("android/os/ProfilingManager", ApiSince=35, DoNotGenerateAcw=true)>]
type ProfilingManager = class
inherit Object
- Inheritance
- Attributes
Remarks
This class allows the caller to: <ul> <li>Request profiling and listen for results. Profiling types supported are: system traces, java heap dumps, heap profiles, and stack traces.</li> <li>Register triggers for the system to capture profiling on the apps behalf.</li> </ul>
The #requestProfiling
API can be used to begin profiling. Profiling may be ended manually using the CancellationSignal provided in the request, or as a result of a timeout. The timeout may be either the system default or caller defined in the parameter bundle for select types.
The profiling results are delivered to the requesting app's data directory and a pointer to the file will be received using the app provided listeners.
Apps can provide listeners in one or both of two ways: <ul> <li>A request-specific listener included with the request. This will trigger only with a result from the request it was provided with.</li> <li>A global listener provided by #registerForAllProfilingResults
. This will be triggered for all results belonging to your app. This listener is the only way to receive results from system triggered profiling instances set up with #addProfilingTriggers
.</li> </ul>
Requests are rate limited and not guaranteed to be filled. Rate limiting can be disabled for local testing of #requestProfiling
using the shell command device_config put profiling_testing rate_limiter.disabled true
For local testing, profiling results can be accessed more easily by enabling debug mode. This will retain output files in a temporary system directory. The locations of the retained files will be available in logcat. The behavior and command varies by version: <ul> <li>For Android versions 16 and above, debug mode will retain both unredacted (where applicable) and redacted results in the temporary directory. It can be enabled with the shell command device_config put profiling_testing delete_temporary_results.disabled true
and disabled by setting that same value back to false. Retained results are accessible on all build types. </li> <li>For Android version 15, debug mode will retain only the unredacted result (where applicable) in the temporary directory. It can be enabled with the shell command device_config put profiling_testing delete_unredacted_trace.disabled true
and disabled by setting that same value back to false. The retained unredacted file can only be accessed on builds with root access. To access the redacted output file on an unrooted device, apps can copy the file from /pkg/files/profiling/file.type
to /pkg/cache/file.type
. </li> </ul>
In order to test profiling triggers, enable testing mode for your app with the shell command device_config put profiling_testing system_triggered_profiling.testing_package_name com.your.app
which will: <ul> <li>Ensure that a background trace is running.</li> <li>Allow all triggers for the provided package name to pass the system level rate limiter. This mode will continue until manually stopped with the shell command device_config delete profiling_testing system_triggered_profiling.testing_package_name
. </li> </ul>
Results are redacted and contain specific information about the requesting process only.
Java documentation for android.os.ProfilingManager
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Fields
ProfilingTypeHeapProfile |
Obsolete.
Profiling type for |
ProfilingTypeJavaHeapDump |
Obsolete.
Profiling type for |
ProfilingTypeStackSampling |
Obsolete.
Profiling type for |
ProfilingTypeSystemTrace |
Obsolete.
Profiling type for |
Properties
Class |
Returns the runtime class of this |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
PeerReference | (Inherited from Object) |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
Methods
AddProfilingTriggers(IList<ProfilingTrigger>) |
Register the provided list of triggers for this process. |
ClearProfilingTriggers() |
Remove all triggers for this process. |
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
RegisterForAllProfilingResults(IExecutor, IConsumer) |
Register a listener to be called for all profiling results for this uid. |
RemoveProfilingTriggersByType(Int32[]) |
Remove triggers for this process with trigger types in the provided list. |
RequestProfiling(ProfilingType, Bundle, String, CancellationSignal, IExecutor, IConsumer) |
Request system profiling. |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterForAllProfilingResults(IConsumer) |
Unregister a listener that was to be called for all profiling results. |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |