From c220b5e69269323e1d6024784827a6d51576aa99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= Date: Thu, 11 Oct 2007 19:44:46 +0000 Subject: [PATCH] Calculate maximum used buffer size and show it in statistics. --- statistics.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/statistics.c b/statistics.c index e97bca2..3544c0b 100644 --- a/statistics.c +++ b/statistics.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: statistics.c,v 1.18 2007/10/10 20:08:25 rahrenbe Exp $ + * $Id: statistics.c,v 1.19 2007/10/11 19:44:46 ajhseppa Exp $ */ #include @@ -197,6 +197,8 @@ cString cIptvBufferStatistics::GetStatistic() IptvConfig.GetUseBytes() ? "B" : "bit", usedKilos, usedKilos + freeKilos, IptvConfig.GetUseBytes() ? "B" : "bit", percentage); dataBytes = 0; + freeSpace = 0; + usedSpace = 0; return info; } @@ -205,6 +207,8 @@ void cIptvBufferStatistics::AddStatistic(long Bytes, long Used, long Free) //debug("cIptvBufferStatistics::AddStatistic(Bytes=%ld, Used=%ld, Free=%ld)\n", Bytes, Used, Free); cMutexLock MutexLock(&mutex); dataBytes += Bytes; - freeSpace = Free; - usedSpace = Used; + if (Used > usedSpace) { + freeSpace = Free; + usedSpace = Used; + } }