void test_load_list_of_cap_files(CParserOption * op){ CFlowGenList fl; CNullIF erf_vif; fl.Create(); #define NUM 1 fl.load_from_yaml(op->cfg_file,NUM); fl.DumpPktSize(); fl.generate_p_thread_info(NUM); CFlowGenListPerThread * lpt; /* set the ERF file */ //fl.set_vif_all(&erf_vif); int i; for (i=0; i<NUM; i++) { lpt=fl.m_threads_info[i]; char buf[100]; sprintf(buf,"my%d.erf",i); lpt->generate_erf(buf,op->preview); lpt->m_node_gen.DumpHist(stdout); } //sprintf(buf,"my%d.erf",7); //lpt=fl.m_threads_info[7]; //fl.Dump(stdout); fl.Delete(); }
int load_list_of_cap_files(CParserOption * op){ CFlowGenList fl; fl.Create(); fl.load_from_yaml(op->cfg_file,1); if ( op->preview.getVMode() >0 ) { fl.DumpCsv(stdout); } uint32_t start= os_get_time_msec(); CErfIF erf_vif; //CNullIF erf_vif; fl.generate_p_thread_info(1); CFlowGenListPerThread * lpt; lpt=fl.m_threads_info[0]; lpt->set_vif(&erf_vif); if ( (op->preview.getVMode() >1) || op->preview.getFileWrite() ) { lpt->generate_erf(op->out_file,op->preview); } lpt->m_node_gen.DumpHist(stdout); uint32_t stop= os_get_time_msec(); printf(" d time = %ul %ul \n",stop-start,os_get_time_freq()); fl.Delete(); return (0); }
void test_load_list_of_cap_files_linux(CParserOption * op){ CFlowGenList fl; //CNullIF erf_vif; //CErfIF erf_vif; fl.Create(); fl.load_from_yaml(op->cfg_file,cores); fl.DumpPktSize(); fl.generate_p_thread_info(cores); CFlowGenListPerThread * lpt; /* set the ERF file */ //fl.set_vif_all(&erf_vif); int i; for (i=0; i<cores; i++) { lpt=fl.m_threads_info[i]; test_t_info1 * obj = new test_t_info1(); obj->preview_info =&op->preview; obj->thread_info = fl.m_threads_info[i]; obj->thread_id = i; CNullIF * erf_vif = new CNullIF(); //CErfIF * erf_vif = new CErfIF(); lpt->set_vif(erf_vif); assert(pthread_create( &tr_info[i].tid, NULL, thread_task, obj)==0); } for (i=0; i<cores; i++) { /* wait for all of them to stop */ assert(pthread_join((pthread_t)tr_info[i].tid,NULL )==0); } printf("compare files \n"); for (i=1; i<cores; i++) { CErfCmp cmp; char buf[100]; sprintf(buf,"my%d.erf",i); char buf1[100]; sprintf(buf1,"my%d.erf",0); if ( cmp.compare(std::string(buf),std::string(buf1)) != true ) { printf(" ERROR cap file is not ex !! \n"); assert(0); } printf(" thread %d is ok \n",i); } fl.Delete(); }