I have created web site with a middleware measuring the execution time of 
requests using the time.Since(start) method. It is thus using the wall 
time. 

I see that the execution of the ServeHttp() is around 60μs. The handler is 
a function that simply renders the login page that I benchmarked to use at 
most 1μs. 

The time difference seams huge. The server is idle and receiving only one 
request at the time. I know that measuring execution time with a wall clock 
on a time sharing system is not a great, but I have 8 cores and they are 
mostly idle. I apparently don’t have a better method.

I also saw a big jitter which was reduced by adding the instructions 

runtime.LockOsThread()
defer runtime.UnlockOsThread()
runtime.GOMAXPROCS(1)

But I still see the big execution duration. 

Unfortunately, I can’t benchmark the ServeHttp() method has the object is 
complex (db, etc.).

Is there a more precise way to measure the execution time Such big values 
don’t seam very accurate. 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/2126edd1-df8d-4383-a372-78e978d1cec9n%40googlegroups.com.

Reply via email to