Solution for the potential deadlock when needing to flush the profiling

buffer during a timer event that interrupted a kernel function: We do
now flush the buffer as soon as it is 70% full, *if* we didn't interrupt
a kernel function. When the buffer runs full and we still haven't hit a
user function, we drop the tick. The number of dropped ticks is recorded
and sent to the debugger with the next update message.
Reverted the previous partial solution (the temporary disabling of
profiling while in debugger support code).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27658 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-09-20 22:04:03 +00:00
parent 1ecc0a33db
commit ecfad924e0
3 changed files with 40 additions and 73 deletions
+9 -5
View File
@@ -15,9 +15,10 @@
// limits
#define B_DEBUG_MAX_PROFILE_FUNCTIONS 100000
#define B_DEBUG_MIN_PROFILE_INTERVAL 100 /* in us */
#define B_DEBUG_STACK_TRACE_DEPTH 5
#define B_DEBUG_MAX_PROFILE_FUNCTIONS 100000
#define B_DEBUG_MIN_PROFILE_INTERVAL 100 /* in us */
#define B_DEBUG_STACK_TRACE_DEPTH 5
#define B_DEBUG_PROFILE_BUFFER_FLUSH_THRESHOLD 70 /* in % */
struct function_profile_info;
@@ -84,15 +85,18 @@ struct thread_debug_info {
// sample buffer
int32 max_samples;
// maximum number of samples the buffer can hold
int32 flush_threshold;
// number of sample when the buffer is flushed (if possible)
int32 sample_count;
// number of samples the buffer currently holds
int32 stack_depth;
// number of return addresses to record per timer interval
int32 dropped_ticks;
// number of ticks that had to be dropped when the sample buffer was
// full and couldn't be flushed
int32 image_event;
// number of the image event when the first sample was written into
// the buffer
int32 disabled;
// if > 0, profiling is temporarily disabled for the thread
bool buffer_full;
// indicates that the sample buffer is full
union {