diff --git a/include/haproxy/task-t.h b/include/haproxy/task-t.h index db3a5f827..001432315 100644 --- a/include/haproxy/task-t.h +++ b/include/haproxy/task-t.h @@ -112,7 +112,7 @@ struct task { int expire; /* next expiration date for this task, in ticks */ short nice; /* task prio from -1024 to +1024 */ short tid; /* TID where it's allowed to run, <0 if anywhere */ - uint64_t call_date; /* date of the last task wakeup or call */ + uint64_t wake_date; /* date of the last task wakeup */ uint64_t lat_time; /* total latency time experienced */ uint64_t cpu_time; /* total CPU time consumed */ }; @@ -126,7 +126,7 @@ struct tasklet { * list starts and this works because both are exclusive. Never ever * reorder these fields without taking this into account! */ - uint32_t call_date; /* date of the last tasklet wakeup or call */ + uint32_t wake_date; /* date of the last tasklet wakeup */ int tid; /* TID of the tasklet owner, <0 if local */ }; diff --git a/include/haproxy/task.h b/include/haproxy/task.h index 34646130d..33be63f0c 100644 --- a/include/haproxy/task.h +++ b/include/haproxy/task.h @@ -361,7 +361,7 @@ static inline void _tasklet_wakeup_on(struct tasklet *tl, int thr, const char *f tl->debug.caller_line[tl->debug.caller_idx] = line; #endif if (_HA_ATOMIC_LOAD(&th_ctx->flags) & TH_FL_TASK_PROFILING) - tl->call_date = now_mono_time(); + tl->wake_date = now_mono_time(); __tasklet_wakeup_on(tl, thr); } @@ -414,7 +414,7 @@ static inline void _task_instant_wakeup(struct task *t, unsigned int f, const ch t->debug.caller_line[t->debug.caller_idx] = line; #endif if (_HA_ATOMIC_LOAD(&th_ctx->flags) & TH_FL_TASK_PROFILING) - t->call_date = now_mono_time(); + t->wake_date = now_mono_time(); __tasklet_wakeup_on((struct tasklet *)t, thr); } @@ -448,7 +448,7 @@ static inline struct list *_tasklet_wakeup_after(struct list *head, struct taskl tl->debug.caller_line[tl->debug.caller_idx] = line; #endif if (th_ctx->flags & TH_FL_TASK_PROFILING) - tl->call_date = now_mono_time(); + tl->wake_date = now_mono_time(); return __tasklet_wakeup_after(head, tl); } @@ -497,7 +497,7 @@ static inline struct task *task_init(struct task *t, int tid) t->tid = tid; t->nice = 0; t->calls = 0; - t->call_date = 0; + t->wake_date = 0; t->cpu_time = 0; t->lat_time = 0; t->expire = TICK_ETERNITY; @@ -517,7 +517,7 @@ static inline void tasklet_init(struct tasklet *t) t->state = TASK_F_TASKLET; t->process = NULL; t->tid = -1; - t->call_date = 0; + t->wake_date = 0; #ifdef DEBUG_TASK t->debug.caller_idx = 0; #endif diff --git a/src/activity.c b/src/activity.c index 41beb4d81..627593d59 100644 --- a/src/activity.c +++ b/src/activity.c @@ -855,8 +855,8 @@ static int cli_io_handler_show_tasks(struct appctx *appctx) while (rqnode) { t = eb32_entry(rqnode, struct task, rq); entry = sched_activity_entry(tmp_activity, t->process); - if (t->call_date) { - lat = now_ns - t->call_date; + if (t->wake_date) { + lat = now_ns - t->wake_date; if ((int64_t)lat > 0) entry->lat_time += lat; } @@ -872,8 +872,8 @@ static int cli_io_handler_show_tasks(struct appctx *appctx) while (rqnode) { t = eb32_entry(rqnode, struct task, rq); entry = sched_activity_entry(tmp_activity, t->process); - if (t->call_date) { - lat = now_ns - t->call_date; + if (t->wake_date) { + lat = now_ns - t->wake_date; if ((int64_t)lat > 0) entry->lat_time += lat; } @@ -885,8 +885,8 @@ static int cli_io_handler_show_tasks(struct appctx *appctx) list_for_each_entry(tl, mt_list_to_list(&ha_thread_ctx[thr].shared_tasklet_list), list) { t = (const struct task *)tl; entry = sched_activity_entry(tmp_activity, t->process); - if (!TASK_IS_TASKLET(t) && t->call_date) { - lat = now_ns - t->call_date; + if (!TASK_IS_TASKLET(t) && t->wake_date) { + lat = now_ns - t->wake_date; if ((int64_t)lat > 0) entry->lat_time += lat; } @@ -898,8 +898,8 @@ static int cli_io_handler_show_tasks(struct appctx *appctx) list_for_each_entry(tl, &ha_thread_ctx[thr].tasklets[queue], list) { t = (const struct task *)tl; entry = sched_activity_entry(tmp_activity, t->process); - if (!TASK_IS_TASKLET(t) && t->call_date) { - lat = now_ns - t->call_date; + if (!TASK_IS_TASKLET(t) && t->wake_date) { + lat = now_ns - t->wake_date; if ((int64_t)lat > 0) entry->lat_time += lat; } diff --git a/src/debug.c b/src/debug.c index 090b82c40..8e2ca42f5 100644 --- a/src/debug.c +++ b/src/debug.c @@ -256,8 +256,8 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx) "%p (task) calls=%u last=%llu%s\n", task, task->calls, - task->call_date ? (unsigned long long)(now_mono_time() - task->call_date) : 0, - task->call_date ? " ns ago" : ""); + task->wake_date ? (unsigned long long)(now_mono_time() - task->wake_date) : 0, + task->wake_date ? " ns ago" : ""); chunk_appendf(buf, "%s fct=%p(", pfx, task->process); resolve_sym_name(buf, NULL, task->process); diff --git a/src/task.c b/src/task.c index 395bc9ac4..44aac7262 100644 --- a/src/task.c +++ b/src/task.c @@ -233,7 +233,7 @@ void __task_wakeup(struct task *t) } if (_HA_ATOMIC_LOAD(&th_ctx->flags) & TH_FL_TASK_PROFILING) - t->call_date = now_mono_time(); + t->wake_date = now_mono_time(); eb32_insert(root, &t->rq); @@ -573,9 +573,9 @@ unsigned int run_tasks_from_lists(unsigned int budgets[]) profile_entry = sched_activity_entry(sched_activity, t->process); before = now_mono_time(); - if (((struct tasklet *)t)->call_date) { - HA_ATOMIC_ADD(&profile_entry->lat_time, (uint32_t)(before - ((struct tasklet *)t)->call_date)); - ((struct tasklet *)t)->call_date = 0; + if (((struct tasklet *)t)->wake_date) { + HA_ATOMIC_ADD(&profile_entry->lat_time, (uint32_t)(before - ((struct tasklet *)t)->wake_date)); + ((struct tasklet *)t)->wake_date = 0; } } @@ -627,12 +627,12 @@ unsigned int run_tasks_from_lists(unsigned int budgets[]) /* OK then this is a regular task */ _HA_ATOMIC_DEC(&ha_thread_ctx[tid].tasks_in_list); - if (unlikely(t->call_date)) { + if (unlikely(t->wake_date)) { uint64_t now_ns = now_mono_time(); - uint64_t lat = now_ns - t->call_date; + uint64_t lat = now_ns - t->wake_date; t->lat_time += lat; - t->call_date = now_ns; + t->wake_date = now_ns; profile_entry = sched_activity_entry(sched_activity, t->process); HA_ATOMIC_ADD(&profile_entry->lat_time, lat); HA_ATOMIC_INC(&profile_entry->calls); @@ -665,11 +665,11 @@ unsigned int run_tasks_from_lists(unsigned int budgets[]) * immediately, else we defer it into wait queue */ if (t != NULL) { - if (unlikely(t->call_date)) { - uint64_t cpu = now_mono_time() - t->call_date; + if (unlikely(t->wake_date)) { + uint64_t cpu = now_mono_time() - t->wake_date; t->cpu_time += cpu; - t->call_date = 0; + t->wake_date = 0; HA_ATOMIC_ADD(&profile_entry->cpu_time, cpu); }