[ https://issues.apache.org/jira/browse/MNG-5729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet reassigned MNG-5729: ------------------------------------ Assignee: Guillaume Nodet > 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 > Assignee: Guillaume Nodet > Priority: Major > Fix For: 4.1.0 > > > 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 (v8.20.10#820010)