From 1cd44b513875e89919b96d57d46cb3b9e537917d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Frode=20H=C3=A5skjold?= Date: Mon, 6 Jan 2025 19:49:39 +0100 Subject: [PATCH] feat: add execution time in millis to reply data --- src/main/java/com/github/ibm/mapepire/ClientRequest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/github/ibm/mapepire/ClientRequest.java b/src/main/java/com/github/ibm/mapepire/ClientRequest.java index e05abb9..85fd6a9 100644 --- a/src/main/java/com/github/ibm/mapepire/ClientRequest.java +++ b/src/main/java/com/github/ibm/mapepire/ClientRequest.java @@ -5,6 +5,7 @@ import java.sql.SQLException; import java.util.LinkedHashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; import com.github.theprez.jcmdutils.StringUtils; import com.google.gson.Gson; @@ -82,8 +83,11 @@ protected void processAfterReplySent() { @Override public void run() { try { + long startTime = System.nanoTime(); go(); + long endTime = System.nanoTime(); addReplyData("success", true); + addReplyData("execution_time", TimeUnit.NANOSECONDS.toMillis(endTime - startTime)); } catch (final Exception _e) { Tracer.err(_e); addReplyData("error", "" + getErrorStringFromException(_e));