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.

如需如何使用typeperf的範例,請參閱範例For examples of how to use typeperf, see Examples.

語法Syntax

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

參數Parameters

參數Parameter 描述Description
@no__t 0counter [counter [...]]><counter [counter […]]> 指定要監視的效能計數器。Specifies performance counters to monitor.

注意

@no__t 1counter > 是效能計數器的完整名稱, \ @ no__t-4Computer\Object (實例) \Counter格式,例如 \ @ no__t-7Server1\Processor (0) % 使用者時間<counter> is the full name of a performance counter in \\Computer\Object(Instance)\Counter format, such as \\Server1\Processor(0)% User Time.

選項。Options

選項Option 描述Description
-?-? 顯示即時線上說明。Displays context-sensitive help.
-f <CSV @ no__t-1TSV @ no__t-2BIN @ no__t-3SQL >-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 [物件]-q [object] 顯示已安裝的計數器清單(沒有實例)。Display a list of installed counters (no instances). 若要列出一個物件的計數器,請包含物件名稱。To list counters for one object, include the object name. * @ NO__T-1 @ NO__T-2EXAMPLE***EXAMPLE
-qx [物件]-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 <檔案名 >-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.

典型Examples

  • 下列範例會將本機電腦之效能計數器的值 \ @ no__t-2Processor (_total) % 處理器時間寫入到命令視窗的預設取樣間隔1秒,直到按下 CTRL + C 為止。The following example writes 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.
    typeperf "\Processor(_Total)\% Processor Time"
    
  • 下列範例會以5秒的取樣間隔,將檔案計數器中的計數器清單值寫入至 tab 鍵分隔的檔案domain2> ... ,直到收集50樣本為止。The following example writes 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.
    typeperf -cf counters.txt -si 5 -sc 50 -f TSV -o domain2.tsv
    
  • 下列範例會查詢已安裝的計數器,其中包含 counter 物件PhysicalDisk的實例,並將產生的清單寫入檔案計數器 .txtThe following example queries installed counters with instances for the counter object PhysicalDisk and writes the resulting list to the file counters.txt.
    typeperf -qx PhysicalDisk -o counters.txt