ProcessThread.PrivilegedProcessorTime 屬性

定義

取得執行緒在作業系統核心中執行程式碼所耗用的時間量。Gets the amount of time that the thread has spent running code inside the operating system core.

public:
 property TimeSpan PrivilegedProcessorTime { TimeSpan get(); };
public TimeSpan PrivilegedProcessorTime { get; }
member this.PrivilegedProcessorTime : TimeSpan
Public ReadOnly Property PrivilegedProcessorTime As TimeSpan

屬性值

TimeSpan,表示執行緒在作業系統核心中執行程式碼所耗用的時間量。A TimeSpan indicating the amount of time that the thread has spent running code inside the operating system core.

例外狀況

無法擷取執行緒時間。The thread time could not be retrieved.

處理序位於遠端電腦上。The process is on a remote computer.

備註

Windows 使用數種不同的保護機制, 而在其根目錄中, 兩者都是使用者模式與特殊許可權模式之間的區別。Windows uses several different protection mechanisms, and at the root of them all is the distinction between user mode and privileged mode. PrivilegedProcessorTime對應至作業系統核心內, 應用程式在特殊許可權模式下執行所花的時間量。PrivilegedProcessorTime corresponds to the amount of time that the application has spent running in privileged mode, inside the operating system core. UserProcessorTime屬性會指出應用程式在系統核心外部以使用者模式執行程式碼所花費的時間量。The UserProcessorTime property indicates the amount of time that the application has spent running code in user mode, outside the system core.

使用者模式會以兩個重要的方式限制應用程式。User mode restricts the application in two important ways. 首先, 應用程式無法直接存取週邊設備, 而是必須呼叫作業系統核心來取得或設定週邊資料。First, the application cannot directly access the peripherals, but instead must call the operating system core to get or set peripheral data. 因此, 作業系統可以確保某個應用程式不會摧毀其他人所需的週邊資料。The operating system can thus ensure that one application does not destroy peripheral data that is needed by another. 第二, 應用程式無法讀取或變更作業系統本身維護的資料。Second, the application cannot read or change data that the operating system itself maintains. 這項限制可防止應用程式不慎或故意損壞核心。This restriction prevents applications from either inadvertently or intentionally corrupting the core. 如果應用程式需要作業系統才能執行作業, 它會呼叫其中一個系統常式。If the application needs the operating system to perform an operation, it calls one of the system's routines. 其中有許多轉換成特殊許可權模式、執行作業, 以及順暢地回到使用者模式。Many of these transition into privileged mode, perform the operation, and smoothly return to user mode.

適用於

另請參閱