You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by np...@apache.org on 2018/11/22 14:36:14 UTC
[sling-org-apache-sling-pipes] branch master updated: SLING-8115
add execution time in s or ms
This is an automated email from the ASF dual-hosted git repository.
npeltier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-pipes.git
The following commit(s) were added to refs/heads/master by this push:
new c5274e4 SLING-8115 add execution time in s or ms
c5274e4 is described below
commit c5274e4d6321035d4e9074a57b71266247318b62
Author: Nicolas Peltier <pe...@gmail.com>
AuthorDate: Thu Nov 22 15:35:41 2018 +0100
SLING-8115 add execution time in s or ms
---
src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java b/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java
index e0f4b17..2249b77 100644
--- a/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java
+++ b/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java
@@ -243,6 +243,7 @@ public class PlumberImpl implements Plumber, JobConsumer, PlumberMXBean {
public ExecutionResult execute(ResourceResolver resolver, Pipe pipe, Map additionalBindings, OutputWriter writer, boolean save) throws Exception {
boolean success = false;
PipeMonitor monitor = null;
+ long start = System.currentTimeMillis();
try {
if (additionalBindings != null){
pipe.getBindings().addBindings(additionalBindings);
@@ -291,7 +292,9 @@ public class PlumberImpl implements Plumber, JobConsumer, PlumberMXBean {
} finally {
writeStatus(pipe, STATUS_FINISHED);
resolver.commit();
- log.info("[{}] done executing.", pipe.getName());
+ long length = System.currentTimeMillis() - start;
+ String time = length < 1000 ? length + "ms" : (length / 1000) + "s";
+ log.info("[{}] done executing in {}.", pipe.getName(), time);
log.debug("[{}] after execution hook is called", pipe);
pipe.after();
if (!success && monitor != null){