@@ -55,7 +55,21 @@ int __wrap_epoll_wait(int epfd, struct epoll_event *events,
5555}
5656
5757int __wrap_recv (int sockfd, void *buf, size_t len, int flags) {
58- const char request[] = " GET / HTTP/1.1\r\n Host: localhost\r\n\r\n " ;
58+ const char request[] =
59+ " GET /joyent/http-parser HTTP/1.1\r\n "
60+ " Host: github.com\r\n "
61+ " DNT: 1\r\n "
62+ " Accept-Encoding: gzip, deflate, sdch\r\n "
63+ " Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4\r\n "
64+ " User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) "
65+ " AppleWebKit/537.36 (KHTML, like Gecko) "
66+ " Chrome/39.0.2171.65 Safari/537.36\r\n "
67+ " Accept: text/html,application/xhtml+xml,application/xml;q=0.9,"
68+ " image/webp,*/*;q=0.8\r\n "
69+ " Referer: https://github.com/joyent/http-parser\r\n "
70+ " Connection: keep-alive\r\n "
71+ " Cache-Control: max-age=0\r\n\r\n " ;
72+
5973 memcpy (buf, request, sizeof (request) - 1 );
6074 return sizeof (request) - 1 ;
6175}
@@ -67,7 +81,7 @@ int __wrap_send(int sockfd, const void *buf, size_t len, int flags) {
6781 // print how long it took to make 1 million requests
6882 clock_t newTime = clock ();
6983 float elapsed = float (newTime - lastTime) / CLOCKS_PER_SEC;
70- printf (" Req/sec: %f\n " , 1000000 .0f / elapsed);
84+ printf (" Req/sec: %f million \n " , ( 1000000 .0f / elapsed) / 1000000 . 0f );
7185 sent = 0 ;
7286 lastTime = newTime;
7387 }
0 commit comments