#include #include #include #include #include "sopnamsp.h" #include "histinit.h" #include "ctimer.h" #include "datatable.h" #include "swppfdtable.h" /* Programme test performances des DataTables / cf G. Barrand */ /* R. Ansari (LAL) - Avril 2005 */ void cre_rempli_table(BaseDataTable& dt, sa_size_t nl) { Timer tm("cre_rempli_table"); cout << " tstdtable/Info: cre_rempli_table() avec nl = " << nl << endl; // Ajout de colonnes int + 6 x double dt.AddIntegerColumn("i"); dt.AddDoubleColumn("p1"); dt.AddDoubleColumn("p2"); dt.AddDoubleColumn("p3"); dt.AddDoubleColumn("p4"); dt.AddDoubleColumn("p5"); dt.AddDoubleColumn("p6"); // remplissage : MuTyV rec[10]; // r_8 rec[10]; Si on veut tout remplir avec des double sa_size_t nl10 = nl/10; for(sa_size_t k=0; k 3) msw = arg[3]; if (narg > 4) nlines = atol(arg[4]); if (narg > 5) segsize = atol(arg[5]); cout << "======== tstdtable: DataTable/G.Barrand test de performance I/O ========" << endl; cout << " Operation= " << oper << " FileName= " << fname << " (NLines= " << nlines << " Mem/Swap= " << msw << " )" << endl; //---------- Creation , ecriture table if (oper == 'w') { if (msw == "mem") { Timer tm("DTable:Mem/W"); cout << "1/ tstdtable/Info: Creation/Ecriture DataTable (memoire) " << endl; DataTable dt(segsize); cre_rempli_table(dt, nlines); tm.Split("Mem/W:Fin-Remplissage"); cout << "2/ tstdtable/Info: Ecriture DataTable ds " << fname << endl; POutPersist so(fname); so << dt; tm.Split("Mem/W:Fin-PPFWrite"); } else { Timer tm("DTable:Swap/W"); cout << "1/ tstdtable/Info: Creation/Ecriture DataTable (PPFSwap) " << endl; POutPersist so(fname); SwPPFDataTable dt(so, segsize); cre_rempli_table(dt, nlines); tm.Split("Swap/W:Fin-Remplissage"); cout << "2/ tstdtable/Info: Ecriture DataTable ds " << fname << endl; so << dt; tm.Split("Mem/W:Fin-Ecriture"); } } //---------- Lecture/verification table else { if (msw == "mem") { Timer tm("DTable:Mem/R"); cout << "1/ tstdtable/Info: Lecture DataTable (memoire) de " << fname << endl; DataTable dt; PInPersist si(fname); si >> dt; tm.Split("Mem/R:Fin-PPFRead"); cout << "2/ tstdtable/Info: Lecture/verification table " << endl; lit_ck_table(dt); tm.Split("Mem/R:Fin-CheckLecture"); } else { Timer tm("DTable:Swap/R"); cout << "1/ tstdtable/Info: Lecture DataTable (swap) de " << fname << endl; SwPPFDataTable dt; PInPersist si(fname); si >> dt; tm.Split("Swap/R:Fin-PPFRead"); cout << "2/ tstdtable/Info: Lecture/verification table " << endl; lit_ck_table(dt); tm.Split("Swap/R:Fin-CheckLecture"); } } } catch(PThrowable& exc ) { cerr << "tstdtable-main() , Catched exception: \n" << exc.Msg() << endl; } catch(std::exception& ex) { cerr << "tstdtable-main() , Catched exception ! " << (string)(ex.what()) << endl; } catch(...) { cerr << "tstdtable-main() , Catched ... ! " << endl; } cout << "============== tstdtable: DataTable =================" << endl; return 0; }