]> gitweb.factorcode.org Git - factor.git/blob - vm/sampling_profiler.hpp
vm: count samples from foreign threads
[factor.git] / vm / sampling_profiler.hpp
1 namespace factor
2 {
3
4 #define FACTOR_PROFILE_SAMPLES_PER_SECOND 1000
5
6 struct profiling_sample
7 {
8         // Number of samples taken before the safepoint that recorded the sample
9         cell sample_count;
10         // Number of samples taken during GC
11         cell gc_sample_count;
12         // Number of samples taken during foreign code execution
13         cell foreign_sample_count;
14         // Number of samples taken during code execution in non-Factor threads
15         cell foreign_thread_sample_count;
16         // Active context during sample
17         context *ctx;
18         /* The callstack at safepoint time. Indexes to the beginning and ending
19         code_block entries in the vm sample_callstacks array. */
20         cell callstack_begin, callstack_end;
21
22         profiling_sample(factor_vm *vm,
23                 cell sample_count,
24                 cell gc_sample_count,
25                 cell foreign_sample_count,
26                 cell foreign_thread_sample_count,
27                 context *ctx);
28 };
29
30 }