Changeset 11286
- Timestamp:
- 07/07/11 19:55:23 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilderWrapper.h
r11247 r11286 2 2 #define FACT_EventBuilderWrapper 3 3 4 /* 4 #include <sstream> 5 5 6 #if BOOST_VERSION < 104400 6 7 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)) … … 9 10 #endif 10 11 #include <boost/thread.hpp> 11 12 using namespace std;13 */14 15 12 #include <boost/date_time/posix_time/posix_time_types.hpp> 16 13 … … 28 25 29 26 using ba::ip::tcp; 27 28 using namespace std; 30 29 31 30 class DataFileImp … … 494 493 "Version number"); 495 494 496 WriteKey(" PLLLCK", i, hh.PLLLCK,495 WriteKey("STATUS", i, hh.PLLLCK, 497 496 ""); 498 497 /* … … 508 507 WriteKey("EVTCNTR", i, hh.fad_evt_counter, 509 508 "FAD Event Counter"); 510 */ 509 511 510 WriteKey("REFCLK", i, hh.REFCLK_frequency, 512 511 "Reference Clock Frequency"); 513 512 */ 514 513 WriteKey("BOARDID", i, hh.board_id, 515 514 "Board ID"); … … 518 517 "ADC clock phase shift"); 519 518 520 //WriteKey("TRGGEN", i, hh.number_of_triggers_to_generate,521 //"Number of triggers to generate");519 WriteKey("TRGGEN", i, hh.number_of_triggers_to_generate, 520 "Number of triggers to generate"); 522 521 523 522 WriteKey("PRESC", i, hh.trigger_generator_prescaler, … … 690 689 enum CommandStates_t // g_runStat 691 690 { 692 kAbort = -2, // quit as soon as possible ('abort') 693 kExit = -1, // stop reading, quit when buffered events done ('exit') 694 kInitialize = 0, // 'initialize' (e.g. dim not yet started) 695 kHybernate = 1, // do nothing for long time ('hybernate') [wakeup within ~1sec] 696 kSleep = 2, // do nothing ('sleep') [wakeup within ~10msec] 697 kModeFlush = 10, // read data from camera, but skip them ('flush') 698 kModeTest = 20, // read data and process them, but do not write to disk ('test') 699 kModeFlag = 30, // read data, process and write all to disk ('flag') 700 kModeRun = 40, // read data, process and write selected to disk ('run') 691 kAbort = -40, // quit as soon as possible ('abort') 692 kExit = -30, // stop reading, quit when buffered events done ('exit') 693 kReset = -20, // Like EXIT but without closing files and sockets 694 kStop = -10, // Like ABORT but without closing files and sockets 695 kInitialize = 0, // 'initialize' (e.g. dim not yet started) 696 kHybernate = 1, // do nothing for long time ('hybernate') [wakeup within ~1sec] 697 kSleep = 2, // do nothing ('sleep') [wakeup within ~10msec] 698 kModeFlush = 10, // read data from camera, but skip them ('flush') 699 kModeTest = 20, // read data and process them, but do not write to disk ('test') 700 kModeFlag = 30, // read data, process and write all to disk ('flag') 701 kModeRun = 40, // read data, process and write selected to disk ('run') 701 702 }; 702 703 … … 734 735 DimDescribedService fDimTemperature; 735 736 DimDescribedService fDimRefClock; 736 DimDescribedService fDimStatistics; 737 DimDescribedService fDimStatistics1; 738 DimDescribedService fDimStatistics2; 737 739 738 740 bool fDebugStream; … … 782 784 fDimTemperature ("FAD_CONTROL/TEMPERATURE", "F:82", ""), 783 785 fDimRefClock ("FAD_CONTROL/REFERENCE_CLOCK", "I:42", ""), 784 fDimStatistics ("FAD_CONTROL/STATISTICS", "X:8", ""), 786 fDimStatistics1 ("FAD_CONTROL/STATISTICS1", "I:3;I:5;I:1;X:3", ""), 787 fDimStatistics2 ("FAD_CONTROL/STATISTICS2", "I:1;I:280;X:40;I:40;I:4;I:4;I:2;I:2;I:3;C:40", ""), 785 788 fDebugStream(false), fDebugRead(false) 786 789 { … … 819 822 void SetMaxMemory(unsigned int mb) const 820 823 { 824 /* 821 825 if (mb*1000000<GetUsedMemory()) 822 826 { 823 827 // ffMsg.Warn("..."); 824 828 return; 825 } 829 }*/ 826 830 827 831 g_maxMem = size_t(mb)*1000000; … … 888 892 fMsg.Message("Signal abort to EventBuilder thread..."); 889 893 g_runStat = kAbort; 894 } 895 896 void ResetThread() 897 { 898 fMsg.Message("Signal reset to EventBuilder thread..."); 899 g_runStat = kReset; 890 900 } 891 901 … … 952 962 } 953 963 954 size_t GetUsedMemory() const { return gi_usedMem; }964 // size_t GetUsedMemory() const { return gi_usedMem; } 955 965 956 966 virtual int CloseOpenFiles() { CloseRunFile(0, 0); return 0; } … … 1288 1298 fMsg.Update(str, severity); 1289 1299 } 1290 1300 /* 1291 1301 void factStat(int64_t *stat, int len) 1292 1302 { … … 1323 1333 fMsg.Info(str); 1324 1334 } 1335 */ 1336 1337 void factStat(const EVT_STAT &stat) 1338 { 1339 fDimStatistics2.Update(stat); 1340 /* 1341 //some info about what happened since start of program (or last 'reset') 1342 uint32_t reset ; //#if increased, reset all counters 1343 uint32_t numRead[MAX_SOCK] ; //how often succesfull read from N sockets per loop 1344 1345 uint64_t gotByte[NBOARDS] ; //#Bytes read per Board 1346 uint32_t gotErr[NBOARDS] ; //#Communication Errors per Board 1347 uint32_t evtGet; //#new Start of Events read 1348 uint32_t evtTot; //#complete Events read 1349 uint32_t evtErr; //#Events with Errors 1350 uint32_t evtSkp; //#Events incomplete (timeout) 1351 1352 uint32_t procTot; //#Events processed 1353 uint32_t procErr; //#Events showed problem in processing 1354 uint32_t procTrg; //#Events accepted by SW trigger 1355 uint32_t procSkp; //#Events rejected by SW trigger 1356 1357 uint32_t feedTot; //#Events used for feedBack system 1358 uint32_t feedErr; //#Events rejected by feedBack 1359 1360 uint32_t wrtTot; //#Events written to disk 1361 uint32_t wrtErr; //#Events with write-error 1362 1363 uint32_t runOpen; //#Runs opened 1364 uint32_t runClose; //#Runs closed 1365 uint32_t runErr; //#Runs with open/close errors 1366 1367 1368 //info about current connection status 1369 uint8_t numConn[NBOARDS] ; //#Sockets succesfully open per board 1370 */ 1371 } 1372 1373 void factStat(const GUI_STAT &stat) 1374 { 1375 fDimStatistics1.Update(stat); 1376 /* 1377 //info about status of the main threads 1378 int32_t readStat ; //read thread 1379 int32_t procStat ; //processing thread(s) 1380 int32_t writStat ; //write thread 1381 1382 //info about some rates 1383 int32_t deltaT ; //time in milli-seconds for rates 1384 int32_t readEvt ; //#events read 1385 int32_t procEvt ; //#events processed 1386 int32_t writEvt ; //#events written 1387 int32_t skipEvt ; //#events skipped 1388 1389 //some info about current state of event buffer (snapspot) 1390 int32_t evtBuf; //#Events currently waiting in Buffer 1391 uint64_t totMem; //#Bytes available in Buffer 1392 uint64_t usdMem; //#Bytes currently used 1393 uint64_t maxMem; //max #Bytes used during past Second 1394 */ 1395 } 1396 1325 1397 1326 1398 boost::array<FAD::EventHeader, 40> fVecHeader; … … 1443 1515 fNumConnected.resize(40); 1444 1516 1445 vector<uint> con(gi_NumConnect, gi_NumConnect+40);1446 1447 bool changed = con!=fNumConnected || !IsThreadRunning();1517 const vector<uint> con(gi_NumConnect, gi_NumConnect+40); 1518 1519 const bool changed = con!=fNumConnected || !IsThreadRunning(); 1448 1520 1449 1521 fNumConnected = con; … … 1585 1657 } 1586 1658 1587 void factStat(int64_t *array, int len) 1588 { 1589 EventBuilderWrapper::This->factStat(array, len); 1590 } 1591 1592 void debugHead(int socket, void *buf) 1659 void factStat(GUI_STAT stat) 1660 { 1661 EventBuilderWrapper::This->factStat(stat); 1662 } 1663 1664 void factStatNew(EVT_STAT stat) 1665 { 1666 EventBuilderWrapper::This->factStat(stat); 1667 } 1668 1669 void debugHead(int socket, int/*board*/, void *buf) 1593 1670 { 1594 1671 const uint16_t *ptr = reinterpret_cast<uint16_t*>(buf);
Note:
See TracChangeset
for help on using the changeset viewer.