private void CalculateActualSpeed(object sender, ElapsedEventArgs args) { ThreadPool.QueueUserWorkItem(callback => { long beginValue = Interface.GetIPv4Statistics().BytesReceived; DateTime beginTime = DateTime.Now; Thread.Sleep(500); long endValue = Interface.GetIPv4Statistics().BytesReceived; DateTime endTime = DateTime.Now; long recievedBytes = endValue - beginValue; double totalSeconds = (endTime - beginTime).TotalSeconds; lock (lockObj) { ActualSpeedInBytes = Math.Round((double)(recievedBytes / totalSeconds), 1); ActualSpeed = NetworkTools.BytesConvert((double)(recievedBytes / totalSeconds)) + "/s"; } }); }