]> gitweb.factorcode.org Git - factor.git/blob - vm/sampling_profiler.hpp
vm: replace block comments /**/ with line comments //
[factor.git] / vm / sampling_profiler.hpp
1 namespace factor {
2
3 struct profiling_sample_count {
4   // Number of samples taken before the safepoint that recorded the sample
5   fixnum sample_count;
6   // Number of samples taken during GC
7   fixnum gc_sample_count;
8   // Number of samples taken during unoptimized compiler
9   fixnum jit_sample_count;
10   // Number of samples taken during foreign code execution
11   fixnum foreign_sample_count;
12   // Number of samples taken during code execution in non-Factor threads
13   fixnum foreign_thread_sample_count;
14
15   profiling_sample_count(fixnum sample_count, fixnum gc_sample_count,
16                          fixnum jit_sample_count, fixnum foreign_sample_count,
17                          fixnum foreign_thread_sample_count)
18       : sample_count(sample_count),
19         gc_sample_count(gc_sample_count),
20         jit_sample_count(jit_sample_count),
21         foreign_sample_count(foreign_sample_count),
22         foreign_thread_sample_count(foreign_thread_sample_count) {}
23
24   bool empty() const {
25     return sample_count + gc_sample_count + jit_sample_count +
26                foreign_sample_count + foreign_thread_sample_count ==
27            0;
28   }
29
30   profiling_sample_count record_counts() volatile;
31   void clear() volatile;
32 };
33
34 struct profiling_sample {
35   // Sample counts
36   profiling_sample_count counts;
37   // Active thread during sample
38   cell thread;
39   // The callstack at safepoint time. Indexes to the beginning and ending
40   // code_block entries in the vm sample_callstacks array.
41   cell callstack_begin, callstack_end;
42
43   profiling_sample(profiling_sample_count const& counts, cell thread,
44                    cell callstack_begin, cell callstack_end);
45 };
46
47 }