aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/task.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-07 14:34:13 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-07 14:34:13 +0000
commit091586c865c94b4f3d961d24f26e43f845a8c646 (patch)
tree7c8610c2445b25f28c8e151c53f75f7d1721e28f /src/libserver/task.h
parent0a5653bea4033efe0776d1c88c4503dd37721c15 (diff)
downloadrspamd-091586c865c94b4f3d961d24f26e43f845a8c646.tar.gz
rspamd-091586c865c94b4f3d961d24f26e43f845a8c646.zip
[Feature] Add profiling support in client output
It is now possible to specify `--profile` option to Rspamd to get execution time for all symbols that were executed for a specific message. This still doesn't count async returns time.
Diffstat (limited to 'src/libserver/task.h')
-rw-r--r--src/libserver/task.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libserver/task.h b/src/libserver/task.h
index be94f00c2..1779310bb 100644
--- a/src/libserver/task.h
+++ b/src/libserver/task.h
@@ -103,6 +103,7 @@ enum rspamd_task_stage {
#define RSPAMD_TASK_FLAG_EMPTY (1 << 22)
#define RSPAMD_TASK_FLAG_LOCAL_CLIENT (1 << 23)
#define RSPAMD_TASK_FLAG_COMPRESSED (1 << 24)
+#define RSPAMD_TASK_FLAG_PROFILE (1 << 25)
#define RSPAMD_TASK_IS_SKIPPED(task) (((task)->flags & RSPAMD_TASK_FLAG_SKIP))
#define RSPAMD_TASK_IS_JSON(task) (((task)->flags & RSPAMD_TASK_FLAG_JSON))
@@ -110,6 +111,7 @@ enum rspamd_task_stage {
#define RSPAMD_TASK_IS_PROCESSED(task) (((task)->processed_stages & RSPAMD_TASK_STAGE_DONE))
#define RSPAMD_TASK_IS_CLASSIFIED(task) (((task)->processed_stages & RSPAMD_TASK_STAGE_CLASSIFIERS))
#define RSPAMD_TASK_IS_EMPTY(task) (((task)->flags & RSPAMD_TASK_FLAG_EMPTY))
+#define RSPAMD_TASK_IS_PROFILING(task) (((task)->flags & RSPAMD_TASK_FLAG_PROFILE))
struct rspamd_email_address;
enum rspamd_newlines_type;
@@ -309,4 +311,21 @@ void rspamd_task_add_request_header (struct rspamd_task *task,
*/
void rspamd_task_write_log (struct rspamd_task *task);
+/**
+ * Set profiling value for a specific key
+ * @param task
+ * @param key
+ * @param value
+ */
+void rspamd_task_profile_set (struct rspamd_task *task, const gchar *key,
+ gdouble value);
+
+/**
+ * Get value for a specific profiling key
+ * @param task
+ * @param key
+ * @return
+ */
+gdouble* rspamd_task_profile_get (struct rspamd_task *task, const gchar *key);
+
#endif /* TASK_H_ */