Changeset 3674 in Sophya for trunk/AddOn/TAcq/racqurw.cc
- Timestamp:
- Nov 15, 2009, 1:27:00 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/racqurw.cc
r3673 r3674 21 21 #include "datatable.h" // Pour sauver les entetes de paquet 22 22 #include <sys/time.h> // pour gettimeofday 23 24 // Si on veut que MultiDataSaver cree des fichiers avec le numero des FrameCounters... 25 // define DEBUGPAQHDR 26 23 27 //------------------------------------------------------- 24 28 // Classe thread de lecture PCI-Express … … 494 498 495 499 cout << " PCIEMultiReader::run() - Starting , NMaxMemZones=" << nmax_ 496 << " memgr.NbPaquets()=" << memgr.NbPaquets() << "Paqsize " << packSize_<< endl; 500 << " memgr.NbPaquets()=" << memgr.NbPaquets() << "Paqsize " << packSize_ 501 << " " << BRPaquet::FmtConvToString(swapall_) << endl; 497 502 setRC(1); 498 503 … … 507 512 Byte* Datas[MAXNBFIB]; 508 513 Byte* tampon[MAXNBFIB] ; 514 Byte* predtampon=NULL; // tampon de recopie pour la reduction des tailles de paquets 509 515 Byte* nextpaq=NULL; 510 516 uint_4 off_acheval=0; … … 518 524 tampon[i]= new Byte[paqsz]; 519 525 } 520 526 bool fgredpaq=par_.fgreducpsize; 527 if (fgredpaq) { 528 cout << " PCIEMultiReader::run() - PaquetSizeReduction - RedSize=" << par_.redpqsize 529 << " Offset=" << par_.reducoffset << " " << ((par_.reducneedcopy)?"NeedCopy":"NOCopy") 530 << " " << BRPaquet::ReducActionToString(par_.pqreducmode) << endl; 531 predtampon = new Byte[paqsz]; 532 } 533 534 #ifdef DEBUGPAQHDR 521 535 ofstream header[MAXNBFIB]; 522 536 for(uint_4 fib=0; fib<nbDma_; fib++) { … … 525 539 header[fib].open(hfnm); 526 540 } 527 541 #endif 528 542 uint_4 npaqfait[MAXNBFIB] ; 529 543 for (int i=0;i< (int)nbDma_ ;i++) npaqfait[i]=0; … … 571 585 } 572 586 // CHECK S'il faut faire une reduction de taille de paquet 573 if (par_.fgreducpsize) { // reduction taille de paquet 574 587 if (fgredpaq) { // reduction taille de paquet 588 if (par_.reducneedcopy) { 589 BRPaquet paqc1(tampon[fib], predtampon, paqsz, swapall_); 590 BRPaquet paqc2(nextpaq, par_.redpqsize); 591 paqc2.CopyFrom(paqc1, par_.pqreducmode, par_.reducoffset); 592 } 593 else { 594 BRPaquet paqc1(tampon[fib], paqsz); 595 BRPaquet paqc2(nextpaq, par_.redpqsize); 596 paqc2.CopyFrom(paqc1, par_.pqreducmode, par_.reducoffset); 597 } 575 598 } 576 599 else { … … 581 604 if (fib==nbDma_-1) npaqfaitg++; // Ne pas oublier le compteur de paquets faits 582 605 pcheck[fib].Check(paq); // Verification du paquet / FrameCounter 583 header[fib] << dec << paq.FrameCounter()<< endl; ; 606 #ifdef DEBUGPAQHDR 607 header[fib] << dec << paq.FrameCounter()<< endl; 608 #endif 584 609 } 585 610 } … … 607 632 } 608 633 // CHECK S'il faut faire une reduction de taille de paquet 609 if (par_.fgreducpsize) { // reduction taille de paquet 610 634 if (fgredpaq) { // reduction taille de paquet 635 if (par_.reducneedcopy) { 636 BRPaquet paqc1(Datas[fib]+curoff, predtampon, paqsz, swapall_); 637 BRPaquet paqc2(nextpaq, par_.redpqsize); 638 paqc2.CopyFrom(paqc1, par_.pqreducmode, par_.reducoffset); 639 } 640 else { 641 BRPaquet paqc1(Datas[fib]+curoff, paqsz); 642 BRPaquet paqc2(nextpaq, par_.redpqsize); 643 paqc2.CopyFrom(paqc1, par_.pqreducmode, par_.reducoffset); 644 } 611 645 } 612 646 else { … … 617 651 if (fib==nbDma_-1) npaqfaitg++; // Ne pas oublier le compteur de paquets faits 618 652 pcheck[fib].Check(paq); // Verification du paquet / FrameCounter 619 header[fib] << dec << paq.FrameCounter()<< endl; ; 653 #ifdef DEBUGPAQHDR 654 header[fib] << dec << paq.FrameCounter()<< endl; 655 #endif 620 656 } 621 657 curoff += paqsz; // On avance l'index dans le buffer du DMA … … 647 683 // //// Nettoyage final 648 684 MZoneManage(true); 685 for (int i=0;i< (int)nbDma_ ;i++) delete[] tampon[i]; 686 if ((fgredpaq)&&predtampon) delete[] predtampon; 687 #ifdef DEBUGPAQHDR 649 688 for(uint_4 fib=0; fib<nbDma_; fib++) header[fib].close(); 650 for (int i=0;i< (int)nbDma_ ;i++) delete[] tampon[i]; 689 #endif 690 651 691 //DBG cout << " fin thread ========================" <<endl; 652 692 return; … … 743 783 uint_4 paqsz = memgr.PaqSize(); 744 784 cout << " ============================ MultiDataSaver::run() PaqSize " << paqsz <<endl; 785 bool fgfirstfctt=false; 745 786 bool fgnulldev = bpar.GetFileDevNull(); 746 787 if (fgnulldev) { … … 772 813 // Sans TRAILER de paquet mff.setDTypeNaxis(MF_Byte, paq0.DataSize()+paq0.HeaderSize(), npaqperfile); 773 814 } 774 // Ajout mots-cle additionnels a tous les fichiers FITS 775 AddFitsKW(mff,bpar); 776 fnum++; 815 fnum++; fgfirstfctt=true; 777 816 } 778 817 else sprintf(fname,"MemDataBloc[%d]-NoDataFile",(int)fnum++); … … 797 836 for(uint_4 i=0; i<memgr.NbPaquets(); i++) { // boucle sur les paquets 798 837 BRPaquet paq(NULL, buff+i*paqsz, paqsz); 799 pcheck[fib].Check(paq); // Verification du paquet / FrameCounter 838 bool cpaqok=pcheck[fib].Check(paq); // Verification du paquet / FrameCounter 839 if (cpaqok && fgfirstfctt) { 840 framecnt_first_[fib] = pcheck[fib].LastFrameNum(); 841 timetag_first_[fib] = paq.TimeTag(); 842 fgfirstfctt=false; 843 } 800 844 if (savesig_) 801 845 header[fib] << hex << paq.HDRMarker() << " " << paq.TRLMarker() << " " … … 821 865 cout << " Fib " << fib << " -> " << fname << " Stat:" << pcsum << endl; 822 866 } 823 if (savesig_) 867 if (savesig_) { 868 // Ajout mots-cle additionnels a tous les fichiers FITS 869 for(uint_4 fib=0; fib<memgr.NbFibres(); fib++) 870 framecnt_last_[fib] = pcheck[fib].LastFrameNum(); 871 872 AddFitsKW(mff,bpar); 824 873 for(uint_4 fib=0; fib<memgr.NbFibres(); fib++) { 825 874 header[fib].close(); 826 875 mff[fib].Close(); 827 876 } 828 877 } 829 878 830 879 } // Fin de boucle sur les fichiers … … 861 910 TimeStamp ts; 862 911 string cdtu=ts.ToString(); 912 string& skysrc=acpar.SkySource(); 913 bool hassrc=false; 914 if (skysrc.length()>0) hassrc=true; 863 915 for(uint_4 fib=0; fib<memgr.NbFibres(); fib++) { 864 916 mff[fib].AddKeyS("DATE", cdtu.c_str(), " File Creation time(YYYY-MM-DDThh:mm:ss UT) "); … … 866 918 mff[fib].AddKeyD("ACQVER", acpar.AcqVersion(), " BAORadio Acq Software version ") ; 867 919 mff[fib].AddKeyS("ACQCONF", acpar.GetParams().AcqMode, " BAORadio Acq run mode" ); 920 if (hassrc) 921 mff[fib].AddKeyS("SKYSOURC", skysrc, " Source identification" ); 922 mff[fib].AddKeyI("FCFIRST", framecnt_first_[fib], " First valid frame counter in file") ; 923 mff[fib].AddKeyI("FCLAST", framecnt_last_[fib], " Last valid frame counter in file") ; 924 mff[fib].AddKeyI("TTFIRST", timetag_first_[fib], " First valid timetag in file") ; 868 925 } 869 926 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.