/** * Submits a new timing for the given key. * <p> * Adds the average to the "live set" which will be output on the next call to {@link #getTimings()} * <p> * A convenient way to call this method is to use {@link sirius.kernel.commons.Watch#submitMicroTiming(String, String)} * * @param category the category of the recorded timing. This permits grouping a microtimings of the same * kind. * @param key the key for which the value should be submitted * @param durationInNanos the number of nanoseconds used as timing for the given key */ public static void submit(String category, String key, long durationInNanos) { if (!enabled) { return; } // Safety check in case someone leaves the framework enabled for a very long period of time... if (timings.size() > 1000) { timings.clear(); } timings.computeIfAbsent(category + key, k -> new Timing(category, key)).addNanos(durationInNanos); }