jvcoach23 Posted September 17, 2004 Posted September 17, 2004 Need some help. I'm trying to use a perfmon counter. Imports System.Diagnostics.PerformanceCounter Imports System.Diagnostics.CounterSampleCalculator Dim WithEvents oPerfMon As New PerformanceCounter With oPerfMon .CategoryName = vcCategoryName .CounterName = vcCounterName .InstanceName = vcInstance .MachineName = vcServer .BeginInit() End With Dim sTest As Single sTest = Math.Round(oPerfMon.NextValue) this runs fine.. except the sTest is never getting a value. If i setup a breakpoint at the sTest portion, then run in the command windows ? math.round(oPerfmon.nextvalue) I get a value... like 34, but sTest is never getting filled. I tried it without the round and oPerfmon.nextvalue gets data back, but still nothing in the sTest. I made sTest a single cause when I mouse over the nextvalue, it shows up as a single. I tryied making it an int and using cType, but still no joy. can someone point me in the right direction please thanks shannon Quote JvCoach23 VB.Net newbie MS Sql Vet
jvcoach23 Posted September 18, 2004 Author Posted September 18, 2004 I did some more playing with this. if i grab the counter info twice, on the second attempt it gets the info. So it's like it isn't starting the first time.. that help anyone to help me :) Quote JvCoach23 VB.Net newbie MS Sql Vet
Administrators PlausiblyDamp Posted September 18, 2004 Administrators Posted September 18, 2004 Which counter are you accessing? There is every possibility that if multiple values are being logged then the 1st may be 0. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
jvcoach23 Posted September 20, 2004 Author Posted September 20, 2004 Which counter are you accessing? There is every possibility that if multiple values are being logged then the 1st may be 0. thanks for the response. I decided to put in some counters that I am pretty sure are not zero. I started a disk defrag and set a counter for PhysicalDisk, % Disk Time on _Total instance. I fired up perfmon to watch both processor and %disk time. I have my counter doing a loop to grab both of these values. On perfmon running on the remote machine processor has had a low over 5, so it doesn't show any 0's. % Disk Time is up in the 75-100 range.. still only seeing zero's. Quote JvCoach23 VB.Net newbie MS Sql Vet
jvcoach23 Posted September 20, 2004 Author Posted September 20, 2004 I did some more checking.. I added Buffer Cache Hit Ratio counter to the mix.. it shows up.. 100 here on my test system.. still can't get the other two to display as anything but 0... hope that helps your thinking process out a bit more Quote JvCoach23 VB.Net newbie MS Sql Vet
jvcoach23 Posted September 23, 2004 Author Posted September 23, 2004 Progress Well, i'm making a little progress on this one. I've found that if I put the oPerfmon.NextValue right into the web service portion and don't try to get it to equal anything, it seems to populate ok. Then in sql I do the rounding and such. Still not sure why I couldn't get dim intValue as single intValue = oPerfMon.NextValue to work anyway.. thougth I would update all thanks shannon Quote JvCoach23 VB.Net newbie MS Sql Vet
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.