MINOR: activity: flush scheduler stats on "set profiling tasks on"
If a user enables profiling by hand, it makes sense to reset the stats counters to provide fresh new measurements. Therefore it's worth using this as the standard method to reset counters.
This commit is contained in:
parent
1bd67e9b03
commit
cfa7101d59
|
@ -1788,7 +1788,9 @@ set maxconn global <maxconn>
|
|||
set profiling { tasks } { auto | on | off }
|
||||
Enables or disables CPU profiling for the indicated subsystem. This is
|
||||
equivalent to setting or clearing the "profiling" settings in the "global"
|
||||
section of the configuration file. Please also see "show profiling".
|
||||
section of the configuration file. Please also see "show profiling". Note
|
||||
that manually setting the tasks profiling to "on" automatically resets the
|
||||
scheduler statistics, thus allows to check activity over a given interval.
|
||||
|
||||
set rate-limit connections global <value>
|
||||
Change the process-wide connection rate limit, which is set by the global
|
||||
|
|
|
@ -72,8 +72,17 @@ static int cli_parse_set_profiling(char **args, char *payload, struct appctx *ap
|
|||
|
||||
if (strcmp(args[3], "on") == 0) {
|
||||
unsigned int old = profiling;
|
||||
int i;
|
||||
|
||||
while (!_HA_ATOMIC_CAS(&profiling, &old, (old & ~HA_PROF_TASKS_MASK) | HA_PROF_TASKS_ON))
|
||||
;
|
||||
/* also flush current profiling stats */
|
||||
for (i = 0; i < 256; i++) {
|
||||
HA_ATOMIC_STORE(&sched_activity[i].calls, 0);
|
||||
HA_ATOMIC_STORE(&sched_activity[i].cpu_time, 0);
|
||||
HA_ATOMIC_STORE(&sched_activity[i].lat_time, 0);
|
||||
HA_ATOMIC_STORE(&sched_activity[i].func, NULL);
|
||||
}
|
||||
}
|
||||
else if (strcmp(args[3], "auto") == 0) {
|
||||
unsigned int old = profiling;
|
||||
|
|
Loading…
Reference in New Issue