ProcessThread.PrivilegedProcessorTime 屬性

定義

取得執行緒在作業系統核心中執行程式碼所耗用的時間量。

public:
 property TimeSpan PrivilegedProcessorTime { TimeSpan get(); };
public TimeSpan PrivilegedProcessorTime { get; }
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public TimeSpan PrivilegedProcessorTime { get; }
member this.PrivilegedProcessorTime : TimeSpan
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
member this.PrivilegedProcessorTime : TimeSpan
Public ReadOnly Property PrivilegedProcessorTime As TimeSpan

屬性值

TimeSpan,表示執行緒在作業系統核心中執行程式碼所耗用的時間量。

屬性

例外狀況

無法擷取執行緒時間。

處理序位於遠端電腦上。

備註

Windows 會使用數種不同的保護機制,而且全都是使用者模式和特殊許可權模式之間的差異。 PrivilegedProcessorTime 會對應到應用程式在作業系統核心內以特殊許可權模式執行所花費的時間量。 屬性 UserProcessorTime 指出應用程式在系統核心外部,在使用者模式中執行程式代碼所花費的時間量。

使用者模式會以兩個重要方式限制應用程式。 首先,應用程式無法直接存取周邊,而是必須呼叫操作系統核心來取得或設定周邊數據。 因此,操作系統可確保一個應用程式不會終結另一個應用程式所需的周邊數據。 其次,應用程式無法讀取或變更操作系統本身維護的數據。 這項限制可防止應用程式不小心或刻意損毀核心。 如果應用程式需要作業系統來執行作業,它會呼叫其中一個系統的例程。 其中許多轉換至特殊許可權模式、執行作業,並順暢地返回使用者模式。

適用於

另請參閱