VM: better logic in factor_vm::set_sampling_profiler
It avoids the double-negation.locals-and-roots
parent
05de15bdc1
commit
08c2e3a32d
|
@ -57,13 +57,10 @@ void factor_vm::record_callstack_sample(cell* begin, cell* end, bool prolog_p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void factor_vm::set_sampling_profiler(fixnum rate) {
|
void factor_vm::set_sampling_profiler(fixnum rate) {
|
||||||
bool sampling_p = !!rate;
|
bool running_p = (bool)atomic::load(&sampling_profiler_p);
|
||||||
if (sampling_p == !!atomic::load(&sampling_profiler_p))
|
if (rate > 0 && !running_p)
|
||||||
return;
|
|
||||||
|
|
||||||
if (sampling_p)
|
|
||||||
start_sampling_profiler(rate);
|
start_sampling_profiler(rate);
|
||||||
else
|
else if (rate == 0 && running_p)
|
||||||
end_sampling_profiler();
|
end_sampling_profiler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue