cached->flags = flags;
rspamd_mempool_set_variable (task->task_pool, varname,
cached, rspamd_protocol_cached_dtor);
+
+ /* We also set scan time here */
+ task->time_real_finish = rspamd_get_ticks ();
+ task->time_virtual_finish = rspamd_get_virtual_ticks ();
}
if (flags & RSPAMD_PROTOCOL_METRICS) {
if (flags & RSPAMD_PROTOCOL_BASIC) {
ucl_object_insert_key (top, ucl_object_fromstring (task->message_id),
"message-id", 0, false);
+ ucl_object_insert_key (top,
+ ucl_object_fromdouble (task->time_real_finish - task->time_real),
+ "time-real", 0, false);
+ ucl_object_insert_key (top,
+ ucl_object_fromdouble (task->time_virtual_finish - task->time_virtual),
+ "time-virtual", 0, false);
}
if (flags & RSPAMD_PROTOCOL_DKIM) {
}
}
- row->scan_time = rspamd_get_ticks () - task->time_real;
+ row->scan_time = task->time_real_finish - task->time_real;
row->len = task->msg.len;
g_atomic_int_set (&row->completed, TRUE);
}
var.begin = numbuf;
break;
case RSPAMD_LOG_TIME_REAL:
- var.begin = rspamd_log_check_time (task->time_real, rspamd_get_ticks (),
+ var.begin = rspamd_log_check_time (task->time_real,
+ task->time_real_finish,
task->cfg->clock_res);
var.len = strlen (var.begin);
break;
case RSPAMD_LOG_TIME_VIRTUAL:
var.begin = rspamd_log_check_time (task->time_virtual,
- rspamd_get_virtual_ticks (),
+ task->time_virtual_finish,
task->cfg->clock_res);
var.len = strlen (var.begin);
break;
rspamd_mempool_t *task_pool; /**< memory pool for task */
double time_real;
double time_virtual;
+ double time_real_finish;
+ double time_virtual_finish;
struct timeval tv;
gboolean (*fin_callback)(struct rspamd_task *task, void *arg);
/**< calback for filters finalizing */