語言

ProfilingManager.RequestProfiling 方法

定義

請求系統側寫。

[Android.Runtime.Register("requestProfiling", "(ILandroid/os/Bundle;Ljava/lang/String;Landroid/os/CancellationSignal;Ljava/util/concurrent/Executor;Ljava/util/function/Consumer;)V", "", ApiSince=35)]
public void RequestProfiling(Android.OS.ProfilingType profilingType, Android.OS.Bundle? parameters, string? tag, Android.OS.CancellationSignal? cancellationSignal, Java.Util.Concurrent.IExecutor? executor, Java.Util.Functions.IConsumer? listener);
[<Android.Runtime.Register("requestProfiling", "(ILandroid/os/Bundle;Ljava/lang/String;Landroid/os/CancellationSignal;Ljava/util/concurrent/Executor;Ljava/util/function/Consumer;)V", "", ApiSince=35)>]
member this.RequestProfiling : Android.OS.ProfilingType * Android.OS.Bundle * string * Android.OS.CancellationSignal * Java.Util.Concurrent.IExecutor * Java.Util.Functions.IConsumer -> unit

參數

profilingType
ProfilingType

要收集的屬性分析類型。

parameters
Bundle

請求相關參數的組合。 若 bundle 包含任何未識別的參數,請求將失敗。android.os.ProfilingResult#ERROR_FAILED_INVALID_REQUEST 若參數值超出支援範圍,則會選擇最接近範圍的值。 建議使用 androidx 包裝 器,而非直接產生此封裝。

tag
String

呼叫者定義了資料以協助辨識輸出。 前 20 個字母數字加上破折號會以小寫形式呈現,並包含在輸出檔名中。

cancellationSignal
CancellationSignal

因來電者申請取消。 如有結果,將會回傳。 如果是 null,請求的應用程式將無法停止這個收集。 在逾時後,無論是在提供的設定還是系統預設狀態下,收集都會停止

executor
IExecutor

遺囑執行人可以回電。 此方法僅用於該方法所提供的聽眾。 若此為空,且請求時未註冊全域執行者與監聽者組合,則請求將被捨棄。

listener
IConsumer

聆聽者會被觸發並產生結果。 任何透過該網站 #registerForAllProfilingResults 註冊的全球聽眾也會被觸發。 若此為空,且請求時未註冊全域監聽器與執行者組合,則請求將被丟棄。

屬性

備註

請求系統側寫。

注意:大多數使用情境不建議直接使用此 API。 考慮使用 AndroidX 提供的高階包裝器 ,這些包裝器能正確構建請求,並支援簡化的請求參數選項。

請求必須同時設定監聽者與執行者,請求才會被考慮履行。 在此方法中,聽者/執行者對可設定為 ,或 #registerForAllProfilingResults兩者皆為。 監聽者與執行者必須在同一通話中同時設定。 若未設定監聽者與執行者組合,請求將被丟棄,且不會收到回撥。

申請將有速率限制,且不保證會被滿足。

在開始分析前可能會有延遲。 對於連續剖析類型(系統追蹤、堆疊取樣和堆疊剖析),我們建議提早開始收集,並在感興趣區域後立即停止, cancellationSignal 以確保你想要剖析的區段被捕捉到。 對於堆卸,我們建議在本地測試,以確保堆積傾倒在適當時間被收集。

Java 文件 android.os.ProfilingManager.requestProfiling(int, android.os.Bundle, java.lang.String, android.os.CancellationSignal, java.util.concurrent.Executor, java.util.function.Consumer<android.os.ProfilingResult>)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於