_user_system_profiler_start(): Check the sampling related parameters only when

sampling is requested at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30294 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-04-21 15:26:16 +00:00
parent e0518baa0c
commit bc2e00c1c7
1 changed files with 10 additions and 5 deletions

View File

@ -833,14 +833,19 @@ _user_system_profiler_start(struct system_profiler_parameters* userParameters)
if (error != B_OK)
return error;
if (areaInfo.team != team || parameters.stack_depth < 1)
if (areaInfo.team != team)
return B_BAD_VALUE;
if (parameters.interval < B_DEBUG_MIN_PROFILE_INTERVAL)
parameters.interval = B_DEBUG_MIN_PROFILE_INTERVAL;
if ((parameters.flags & B_SYSTEM_PROFILER_SAMPLING_EVENTS) != 0) {
if (parameters.stack_depth < 1)
return B_BAD_VALUE;
if (parameters.stack_depth > B_DEBUG_STACK_TRACE_DEPTH)
parameters.stack_depth = B_DEBUG_STACK_TRACE_DEPTH;
if (parameters.interval < B_DEBUG_MIN_PROFILE_INTERVAL)
parameters.interval = B_DEBUG_MIN_PROFILE_INTERVAL;
if (parameters.stack_depth > B_DEBUG_STACK_TRACE_DEPTH)
parameters.stack_depth = B_DEBUG_STACK_TRACE_DEPTH;
}
// quick check to see whether we do already have a profiler installed
InterruptsSpinLocker locker(sProfilerLock);