Featured image of post Mini Blog: Checking processor performance

Mini Blog: Checking processor performance

I haven’t been blogging alot lately, mostly due to renovating at home and having very large projects in the office. To compensate I’ve decided to write some quick mini blogs to make sure I don’t lose the magic 🙂

I’ve found with some application monitoring I’ve been setting up it was required to make a quick snapshot of how heavy the processor was being used during my scripts, as the application made some SQL queries it could create spikes in the CPU that I wanted to avoid.

To take a quick snapshot of the current values of the processor status, I’ve used the get-counter cmdlet and retrieved the cooked value of this to query it further;

1
2
3
4
5
6

$CPUQueueLength = (get-counter -counter "\System\Processor Queue Length").countersamples.cookedvalue

$CPUUSerTime = (get-counter -counter "\Processor(*)\% User Time").countersamples.cookedvalue

$CPUPrivTime = (get-counter -counter "\Processor(*)\% Privileged Time").countersamples.cookedvalue

Happy scripting 🙂

All blogs are posted under AGPL3.0 unless stated otherwise
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy