Windows Performance counters scripts

Windows Performance counters scripts

Windows Performance counter 雖然提供友善的UI介面可以選取,

但是要選哪些counter,跟每次都要從上百個中選出要的couter還是有些花時間,

因此,這篇文章主要提供一個簡便的 script ,讓你可以直接收集相關的效能計數器。

 

如何執行

於 command mode 下,執行下列指令。下列例子,每隔五秒擷取一些,共擷取50次效能監控的樣本

輸出結果到 MyOutput.csv

CSV的格式,因此可以用 EXCEL 開啟後,針對該資料進行圖表的繪製與分析

typeperf -cf counters.txt -si 5 -sc 50 -f CSV -o MyOutput.csv

 

定義效能監視

如果針對特定的 process 需要擷取相關效能資訊,

可以自行更改 process 名稱,例如這個例子是以 Notepad 這個process 為例

Performance counter 的收集不外乎是四大類:

  • CPU
  • Memory
  • Disk
  • Network

 

(Counters.txt)

[pastacode lang=”javascript” message=”Performance Counter (Counters.txt)” highlight=”” provider=”manual”]

"\Processor(_Total)\% Processor Time"
"\Processor(_Total)\% Privileged Time"
"\Processor(_Total)\% User Time"

"\PhysicalDisk(_Total)\% Disk Time"
"\PhysicalDisk(_Total)\Avg. Disk Queue Length"
"\PhysicalDisk(_Total)\Avg. Disk sec/Read"
"\PhysicalDisk(_Total)\Avg. Disk sec/Write"

"\Memory\Available MBytes"
"\Memory\Page Faults/sec"


"Network Interface(*)\Bytes Received/sec"
"Network Interface(*)\Bytes Sent/sec"
"Network Interface(*)\Packets Received Errors"
"Network Interface(*)\Packets Outbournd Errors"


"\Process(Notepad)\Private Bytes"
"\Process(Notepad)\% Processor Time"
"\Process(Notepad)\Virtual Bytes"
"\Process(Notepad)\Thread Count"
"\Process(Notepad)\Handle Count"

[/pastacode]

Leave a Reply

Your email address will not be published. Required fields are marked *