Create Windows Performance Counter for SQL Server and Disk I/O (Perfmon) via command line

Steps to create PerfMon.  (Tested in Windows 2016)


  1. create a folder "D:\PerfMonLogs\" for storing the log
  2. run a command prompt as Administrator
  3. Capture SQL log:
    1. Configuration the perfmon with below steps
      1. For default instance:

        logman create counter myperf -f bin -c "\SQLServer:Buffer Manager\*" "\SQLServer:Memory Node(*)\*" "\SQLServer:Buffer Node(*)\*" "\SQLServer:Locks(*)\*" "\SQLServer:Databases(*)\*" "\SQLServer:Database Mirroring(*)\*" "\SQLServer:General Statistics\*" "\SQLServer:Latches\*" "\SQLServer:Access Methods\*" "\SQLServer:SQL Statistics\*" "\SQLServer:Memory Manager\*" "\SQLServer:Wait Statistics(*)\*" "\LogicalDisk(*)\*" "\PhysicalDisk(*)\*" "\Processor(*)\*" "\Process(*)\*" "\Memory\*" "\System\*" -si 00:00:01 -o D:\PerfMonLogs\my_perf_log.blg  -cnf 24:00:00 -max 500
         

      2. Or use below command for named instance:

        logman create counter myperf -f bin -c "\MSSQL$InstanceName:Buffer Manager\*" "\MSSQL$InstanceName:Memory Node(*)\*" "\MSSQL$InstanceName:Buffer Node(*)\*" "\MSSQL$InstanceName:Locks(*)\*" "\MSSQL$InstanceName:Databases(*)\*" "\MSSQL$InstanceName:Database Mirroring(*)\*" "\MSSQL$InstanceName:General Statistics\*" "\MSSQL$InstanceName:Latches\*" "\MSSQL$InstanceName:Availability Replica(*)\*" "\MSSQL$InstanceName:Database Replica(*)\*" "\MSSQL$InstanceName:Access Methods\*" "\MSSQL$InstanceName:SQL Statistics\*" "\MSSQL$InstanceName:Memory Manager\*" "\MSSQL$InstanceName:Wait Statistics(*)\*" "\LogicalDisk(*)\*" "\PhysicalDisk(*)\*" "\Processor(*)\*" "\Process(*)\*" "\Memory\*" "\System\*" -si 00:00:01 -o D:\PerfMonLogs\my_perf_log.blg  -cnf 24:00:00 -max 500

    2. Start the perfmon
      logman start myperf

    3. Stop the perfmon
      logman stop myperf

  4. Capture Disk I/O (StorPort) log
    1. Create trace as below:
      Logman create trace "drivers_storage" -ow -o D:\PerfMonLogs\drivers_storage.etl -p "Microsoft-Windows-StorPort" 0xffffffffffffffff 0xff -nb 16 16 -bs 1024 -mode Circular -f bincirc -max 4096 -ets

    2. Create workload on SQL server and wait for a few minute

    3. Stop the trace:
      Logman stop "drivers_storage" -ets

  5. Compress and upload all the .blg files from "D:\PerfMonLogs\"

 

Comments

Popular Posts