Skip to content

Commit

Permalink
Introduce max ring buffer size macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
GCBallesteros committed Jun 19, 2018
1 parent 6a8bc5a commit a1c102e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion readPTU/readTTTRRecords-for-import.c
Expand Up @@ -27,6 +27,7 @@

// How big the file chunking will be
#define RECORD_CHUNK 1024*8 // 1024*8 gives the best results on Guillem laptop
#define MAX_RING_BUF 4096

int c_fseek(FILE *filehandle, long int offset)
{
Expand All @@ -45,7 +46,7 @@ static inline void load_buffer(uint32_t *pbuffer, FILE *fhandle)

static inline void check_and_grow_buf(ring_buf_t *cbuf, uint64_t timetag,
uint64_t correlation_window) {
if ( (timetag-ring_buf_oldest(cbuf)) < correlation_window && cbuf->count == cbuf->size && cbuf->size < 256) {
if ( (timetag-ring_buf_oldest(cbuf)) < correlation_window && cbuf->count == cbuf->size && cbuf->size < MAX_RING_BUF) {
ring_buf_grow(cbuf);
}
}
Expand Down

0 comments on commit a1c102e

Please sign in to comment.