From 8b2a807130c3d14357f8105f778d18beeb67f3bd Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Thu, 5 Oct 2023 00:12:49 +0100 Subject: [PATCH] fixup! [feature] A new and improved 'exist:time' XQuery pragma. Backported from FusionDB --- .../org/exist/xquery/pragmas/TimePragma.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/exist-core/src/main/java/org/exist/xquery/pragmas/TimePragma.java b/exist-core/src/main/java/org/exist/xquery/pragmas/TimePragma.java index 385593d1d96..3303275ccd7 100644 --- a/exist-core/src/main/java/org/exist/xquery/pragmas/TimePragma.java +++ b/exist-core/src/main/java/org/exist/xquery/pragmas/TimePragma.java @@ -93,6 +93,7 @@ public void after(final XQueryContext context, final Expression expression) thro if (options.measurementMode == MeasurementMode.SINGLE) { logSingleMeasurement(expression); + this.timing.reset(); } } @@ -101,7 +102,7 @@ public void resetState(final boolean postOptimization) { if (timing != null && options.measurementMode == MeasurementMode.MULTIPLE) { logMultipleMeasurement(); } - this.timing = null; + this.timing.reset(); } /** @@ -512,5 +513,22 @@ public long getLastElapsed() { public long getTotalElapsed() { return totalElapsed; } + + /** + * Reset the class for next use. + */ + public void reset() { + this.startTimestamp = UNSET; + + this.lastStartTimestamp = UNSET; + + this.firstElapsed = UNSET; + this.minElapsed = UNSET; + this.maxElapsed = UNSET; + this.lastElapsed = UNSET; + this.totalElapsed = 0; + + this.iterations = 0; + } } }