Reputation: 443
I want to monitor the Memory usage and Performance usage on a Windows machine for long duration greater that 8 hours. I thought of leveraging Windows Performance Monitor (perfmon) for the same. But with this I'm able to convert the .blg to .csv to get the counters only after the Data Collecter stops the data collection even if the data is collected at an interval of 5 seconds.
Is there a way I can get counters every 5 seconds in .csv format? or any better method to get the performance metrics on windows.
Upvotes: 0
Views: 581
Reputation: 245
Here is how to use export-counter
to get a CSV and avoid having to do the BLG to CSV conversion (obviously modifying the command to fit your needs):
Get-Counter -Counter (get-Counter -ListSet Memory).paths -MaxSamples 4 -SampleInterval 1 | Export-Counter -Path c:\temp\memory.csv -FileFormat csv
Upvotes: 0
Reputation: 26170
If you can run powershell scripts you may use get-counter
and export-counter
cmdlets :
you can see a simple example here : http://technet.microsoft.com/en-us/magazine/ee872428.aspx
If you are on a localised windows (not english), you will have to get the correct counter name before. For example in my french windows version it will be :
Get-counter -ListSet *
this will display all the available counterset. I can see there is a set named "processeur" wich is the french word for CPU. So now i can get the available counter for this set like this:
Get-counter -ListSet "processeur" |select -expand counter
it gives me the result :
PS>Get-counter -ListSet "processeur" |select -expand counter \Processeur()\% temps processeur
\Processeur()\% temps utilisateur
\Processeur()\% temps privilégié
\Processeur()\Interruptions/s
\Processeur()\% temps DPC
\Processeur()\% temps d'interruption
\Processeur()\DPC mis en file d'attente/s
\Processeur()\Taux DPC
\Processeur()\% d'inactivité
\Processeur()\% durée C1
\Processeur()\% durée C2
\Processeur()\% durée C3
\Processeur()\Transitions C1/s
\Processeur()\Transitions C2/s
\Processeur(*)\Transitions C3/s
Now I can use one or more of these counter like this :
get all the counters :
Get-counter -ListSet "processeur" |select -expand counter | foreach{ get-counter $_ -SampleInterval 2 -MaxSamples 10}
get inactivity counter : Get-counter -ListSet "processeur" |select -expand counter |where {$_ -match "inactivité"} | foreach{ get-counter $_ -SampleInterval 2 -MaxSamples 10}
At least, you can pipe the result to export-counter
in order to save it to a file (CSV, TSV, or BLG). Hope that's help
Upvotes: 0