From a494e14c7c6dfcc93deec8d881ecc4b144e42023 Mon Sep 17 00:00:00 2001 From: Marco Livesu Date: Wed, 8 Nov 2023 16:23:32 +0100 Subject: [PATCH] pop_push facility for profiler --- include/cinolib/profiler.cpp | 11 +++++++++++ include/cinolib/profiler.h | 1 + 2 files changed, 12 insertions(+) diff --git a/include/cinolib/profiler.cpp b/include/cinolib/profiler.cpp index a738b9e2..8dbc023a 100644 --- a/include/cinolib/profiler.cpp +++ b/include/cinolib/profiler.cpp @@ -76,6 +76,17 @@ double Profiler::pop(const bool print_time, const std::string extra_string) return t; } + +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +CINO_INLINE +double Profiler::pop_push(const std::string & new_key, const bool print_time, const std::string extra_string) +{ + double t = pop(print_time,extra_string); + push(new_key); + return t; +} + //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: CINO_INLINE diff --git a/include/cinolib/profiler.h b/include/cinolib/profiler.h index bb6c384c..c8462e0d 100644 --- a/include/cinolib/profiler.h +++ b/include/cinolib/profiler.h @@ -64,6 +64,7 @@ class Profiler void push(const std::string & key); double pop (const bool print_time = true, const std::string extra_string = ""); + double pop_push(const std::string & new_key, const bool print_time = true, const std::string extra_string = ""); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::