开发者

performance counter in c# - calculate average of sample

开发者 https://www.devze.com 2023-02-11 19:45 出处:网络
hi i am grabbing frames from ip camera and want to export via perf counters the time diff between frames. and present it as # timediff / sec.

hi i am grabbing frames from ip camera and want to export via perf counters the time diff between frames. and present it as # timediff / sec.

i have created 2 counters one as

PerformanceCounterType.AverageCount64

and the seconds as

Performance开发者_如何学PythonCounterType.AverageBase

i am adding them ine after the other (the base come second)

for every frame i am calculating the diff and increase both counters e.g

pc.increaseby(40) 
pcbase.increaseby(1)

on second process i want to display the counter so when i am calculating

Single numerator = (Single)s1.RawValue - (Single)s0.RawValue;
Single denomenator = (Single)s1.BaseValue - (Single)s0.BaseValue;
Single counterValue = numerator / denomenator; 

the basevalue is always 0 -> any ideas?

0

精彩评论

暂无评论...
验证码 换一张
取 消