[Updated] (MNG-5729) Measure (build time) durations with System.nanoTime only

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Updated] (MNG-5729) Measure (build time) durations with System.nanoTime only

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/MNG-5729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Osipov updated MNG-5729:
--------------------------------
    Fix Version/s: Issues to be reviewed for 4.x

> Measure (build time) durations with System.nanoTime only
> --------------------------------------------------------
>
>                 Key: MNG-5729
>                 URL: https://issues.apache.org/jira/browse/MNG-5729
>             Project: Maven
>          Issue Type: Improvement
>          Components: Embedding, General, Logging, Performance, Reactor and workspace
>    Affects Versions: 3.2.3
>            Reporter: Michael Osipov
>            Priority: Major
>             Fix For: Issues to be reviewed for 4.x
>
>
> Currently, we solely rely on {{System.currentTimeMillis}} to track start/end times as well as durations. This is error prone and not guaranteed to deliver a monotic value with positive durations.
> We should consider employing {{System.nanoTime}} throughout the core where the above mentioned conditions are met. E.g., in some of:
> {noformat}
> maven-aether-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleTransferListener.java: long duration = System.currentTimeMillis() - resource.getTransferStartTime();
> maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java: this.transferStartTime = System.currentTimeMillis();
> maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java: long buildEndTime = System.currentTimeMillis();
> maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java: long buildStartTime = System.currentTimeMillis();
> maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java: long buildEndTime = System.currentTimeMillis();
> maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java: long finish = System.currentTimeMillis();
> maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java: long duration = System.currentTimeMillis() - resource.getTransferStartTime();
> maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java: long duration = System.currentTimeMillis() - resource.getTransferStartTime();
> DefaultMaven.java: request.setStartTime( new Date() );
> DefaultMavenExecutionRequest.java: public Date getStartTime()
> DefaultMavenExecutionRequest.java: projectBuildingRequest.setBuildStartTime( getStartTime() );
> MavenExecutionRequest.java: Date getStartTime();
> MavenSession.java: public Date getStartTime()
> MavenSession.java: return request.getStartTime();
> ExecutionEventLogger.java: long time = finish - session.getRequest().getStartTime().getTime();
> {noformat}
> and all other code spots where {{Date}} or {{long}} is used.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)