PoweredByOTGC
Member
- Joined
- Oct 29, 2006
- Messages
- 9
- Programming Experience
- 5-10
What I am trying to do is calculate cpu utilization from some unix servers. What I currently have is a perl service that pools the proc file system for the each cpu counter – constructs a hash and then send the values over to a web service to be stored in a sql database.
The hash looks like this
Anyone have any ideas
I have tried
but I don’t think this is correct
The hash looks like this
Each of these values are measured in milliseconds in which I need to calculate the cpu utilization in %VirtualInstanceName CpuUptime CpuEUsedTime PoolTime
VCPU-0 5688754.556 2855479.579 01/01/2006 00:00:00
VCPU-0 5688756.357 2855489.654 01/01/2006 00:00:45
VCPU-0 5688765.261 2855502.325 01/01/2006 00:01:30
VCPU-0 5688804.387 2855643.875 01/01/2006 00:02:15
VCPU-0 5688906.618 2855902.184 01/01/2006 00:03:00
Anyone have any ideas
I have tried
VB.NET:
For I as integer = 0 in m_cpucollection.length - 1
if CheckIfOddIndex(i) = true then
dim m_cpu as cpuclass = ctype(m_cpucollection(i), cpuclass)
dim m_cpu_delta as cpuclass = ctype(m_cpucollection(i -1), cpuclass)
dim rawtime as timespan = m_cpu_delta. PoolTime.subtract(m_cpu.PoolTime)
dim rawdelta as decimal = m_cpu_delta.CpuUptime - m_cpu.CpuUptime
dim rawspan as decimal = m_cpu_delta.CpuEUsedTime - m_cpu.CpuEusedtime
dim results as decimal = rawdelta – rawspan / rawtime * 100
end if
next
Last edited by a moderator: