#define HA_PROF_TASKS 0x00000001 /* enable per-task CPU profiling */
extern unsigned int profiling;
+extern unsigned long task_profiling_mask;
extern struct activity activity[MAX_THREADS];
run_time = (before_poll.tv_sec - after_poll.tv_sec) * 1000000U + (before_poll.tv_usec - after_poll.tv_usec);
swrate_add(&activity[tid].avg_loop_us, TIME_STATS_SAMPLES, run_time);
+
+ if (!(task_profiling_mask & tid_bit)) {
+ if (unlikely(profiling & HA_PROF_TASKS))
+ _HA_ATOMIC_OR(&task_profiling_mask, tid_bit);
+ } else {
+ if (unlikely(!(profiling & HA_PROF_TASKS)))
+ _HA_ATOMIC_AND(&task_profiling_mask, ~tid_bit);
+ }
}
/* bit field of profiling options. Beware, may be modified at runtime! */
unsigned int profiling = 0;
+unsigned long task_profiling_mask = 0;
/* One struct per thread containing all collected measurements */
struct activity activity[MAX_THREADS] __attribute__((aligned(64))) = { };
t->rq.key += offset;
}
- if (profiling & HA_PROF_TASKS)
+ if (task_profiling_mask & tid_bit)
t->call_date = now_mono_time();
eb32sc_insert(root, &t->rq, t->thread_mask);