-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

All,

Some interesting[1] reading:

https://steveloughran.blogspot.com/2015/09/time-on-multi-core-multi-sock
et-servers.html

- -chris

[1] For some definitions of "interesting"

On 2/27/20 17:26, Christopher Schultz wrote:
> Rémy,
>
> On 2/27/20 17:20, Christopher Schultz wrote:
>> Rémy,
>
>> On 2/27/20 10:49, r...@apache.org wrote:
>>> This is an automated email from the ASF dual-hosted git
>>> repository.
>
>>> remm pushed a commit to branch master in repository
>>> https://gitbox.apache.org/repos/asf/tomcat.git
>
>
>>> The following commit(s) were added to refs/heads/master by
>>> this push: new 22ad695  Update request start time using
>>> nanoTime 22ad695 is described below
>
>>> commit 22ad69571c019f4d84ccc522298dddb4f8fa8d70 Author: remm
>>> <r...@apache.org> AuthorDate: Thu Feb 27 16:49:04 2020 +0100
>
>>> Update request start time using nanoTime
>
>>> get/setStartTime are still there, not sure about existing use.
>>> Another patch round could deprecate them. Also change the
>>> access log to be the start of the request (a small part of
>>> 63286). ---
>
>>> [snip]
>
>>> diff --git a/java/org/apache/coyote/AbstractProcessor.java
>>> b/java/org/apache/coyote/AbstractProcessor.java index
>>> 254950e..5af3710 100644 ---
>>> a/java/org/apache/coyote/AbstractProcessor.java +++
>>> b/java/org/apache/coyote/AbstractProcessor.java @@ -978,6
>>> +978,7 @@ public abstract class AbstractProcessor extends
>>> AbstractProcessorLight implement
>>> setSocketWrapper(socketWrapper); // Setup the minimal request
>>> information request.setStartTime(System.currentTimeMillis());
>>> + request.setStartTimeNanos(System.nanoTime()); // Setup the
>>> minimal response information response.setStatus(400);
>>> response.setError();
>
>> Since we are talking about nanoseconds, here, we ARE, by
>> definition, splitting hairs :)
>
>> System.currentTimeMillis() and System.nanoTime() may disagree
>> when you capture them like this, because [a super-small amount
>> of] time elapses between the two calls.
>
>> Should we instead do:
>
>> long nanos = System.nanoTime();
>> request.setStartTimeNanos(nanos); request.setStartTime(nanos /
>> 1000000l);
>
>> Or maybe:
>
>> long nanos = System.nanoTime();
>> request.setStartTimeNanos(nanos);
>> request.setStartTime(TimeUnit.NANOSECONDS.toMillis(nanos));
>
>> ?
>
> Also, System.nanoTime apparently takes a lot longer than
> System.currentTimeMillis(), but it always moves forward in time,
> while System.currentTimeMillis can fall back for leap seconds, etc.
> and can behave in surprising ways :)
>
> -chris
>
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5YQz0ACgkQHPApP6U8
pFhE6A//aCZRXyBVu5VjqeM53Sa3luTca3+Q3o70cRbefrqSpgGHVGCaCEBTFX8L
fIk1yrXE8TB9sA0C2d/SEdPK/Db0crirNTR6yQr49w5XU7a841u/wrI+Vqb3/5je
+Jhg5yRyrSZD7LNyRmXk1xudjWehCGmixMQzZuRWTN1fJZsVKe1PUHvQ4omWkQ6u
8IiPfPyY3UNPw0bCofw291i/KSP23/Hdad+QGG/7HRdJR7XZqtIG7x9x9W27m12F
4kKjNfPvtDr/TAEjVvFw35L5G5hw4oAtk1pPbXabQItieU0iY78pIFJVE/PH4fQ9
Cjn62fPXtBXy/XI1WTYDTUkkLiu69vXzN9Za1kLXvH6rJuzo+0kkbEOudknwEbHz
tTy5mGcdURv+qBloaH4PaednVeFFbVuU/vsZghh1ytNW379FvXtT3upuM+eJNPM1
US2v8TKSp3sK9kirgOWdwzAMkqXsQ7vQDGAiSZ+EMvMzn4CtOTWfaYioDvowzEIT
thc3j/XmvhQtygQAgO7fG4cRVUEnKlJ9AhWmxzl6isNSA7zBMMsYBSivRKFeyOha
61jeUhbZzituUyGjzTxFJPPlsXY4+8XnuMSRGo68ZPlkAU8ZWtrrKO4iGZ51gY3L
AN4ppdLGy6DeJM20nK21Xpjx31QW5qhcNGolL0llihWZW31hYLQ=
=yi5w
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to