14#include "framework/pcore/SeqFile.h"
15#include "framework/pcore/RingBuffer.h"
17#define RBUFSIZE 100000000
18#define MAXEVTSIZE 400000000
24int main(
int argc,
char** argv)
27 printf(
"file2rb : rbufname filename nevt\n");
32 if (file->status() <= 0) {
37 int nevt = atoi(argv[3]);
44 char* dumbuf =
new char[MAXEVTSIZE];
45 int is = file->read(dumbuf, MAXEVTSIZE);
46 if (is <= 0) exit(-1);
49 vector<char*> evbuf(MAXEVT);
51 for (
int i = 0; i < nevt; i++) {
52 evbuf[i] =
new char[MAXEVTSIZE];
54 int isN = file->read(evbuf[i], MAXEVTSIZE);
59 printf(
"eventsize = %d\n", isN);
60 if (isN > MAXEVTSIZE) {
61 printf(
"Event size too large : %d\n", isN);
64 if (isN > 190000)
break;
70 int bufno = std::rand() % nevt;
74 int irb = rbuf->
insq((
int*)evbuf[bufno], (is - 1) / 4 + 1);
80 if (totevt % 1000 == 0)
81 printf(
"mfile2rb : event = %d (bufno = %d)\n", totevt, bufno);
Class to manage a Ring Buffer placed in an IPC shared memory.
void dump_db()
Print some info on the RingBufInfo structure.
int insq(const int *buf, int size, bool checkTx=false)
Append a buffer to the RingBuffer.
A class to manage I/O for a chain of blocked files.
Abstract base class for different kinds of events.