From 1adac4e6afeeda3459b57fbab46bbf1c822cabd7 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 28 Feb 2019 12:27:28 +0100 Subject: T1273: add rudimentary script profiling support. --- src/cstore/cstore.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/cstore') diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp index 02e04ba..4750ba0 100644 --- a/src/cstore/cstore.cpp +++ b/src/cstore/cstore.cpp @@ -2049,9 +2049,21 @@ Cstore::executeTmplActions(char *at_str, const Cpath& path, var_ref_handle = (void *) this; // const_cast for legacy code + + std::time_t start_time = std::time(0); + bool ret = execute_list(const_cast(actions), def, sdisp.c_str()); var_ref_handle = NULL; + + char* debug_on = getenv("VYOS_DEBUG"); + if (debug_on != NULL) + { + std::time_t stop_time = std::time(0); + unsigned long int exec_time = stop_time - start_time; + output_internal("Action for \"%s\" took %u seconds to execute\n", sdisp.c_str(), exec_time); + } + return ret; } -- cgit v1.2.3