mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Avoiding too many consecutive "ring buffer overflow" messages
This commit is contained in:
parent
2dc3a3d399
commit
9c1f56ec71
2
HISTORY
2
HISTORY
@ -2728,3 +2728,5 @@ Video Disk Recorder Revision History
|
|||||||
- Fixed handling "itemized" texts in EPG data (thanks to Stéphane Esté-Gracias
|
- Fixed handling "itemized" texts in EPG data (thanks to Stéphane Esté-Gracias
|
||||||
for pointing out this problem, and Marcel Wiesweg for improving 'libsi').
|
for pointing out this problem, and Marcel Wiesweg for improving 'libsi').
|
||||||
- Fixed handling VPS times at year boundaries.
|
- Fixed handling VPS times at year boundaries.
|
||||||
|
- Avoiding too many consecutive "ring buffer overflow" messages (which only
|
||||||
|
slowed down performance even more).
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: recorder.c 1.8 2003/10/18 11:35:02 kls Exp $
|
* $Id: recorder.c 1.9 2004/03/07 14:39:25 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -102,7 +102,7 @@ void cRecorder::Receive(uchar *Data, int Length)
|
|||||||
{
|
{
|
||||||
int p = ringBuffer->Put(Data, Length);
|
int p = ringBuffer->Put(Data, Length);
|
||||||
if (p != Length && active)
|
if (p != Length && active)
|
||||||
esyslog("ERROR: ring buffer overflow (%d bytes dropped)", Length - p);
|
ringBuffer->ReportOverflow(Length - p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cRecorder::Action(void)
|
void cRecorder::Action(void)
|
||||||
|
17
ringbuffer.c
17
ringbuffer.c
@ -7,7 +7,7 @@
|
|||||||
* Parts of this file were inspired by the 'ringbuffy.c' from the
|
* Parts of this file were inspired by the 'ringbuffy.c' from the
|
||||||
* LinuxDVB driver (see linuxtv.org).
|
* LinuxDVB driver (see linuxtv.org).
|
||||||
*
|
*
|
||||||
* $Id: ringbuffer.c 1.18 2003/10/18 10:29:25 kls Exp $
|
* $Id: ringbuffer.c 1.19 2004/03/07 13:46:51 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
// --- cRingBuffer -----------------------------------------------------------
|
// --- cRingBuffer -----------------------------------------------------------
|
||||||
|
|
||||||
|
#define OVERFLOWREPORTDELTA 5 // seconds between reports
|
||||||
|
|
||||||
cRingBuffer::cRingBuffer(int Size, bool Statistics)
|
cRingBuffer::cRingBuffer(int Size, bool Statistics)
|
||||||
{
|
{
|
||||||
size = Size;
|
size = Size;
|
||||||
@ -24,6 +26,8 @@ cRingBuffer::cRingBuffer(int Size, bool Statistics)
|
|||||||
maxFill = 0;
|
maxFill = 0;
|
||||||
lastPercent = 0;
|
lastPercent = 0;
|
||||||
putTimeout = getTimeout = 0;
|
putTimeout = getTimeout = 0;
|
||||||
|
lastOverflowReport = 0;
|
||||||
|
overflowCount = overflowBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cRingBuffer::~cRingBuffer()
|
cRingBuffer::~cRingBuffer()
|
||||||
@ -68,6 +72,17 @@ void cRingBuffer::SetTimeouts(int PutTimeout, int GetTimeout)
|
|||||||
getTimeout = GetTimeout;
|
getTimeout = GetTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cRingBuffer::ReportOverflow(int Bytes)
|
||||||
|
{
|
||||||
|
overflowCount++;
|
||||||
|
overflowBytes += Bytes;
|
||||||
|
if (time(NULL) - lastOverflowReport > OVERFLOWREPORTDELTA) {
|
||||||
|
esyslog("ERROR: %d ring buffer overflow%s (%d bytes dropped)", overflowCount, overflowCount > 1 ? "s" : "", overflowBytes);
|
||||||
|
overflowCount = overflowBytes = 0;
|
||||||
|
lastOverflowReport = time(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- cRingBufferLinear -----------------------------------------------------
|
// --- cRingBufferLinear -----------------------------------------------------
|
||||||
|
|
||||||
cRingBufferLinear::cRingBufferLinear(int Size, int Margin, bool Statistics)
|
cRingBufferLinear::cRingBufferLinear(int Size, int Margin, bool Statistics)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: ringbuffer.h 1.13 2003/10/18 10:29:25 kls Exp $
|
* $Id: ringbuffer.h 1.14 2004/03/07 13:40:45 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RINGBUFFER_H
|
#ifndef __RINGBUFFER_H
|
||||||
@ -21,6 +21,9 @@ private:
|
|||||||
int putTimeout;
|
int putTimeout;
|
||||||
int getTimeout;
|
int getTimeout;
|
||||||
int size;
|
int size;
|
||||||
|
time_t lastOverflowReport;
|
||||||
|
int overflowCount;
|
||||||
|
int overflowBytes;
|
||||||
protected:
|
protected:
|
||||||
int maxFill;//XXX
|
int maxFill;//XXX
|
||||||
int lastPercent;
|
int lastPercent;
|
||||||
@ -39,6 +42,7 @@ public:
|
|||||||
cRingBuffer(int Size, bool Statistics = false);
|
cRingBuffer(int Size, bool Statistics = false);
|
||||||
virtual ~cRingBuffer();
|
virtual ~cRingBuffer();
|
||||||
void SetTimeouts(int PutTimeout, int GetTimeout);
|
void SetTimeouts(int PutTimeout, int GetTimeout);
|
||||||
|
void ReportOverflow(int Bytes);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cRingBufferLinear : public cRingBuffer {
|
class cRingBufferLinear : public cRingBuffer {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: transfer.c 1.15 2003/10/18 11:36:03 kls Exp $
|
* $Id: transfer.c 1.16 2004/03/07 14:40:15 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "transfer.h"
|
#include "transfer.h"
|
||||||
@ -55,7 +55,7 @@ void cTransfer::Receive(uchar *Data, int Length)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
while (active && Length > 0) {
|
while (active && Length > 0) {
|
||||||
if (i++ > 10) {
|
if (i++ > 10) {
|
||||||
esyslog("ERROR: ring buffer overflow (%d bytes dropped)", Length);
|
ringBuffer->ReportOverflow(Length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int p = ringBuffer->Put(Data, Length);
|
int p = ringBuffer->Put(Data, Length);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user