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. 默认值为1秒。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 在 5 50 秒的采样间隔内的文件 2 中,请键入: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