I would think that using the http request time would meet the spec and be easier than your alternatives...
Dave ----- Original Message ----- From: "MATHIHALLI,MADHUSUDAN (HP-Cupertino,ex1)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 23, 2003 4:05 PM Subject: RE: gettimeofday calls > I don't know if this has been discussed already, but I was thinking of the > following alternatives : > 1. how about the listener thread in each of the child process keeps updating > a global time variable that each of the threads can refer to ?. > 2. set the time at the begining of the process, and then each of the thread > measures the amount of time it has been running.. (Current time = startup > time + delta time).. AFAIK, the time taken to compute delta time is much > lesser than gettimeofday.. > > Is this against the spec or something ?. > > -Madhu > > -----Original Message----- > From: Greg Ames [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 23, 2003 11:19 AM > To: [EMAIL PROTECTED] > Subject: Re: gettimeofday calls > > > MATHIHALLI,MADHUSUDAN (HP-Cupertino,ex1) wrote: > > > The following is the tusc output of httpd (2.0.43) + > mod_specweb99.c > > on HP-UX.. Almost every single request has a gettimeofday > system call - is > > there any way to avoid it ?. > > The GET /file_set/* requests are just plain ol' static files > served by the httpd > core, so I think the gettimeofday is due to: > > r->request_time = apr_time_now(); > > ...line 681 from server/protocol.c. I don't see that going > away in the near future. > > OTOH, the GET /?/file_set/* is a dynamic request served by > mod_specweb99. The > three time() syscalls there bother me. I'm guessing that this > request had a > cookie which drives do_cadget() and friends. Looking at code > in that path I do > see three different time calls. One of them will go away if > you select a > quieter LogLevel...you probably have "Found ad <blah> expire <yes/no> > <timestamp>" messages in your error log. > > Off the top of my head, we could probably change mod_specweb99 to use > r->request_time in place of the time() syscalls and make it a > little faster. > But then we will have to take into account the difference > between apr_time_t's > and seconds. :-( > > Greg > > > > > {72114} poll(0x6fd88910, 1, 120000) ...................... = 1 > > {72114} read(149, "G E T / ? / f i l e _ s e t / ".., 8000) = 159 > > {72114} gettimeofday(0x6fd88448, NULL) ................... = 0 > > {72114} time(NULL) ....................................... = > 1043344112 > > {72114} time(NULL) ....................................... = > 1043344112 > > {72114} time(NULL) ....................................... = > 1043344112 > > {72114} > stat("/opt/apache2/htdocs//file_set/dir00016/class1_8", 0x6fd885c8) > > = 0 > > {72114} > open("/opt/apache2/htdocs//file_set/dir00016/class1_8", O_RDONLY, > > 0666) > > = 43 > > {72114} read(43, " 9 2 1 6 f i l e _ s ".., 9216) = 9216 > > {72114} writev(149, 0x6fd88988, 4) ....................... = 9803 > > {72114} read(149, 0x40288078, 8000) ...................... > ERR#11 EAGAIN > > {72114} write(8, "1 9 2 . 1 6 8 . 3 . 2 [ 2 3 / ".., 95) = 95 > > {72114} close(43) ........................................ = 0 > > {72114} poll(0x6fd88910, 1, 120000) ...................... = 1 > > {72114} read(149, "G E T / f i l e _ s e t / d i ".., 8000) = 70 > > {72114} gettimeofday(0x6fd88448, NULL) ................... = 0 > > {72114} > stat("/opt/apache2/htdocs/file_set/dir00047/class1_0", 0x6fd88548) = > > 0 > > {72114} > open("/opt/apache2/htdocs/file_set/dir00047/class1_0", O_RDONLY, 0) > > = 55 > > {72114} read(149, 0x40288078, 8000) ...................... > ERR#11 EAGAIN > > {72114} sendfile(149, 55, 0, 1024, 0x6fd88688, 0) ........ = 1289 > > {72114} write(8, "1 9 2 . 1 6 8 . 3 . 2 [ 2 3 / ".., 93) = 93 > > {72114} poll(0x6fd88910, 1, 120000) ...................... = 1 > > {72114} read(149, "G E T / f i l e _ s e t / d i ".., 8000) = 70 > > {72114} gettimeofday(0x6fd88448, NULL) ................... = 0 > > {72114} > stat("/opt/apache2/htdocs/file_set/dir00009/class0_3", 0x6fd88548) = > > 0 > > {72114} > open("/opt/apache2/htdocs/file_set/dir00009/class0_3", O_RDONLY, 0) > > = 59 > > {72114} read(149, 0x4038c098, 8000) ...................... > ERR#11 EAGAIN > > {72114} sendfile(149, 59, 0, 409, 0x6fd88688, 0) ......... = 673 > > {72114} write(8, "1 9 2 . 1 6 8 . 3 . 2 [ 2 3 / ".., 92) = 92 > > {72114} poll(0x6fd88910, 1, 120000) ...................... = 1 > > {72114} read(149, "G E T / f i l e _ s e t / d i ".., 8000) = 70 > > {72114} gettimeofday(0x6fd88448, NULL) ................... = 0 > > {72114} > stat("/opt/apache2/htdocs/file_set/dir00000/class1_2", 0x6fd88548) = > > 0 > > {72114} > open("/opt/apache2/htdocs/file_set/dir00000/class1_2", O_RDONLY, 0) > > = 76 > > {72114} read(149, 0x40288078, 8000) ...................... > ERR#11 EAGAIN > > {72114} sendfile(149, 76, 0, 3072, 0x6fd88688, 0) ........ = 3336 > > {72114} write(8, "1 9 2 . 1 6 8 . 3 . 2 [ 2 3 / ".., 93) = 93 > > > > >