moench receiver works well now since we increased the memory allocation

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@513 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2013-04-15 13:07:53 +00:00
parent c9cef8c12f
commit cec069f0e9
4 changed files with 19 additions and 11 deletions

View File

@ -9,7 +9,9 @@
//all max frames defined in sls_detector_defs.h. 20000 gotthard, 100000 for short gotthard, 1000 for moench
#define GOTTHARD_FIFO_SIZE 25000
#define FIFO_SIZE 25000
#define GOTTHARD_ALIGNED_FRAME_SIZE 4096
#define GOTTHARD_PACKETS_PER_FRAME 2
#define GOTTHARD_BUFFER_SIZE 1286*GOTTHARD_PACKETS_PER_FRAME
@ -22,8 +24,8 @@
#define MOENCH_ALIGNED_FRAME_SIZE 65536
#define MOENCH_FIFO_SIZE 25000
#define MOENCH_PACKETS_PER_FRAME 40
#define MOENCH_BUFFER_SIZE 1286*MOENCH_PACKETS_PER_FRAME

View File

@ -24,6 +24,8 @@
#include <iomanip> //set precision
#include <sched.h>
#include <string.h>
#include <iostream>
using namespace std;
@ -82,18 +84,21 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det):
strcpy(eth,"");
latestData = new char[bufferSize];
fifofree = new CircularFifo<char,GOTTHARD_FIFO_SIZE>();/**MOENCH SAME FIFO SIZE FOR NOW,ELSE MEMBER DECLARATION ERROR*/
fifo = new CircularFifo<char,GOTTHARD_FIFO_SIZE>();
fifofree = new CircularFifo<char,FIFO_SIZE>();
fifo = new CircularFifo<char,FIFO_SIZE>();
int aligned_frame_size = GOTTHARD_ALIGNED_FRAME_SIZE;
if (det == MOENCH)
aligned_frame_size = MOENCH_ALIGNED_FRAME_SIZE;
mem0=(char*)malloc(4096*GOTTHARD_FIFO_SIZE);
mem0=(char*)malloc(aligned_frame_size*FIFO_SIZE);
if (mem0==NULL) {
cout<<"++++++++++++++++++++++ COULD NOT ALLOCATE MEMORY!!!!!!!+++++++++++++++++++++" << endl;
}
buffer=mem0;
while (buffer<(mem0+4096*(GOTTHARD_FIFO_SIZE-1))) {
while (buffer<(mem0+aligned_frame_size*(FIFO_SIZE-1))) {
fifofree->push(buffer);
buffer+=4096;
buffer+=aligned_frame_size;
}
@ -241,11 +246,11 @@ int slsReceiverFunctionList::startReceiver(){
cout << "ERROR: Could not prioritize threads. You need to be super user for that." << endl;
if (pthread_setschedparam(writing_thread, policy, &write_param) == EPERM)
cout << "ERROR: Could not prioritize threads. You need to be super user for that." << endl;
if (pthread_setschedparam(pthread_self(), policy, &tcp_param) == EPERM)
if (pthread_setschedparam(pthread_self(), 5, &tcp_param) == EPERM)
cout << "ERROR: Could not prioritize threads. You need to be super user for that." << endl;
pthread_getschedparam(listening_thread,&policy,&tcp_param);
pthread_getschedparam(pthread_self(),&policy,&tcp_param);
cout << "current priority of main tcp thread is " << tcp_param.sched_priority << endl;
}

View File

@ -283,10 +283,10 @@ private:
/** circular fifo to read and write data*/
//CircularFifo<dataStruct,FIFO_SIZE>* fifo;
CircularFifo<char,GOTTHARD_FIFO_SIZE>* fifo;
CircularFifo<char,FIFO_SIZE>* fifo;
/** circular fifo to read and write data*/
CircularFifo<char,GOTTHARD_FIFO_SIZE>* fifofree;
CircularFifo<char,FIFO_SIZE>* fifofree;
/** short frames */
int shortFrame;

View File

@ -969,6 +969,7 @@ int slsReceiverFuncs::moench_read_frame(){
//return ok/fail
///ADDED BY ANNA?!?!?!? //?????????FOR GOTTHARD AS WELL?????
delete [] origVal;
delete [] retval;