diff options
author | Daniil Baturin <daniil@baturin.org> | 2019-02-28 12:27:28 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2019-02-28 12:27:28 +0100 |
commit | 53659fb9e337cd1db05ff2993f7f2dcba6cb0de0 (patch) | |
tree | 86e481d81d7e0dfd8dc5747ecc0f1591b1b39411 /src | |
parent | 1b456e199f0f3ac2ea347b464a5420f60c438e10 (diff) | |
download | vyatta-cfg-53659fb9e337cd1db05ff2993f7f2dcba6cb0de0.tar.gz vyatta-cfg-53659fb9e337cd1db05ff2993f7f2dcba6cb0de0.zip |
T1273: add rudimentary script profiling support.
Diffstat (limited to 'src')
-rw-r--r-- | src/cstore/cstore.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp index 2a9dd26..1b1a4df 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<vtw_node *>(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; } |