Debug.StartMethodTracing 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| StartMethodTracing() |
開始方法追蹤,使用預設的日誌名稱和緩衝區大小。 |
| StartMethodTracing(String) |
開始方法追蹤,指定追蹤日誌檔案路徑。 |
| StartMethodTracing(String, Int32) |
開始方法追蹤,指定追蹤日誌檔名與緩衝區大小。 |
| StartMethodTracing(String, Int32, DebugTraceOptions) |
開始方法追蹤,指定追蹤日誌檔名、緩衝區大小及旗標。 |
StartMethodTracing()
開始方法追蹤,使用預設的日誌名稱和緩衝區大小。
[Android.Runtime.Register("startMethodTracing", "()V", "")]
public static void StartMethodTracing();
[<Android.Runtime.Register("startMethodTracing", "()V", "")>]
static member StartMethodTracing : unit -> unit
- 屬性
備註
開始方法追蹤,使用預設的日誌名稱和緩衝區大小。
預設情況下,追蹤檔案稱為「dmtrace.trace」,並放置在你套件專用目錄中的主要共享/外部儲存裝置下,根據 Context#getExternalFilesDir(String)。
有關讀取追蹤檔案的資訊,請參閱 使用 Traceview 檢查追蹤日誌 。
啟用方法追蹤時,虛擬機會比平常更慢,因此追蹤檔案的時序應僅以相對方式考慮(例如,執行速度 #1 比執行 #2 快)。 原生方法的時間不會改變,所以不要用它來比較同一方法的直譯型和原生實作的效能。 作為替代方案,考慮使用基於取樣的方法追蹤 #startMethodTracingSampling(String, int, int) ,或在模擬器中透過 #startNativeTracing()進行「原生」追蹤。
Java 文件 android.os.Debug.startMethodTracing()。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
StartMethodTracing(String)
開始方法追蹤,指定追蹤日誌檔案路徑。
[Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;)V", "")]
public static void StartMethodTracing(string? tracePath);
[<Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;)V", "")>]
static member StartMethodTracing : string -> unit
參數
- tracePath
- String
建立追蹤日誌檔案的路徑。 如果 null,則預設為「dmtrace.trace」。 如果檔案已經存在,則會被截斷。 如果給出的路徑不以「.trace」結尾,會自動幫你加上。
- 屬性
備註
開始方法追蹤,指定追蹤日誌檔案路徑。
當給出相對檔案路徑時,追蹤檔案會被放置在你主要共享/外部儲存裝置的套件專用目錄下,根據 Context#getExternalFilesDir(String)。
有關讀取追蹤檔案的資訊,請參閱 使用 Traceview 檢查追蹤日誌 。
啟用方法追蹤時,虛擬機會比平常更慢,因此追蹤檔案的時序應僅以相對方式考慮(例如,執行速度 #1 比執行 #2 快)。 原生方法的時間不會改變,所以不要用它來比較同一方法的直譯型和原生實作的效能。 作為替代方案,考慮使用基於取樣的方法追蹤 #startMethodTracingSampling(String, int, int) ,或在模擬器中透過 #startNativeTracing()進行「原生」追蹤。
Java 文件 android.os.Debug.startMethodTracing(java.lang.String)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
StartMethodTracing(String, Int32)
開始方法追蹤,指定追蹤日誌檔名與緩衝區大小。
[Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;I)V", "")]
public static void StartMethodTracing(string? tracePath, int bufferSize);
[<Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;I)V", "")>]
static member StartMethodTracing : string * int -> unit
參數
- tracePath
- String
建立追蹤日誌檔案的路徑。 如果 null,則預設為「dmtrace.trace」。 如果檔案已經存在,則會被截斷。 如果給出的路徑不以「.trace」結尾,會自動幫你加上。
- bufferSize
- Int32
我們收集的最大量痕跡資料。 如果沒有提供,預設是 8MB。
- 屬性
備註
開始方法追蹤,指定追蹤日誌檔名與緩衝區大小。
當給出相對檔案路徑時,追蹤檔案會被放置在你主要共享/外部儲存裝置的套件專用目錄下,根據 Context#getExternalFilesDir(String)。
有關讀取追蹤檔案的資訊,請參閱 使用 Traceview 檢查追蹤日誌 。
啟用方法追蹤時,虛擬機會比平常更慢,因此追蹤檔案的時序應僅以相對方式考慮(例如,執行速度 #1 比執行 #2 快)。 原生方法的時間不會改變,所以不要用它來比較同一方法的直譯型和原生實作的效能。 作為替代方案,考慮使用基於取樣的方法追蹤 #startMethodTracingSampling(String, int, int) ,或在模擬器中透過 #startNativeTracing()進行「原生」追蹤。
Java 文件 android.os.Debug.startMethodTracing(java.lang.String, int)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
StartMethodTracing(String, Int32, DebugTraceOptions)
開始方法追蹤,指定追蹤日誌檔名、緩衝區大小及旗標。
[Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;II)V", "")]
public static void StartMethodTracing(string? tracePath, int bufferSize, Android.OS.DebugTraceOptions flags);
[<Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;II)V", "")>]
static member StartMethodTracing : string * int * Android.OS.DebugTraceOptions -> unit
參數
- tracePath
- String
建立追蹤日誌檔案的路徑。 如果 null,則預設為「dmtrace.trace」。 如果檔案已經存在,則會被截斷。 如果給出的路徑不以「.trace」結尾,會自動幫你加上。
- bufferSize
- Int32
我們收集的最大量痕跡資料。 如果沒有提供,預設是 8MB。
- flags
- DebugTraceOptions
用來控制方法追蹤的旗標。 支援的旗幟如下:0x0001 #TRACE_COUNT_ALLOCS
Flags to control time source: These are available with API #34 and higher.
0x0010 Report the elapsed time since the start of the trace.
0x0100 Report the time the thread has spent on the CPU since the start of the
trace. Please note that the thread cpu incurs a significant (typically
2-3x) performance penalty. Use this flag only when necessary.
If neither of these flags are set, both the elapsed time and the thread cpu time
are reported.
- 屬性
備註
開始方法追蹤,指定追蹤日誌檔名、緩衝區大小及旗標。
當給出相對檔案路徑時,追蹤檔案會被放置在你主要共享/外部儲存裝置的套件專用目錄下,根據 Context#getExternalFilesDir(String)。
有關讀取追蹤檔案的資訊,請參閱 使用 Traceview 檢查追蹤日誌 。
啟用方法追蹤時,虛擬機會比平常更慢,因此追蹤檔案的時序應僅以相對方式考慮(例如,執行速度 #1 比執行 #2 快)。 原生方法的時間不會改變,所以不要用它來比較同一方法的直譯型和原生實作的效能。 作為替代方案,考慮使用基於取樣的方法追蹤 #startMethodTracingSampling(String, int, int) ,或在模擬器中透過 #startNativeTracing()進行「原生」追蹤。
Java 文件 android.os.Debug.startMethodTracing(java.lang.String, int, int)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。