void muzzley::HTTPTokenizerLexer::init(muzzley::HTTPType _in_type) { this->d_chunked_body = false; this->d_chunked.clear(); this->__root_type = _in_type; switch (_in_type) { case muzzley::HTTPRequest : { muzzley::HTTPMethod _m; string _ms(this->matched()); muzzley::fromstr(_ms, &_m); this->__root_req->method(_m); break; } case muzzley::HTTPReply : { break; } } }
int test1()//test for accuracy. { ap_initial(&test); struct timeval st,ed,hl; gettimeofday(&st,NULL); test.add_timer(TIMEOUT, callback1, NULL, NULL); while(1){ //busy do sth if(k >= TESTNUM){ break; } } gettimeofday(&ed,NULL); _lasthowlong(&st, &ed, &hl); printf("howlong %ld ms, calltimes %d \n",_ms(&hl), k); test.delete_all(); return 0; }
int test2() { struct timeval st,ed,hl; ap_initial(&test); randomadd(NULL);//add some random timer gettimeofday(&st,NULL); test.add_timer(TIMEOUT, callback1, NULL, NULL); while(1){ //busy do sth if(k >= TESTNUM){ break; } } gettimeofday(&ed,NULL); _lasthowlong(&st, &ed, &hl); printf("howlong %ld ms, calltimes %d \n",_ms(&hl), k); return 0; }