If profiling is turned on it is turned on for all threads.
Ok, I was suspecting something like that. Are there plans for profiling concurrent programs or even interactions of threads?
Profiling 2 records the number of words allocated in each function. It works by pretending that the heap segment is full for each allocation so forcing a call into the RTS. This adds a considerable overhead but does produce accurate figures rather than samples. It measures the allocation made and takes no account of whether or when the data structures are garbage collected.
Thanks for making that clear.
Profiling 1 samples the program counter to find out where the code is spending most of its time. It only really works properly in Linux. Mac OS X does not have thread-specific CPU timers. In Linux a timer is set for each thread which causes it to be interrupted every millisecond of CPU time. One millisecond seems like a reasonable figure but you could try changing it. You would have to modify Processes::StartProfilingTimer in the RTS.
Ok, maybe I'll try this. What happens if the thread is inside the RTS (but not engaged in GC, which is counted) when the timer goes off? Are those samples just ignored or do they count as UNKNOWN?