From c43af964878604cb421f5b51ba05b0f6117d110e Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 13 Nov 2015 17:47:44 +0100 Subject: [PATCH] some changes refactoring and reducing time spent --- .../bin/eigerDetectorServer | Bin 254830 -> 254830 bytes .../slsDetectorFunctionList.c | 2 +- .../slsDetector/slsDetectorUtils.cpp | 15 +++- .../slsDetectorAnalysis/postProcessing.cpp | 77 ++++++++++-------- 4 files changed, 53 insertions(+), 41 deletions(-) diff --git a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer index 8f00a69d53bc085ed952c8af30e163f077a8ca6d..42c94e73b75481328511a2f5b302c36c00d0d1e2 100755 GIT binary patch delta 28 jcmaENjQ`y+{teI1Gx9XQIN$!_JR=Y@ZGUl|xlI@V@I(*2 delta 30 lcmaENjQ`y+{teI1Pu_f9r1|&x_TT3jftYFg@AJ&X!T>295)uFa diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index dbf105891..16aec2987 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -355,7 +355,7 @@ void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){ ret[1] = retval[mV]; setDAC(VCMP_RL,val,imod,mV,retval); ret[2] = retval[mV]; - setDAC(VCMP_RL,val,imod,mV,retval); + setDAC(VCMP_RR,val,imod,mV,retval); ret[3] = retval[mV]; if((ret[0]== ret[1])&& diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp index bd34ab5ba..8e4356795 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp @@ -330,14 +330,17 @@ void slsDetectorUtils::acquire(int delflag){ break; - + //offline if(setReceiverOnline()==OFFLINE_FLAG){ - pthread_mutex_lock(&mg); // wait until data processing thread has finished the data + pthread_mutex_lock(&mg); acquiringDone = 1; + pthread_mutex_unlock(&mg); if (*threadedProcessing) { sem_wait(&sem_queue); + pthread_mutex_lock(&mg); acquiringDone = 0; + pthread_mutex_unlock(&mg); } #ifdef VERBOSE @@ -354,8 +357,12 @@ void slsDetectorUtils::acquire(int delflag){ if((*correctionMask)&(1< 0){ #ifdef VERY_VERY_DEBUG - if(acquiringDone == 1) - cout << "acquiring seems to be done" << endl; + if(acquiringDone == 1) cout << "acquiring seems to be done" << endl; #endif - //so that it checks for last frame for some number of checks, then checks join thread - pthread_mutex_lock(&mg); - acquiringDone++; + + + //IF GUI, check for last frames (counter upto 5) + if(dataReady){ + pthread_mutex_lock(&mg); + acquiringDone++; + pthread_mutex_unlock(&mg); #ifdef VERY_VERY_DEBUG cout << "acquiringDone :" << acquiringDone << endl; -#endif - pthread_mutex_unlock(&mg); - //go through once more to get last nth frame data - if (acquiringDone >= 5){cout<<"acquiringdone:"<= 5)){ + if(!dataReady || (!nthframe) ||(!newData)){ +#ifdef VERY_VERY_DEBUG + cout << "gonna post for it to end" << endl; +#endif + sem_post(&sem_queue); +#ifdef VERY_VERY_DEBUG + cout << "Sem posted" << endl; +#endif + } } } //random reads and for nthframe, checks if there is no new data else if((!nthframe) ||(!newData)){ //cout <<"cecking now" << endl; - if (checkJoinThread()) + if (checkJoinThread()){ break; + } } @@ -568,23 +574,22 @@ void* postProcessing::processData(int delflag) { if(!newData){ if(caught > progress){ newData = true; - /* - // keeping acquiringdone at 1 to get more time to get data - if(acquiringDone > 0){cout<<"going to maintain acquiidne"<0 (= det acq over), reset to get more frames + if(dataReady && (acquiringDone > 0)){ pthread_mutex_lock(&mg); acquiringDone = 1; - //#ifdef VERY_VERY_DEBUG +#ifdef VERY_VERY_DEBUG cout << "Keeping acquiringDone at 1 " << endl; - //#endif +#endif pthread_mutex_unlock(&mg); - }*/ + } } -#ifdef VERY_VERY_DEBUG - cout << "currentAcquisitionIndex:" << currentAcquisitionIndex << " progress:" << progress << endl; -#endif } + + if(newData){ #ifdef VERY_VERY_DEBUG cout << "new data" << endl;