VMware Cloud Community
WilsF
Contributor
Contributor
Jump to solution

Calculating % Proc Time and % Core Util Time

Hi,

I'm trying to write a PowerShell script to collect % Processor Time to % Core Util Time ratio of multiple vSphere hosts using the Get-ESXtop command in PowerCLI.  I've been using LucD's guide to Get-ESXtop (http://www.lucd.info/2011/04/03/hitchhikers-guide-to-get-esxtop-part-2-the-wrapper/) , but can't get results that even come close to matching actual ESXtop data. 

In order to get % Proc and % Core Util Time, I use the UsedTimeInUsec and CoreHaltTimeInUsec LCPU counters, respectively.  Using the derivation method listed for PCPUUtil, I convert these raw values to the percentages from ESXtop: (n – n-1) / ESX-interval / 1E6 * 100

These percentages more-or-less match up with ESXtop for % Proc Time, but the values for % Core Util Time do not make sense.  The differences in the raw CoreHaltTimeInUsec data are roughly two orders of magnitude higher than those of the UsedTimeInUsec numbers leading to percentages that don't make sense (>100%).

Does anyone here have any ideas why this discrepancy is present?

Here's an example of some of my raw numbers:

Differences in UsedTimeInUsec

% Processor Time

323544

81555

746247

298459

500901

499624

664155

545064

626532

207229

6.47088

1.6311

14.92494

5.96918

10.01802

9.99248

13.2831

10.90128

12.53064

4.14458

Differences in CoreHaltTimeInUsec

% Core Util Time

5124259

5124259

4560600

4560548

4651946

4651946

4424210

4424210

4773042

4773042

102.48518

102.48518

91.212

91.21096

93.03892

93.03892

88.4842

88.4842

95.46084

95.46084

Appreciate any ideas!

Wilson

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The post is up, see Get-EsxTop – Another Look

It only contains limited metrics for now.

I hope to expand soon.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
12 Replies
LucD
Leadership
Leadership
Jump to solution

Would you mind sharing the script you have so far?
And which PowerCLI and vSphere version are you using?

There might be some differences with my original post in later versions.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
WilsF
Contributor
Contributor
Jump to solution

I've attached the function that does the calculations.

I'm interested in 2 * % Proc Time/ % Core Util Time ratio, so I end up canceling out factors (ESX_interval, 1E6, and 100) in both the numerator and denominator.  Also, since the counters are returned per logical CPU, I sum the differences for each LCPU before taking the ratio.  To assist in debugging, I've added the respective percentages back into the returned object.

Reply
0 Kudos
WilsF
Contributor
Contributor
Jump to solution

Does anyone have any ideas based off of the cmdlet I provided?  Assuming I'm calculating this correctly, either the raw data returned for the counters are wrong or the counters I'm using are wrong.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Hold on, I'm preparing a blog post on the subject.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
WilsF
Contributor
Contributor
Jump to solution

Thanks LucD!  Out of curiosity, do you have an ETA on the blog post?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Just finishing the module now, hope to publish tomorrow.

A quick preview, don't mind the negative values

esxtop.png


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
WilsF
Contributor
Contributor
Jump to solution

The preview looks promising!  Looking forward to the post.

Reply
0 Kudos
aseymour4
Contributor
Contributor
Jump to solution

Hi Luc,

Have you had a chance to upload that module to your blog? I'm very interested to read your thoughts on the topic!

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I know, I'm slacking.

Discovered a bug in my code, think I got it fixed now.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

The post is up, see Get-EsxTop – Another Look

It only contains limited metrics for now.

I hope to expand soon.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
WilsF
Contributor
Contributor
Jump to solution

This is exactly what I was looking for times one hundred.  Thank you for writing the post with a module to go along with it!

Reply
0 Kudos
aseymour4
Contributor
Contributor
Jump to solution

Thanks, Luc! WilsF and I greatly appreciate the thoroughness of your analysis and documentation.

Reply
0 Kudos