typeperftypeperf

Typeperf 命令會將效能資料寫入至命令視窗或記錄檔。The typeperf command writes performance data to the command window or to a log file. 若要停止 typeperf,請按 CTRL + C。To stop typeperf, press CTRL+C.

語法Syntax

typeperf <counter [counter ...]> [options]
typeperf -cf <filename> [options]
typeperf -q [object] [options]
typeperf -qx [object] [options]

參數Parameters

參數Parameter 描述Description
<counter [counter […]]> 指定要監視的效能計數器。Specifies performance counters to monitor. <counter>參數是 \ Computer\Object (實例) \counter 格式之效能計數器的完整名稱,例如 \\Server1\Processor(0)\% User TimeThe <counter> parameter is the full name of a performance counter in \Computer\Object(Instance)\Counter format, such as \\Server1\Processor(0)\% User Time.

選項。Options

選項Option 描述Description
-f <CSV | TSV | BIN | SQL>-f <CSV | TSV | BIN | SQL> 指定輸出檔案格式。Specifies the output file format. 預設值為 CSV。The default is CSV.
-cf <filename>-cf <filename> 指定一個檔案,其中包含要監視的效能計數器清單,每行一個計數器。Specifies a file containing a list of performance counters to monitor, with one counter per line.
-si <[[hh:]mm:]ss>-si <[[hh:]mm:]ss> 指定取樣間隔。Specifies the sample interval. 預設值為一秒。The default is one second.
-o <filename>-o <filename> 指定輸出檔案或 SQL 資料庫的路徑。Specifies the path for the output file, or the SQL database. 預設值為 STDOUT (寫入至命令視窗) 。The default is STDOUT (written to the command window).
-q [object]-q [object] 顯示已安裝的計數器清單, (沒有任何實例) 。Display a list of installed counters (no instances). 若要列出一個物件的計數器,請包含物件名稱。To list counters for one object, include the object name. 例子***EXAMPLE
-qx [object]-qx [object] 顯示已安裝的計數器清單與實例。Display a list of installed counters with instances. 若要列出一個物件的計數器,請包含物件名稱。To list counters for one object, include the object name.
-sc <samples>-sc <samples> 指定要收集的樣本數目。Specifies the number of samples to collect. 預設值是在按下 CTRL + C 之前收集資料。The default is to collect data until CTRL+C is pressed.
-config <filename>-config <filename> 指定包含命令選項的設定檔。Specifies a settings file containing command options.
-s <computer_name>-s <computer_name> 指定當計數器路徑中沒有指定電腦時,要監視的遠端電腦。Specifies a remote computer to monitor if no computer is specified in the counter path.
-y-y 回答 所有 問題而不提示。Answer yes to all questions without prompting.
/?/? 在命令提示字元顯示說明。Displays help at the command prompt.

範例Examples

若要將本機電腦的效能計數器值以 \Processor(_Total)\% Processor Time 1 秒的預設取樣間隔寫入至命令視窗,直到按下 CTRL + C 為止,請輸入:To write the values for the local computer's performance counter \Processor(_Total)\% Processor Time to the command window at a default sample interval of 1 second until CTRL+C is pressed, type:

typeperf \Processor(_Total)\% Processor Time

若要將檔案中的計數器清單值 counters.txt 到以 tab 分隔的檔案 >domain2.contoso.com ,在5秒的取樣間隔內,直到收集50樣本為止,請輸入:To write the values for the list of counters in the file counters.txt to the tab-delimited file domain2.tsv at a sample interval of 5 seconds until 50 samples have been collected, type:

typeperf -cf counters.txt -si 5 -sc 50 -f TSV -o domain2.tsv

若要使用 PhysicalDisk 計數器物件的實例來查詢已安裝的計數器,並將產生的清單寫入 counters.txt 的檔案,請輸入:To query installed counters with instances for the counter object PhysicalDisk and writes the resulting list to the file counters.txt, type:

typeperf -qx PhysicalDisk -o counters.txt

其他參考Additional References