From f4716cb28fe9432c5d630212b460aae5b6cd6642 Mon Sep 17 00:00:00 2001 From: dfsek Date: Mon, 12 Apr 2021 00:07:22 -0700 Subject: [PATCH] add autocloseable option --- common/src/main/java/com/dfsek/terra/profiler/Profiler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/src/main/java/com/dfsek/terra/profiler/Profiler.java b/common/src/main/java/com/dfsek/terra/profiler/Profiler.java index 9d984fcf6..b2b2a578e 100644 --- a/common/src/main/java/com/dfsek/terra/profiler/Profiler.java +++ b/common/src/main/java/com/dfsek/terra/profiler/Profiler.java @@ -12,4 +12,9 @@ public interface Profiler { void stop(); Map getTimings(); + + default AutoCloseable profile(String frame) { + push(frame); + return () -> pop(frame); + } }