aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_common.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-09 14:27:33 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-09 15:27:32 +0100
commit084dc96bc564b814b7d8850958613cfae835dc77 (patch)
treea33bbbb6dac6c4277389478b154f2b4306eacb34 /src/lua/lua_common.h
parent0ebcb5c9fb90363a2afff95f3f1af827fcf9b287 (diff)
downloadrspamd-084dc96bc564b814b7d8850958613cfae835dc77.tar.gz
rspamd-084dc96bc564b814b7d8850958613cfae835dc77.zip
[Feature] Add support for Lua API tracing
Diffstat (limited to 'src/lua/lua_common.h')
-rw-r--r--src/lua/lua_common.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h
index 838e0fe7a..45baa5549 100644
--- a/src/lua/lua_common.h
+++ b/src/lua/lua_common.h
@@ -420,5 +420,21 @@ gboolean rspamd_lua_require_function (lua_State *L, const gchar *modname,
#define RSPAMD_PREFIX_INDEX "PREFIX"
#define RSPAMD_VERSION_INDEX "VERSION"
+#ifdef WITH_LUA_TRACE
+extern ucl_object_t *lua_traces;
+#define LUA_TRACE_POINT do { \
+ ucl_object_t *func_obj; \
+ if (lua_traces == NULL) { lua_traces = ucl_object_typed_new (UCL_OBJECT); } \
+ func_obj = (ucl_object_t *)ucl_object_lookup (lua_traces, G_STRFUNC); \
+ if (func_obj == NULL) { \
+ func_obj = ucl_object_typed_new (UCL_INT); \
+ ucl_object_insert_key (lua_traces, func_obj, G_STRFUNC, 0, false); \
+ } \
+ func_obj->value.iv ++; \
+} while(0)
+#else
+#define LUA_TRACE_POINT
+#endif
+
#endif /* WITH_LUA */
#endif /* RSPAMD_LUA_H */