2011-10-28 18:42:33 -04:00
|
|
|
namespace factor
|
|
|
|
{
|
|
|
|
|
2011-10-31 21:27:51 -04:00
|
|
|
struct profiling_sample_count
|
2011-10-28 18:42:33 -04:00
|
|
|
{
|
|
|
|
// Number of samples taken before the safepoint that recorded the sample
|
2011-10-31 18:06:34 -04:00
|
|
|
fixnum sample_count;
|
2011-10-28 18:42:33 -04:00
|
|
|
// Number of samples taken during GC
|
2011-10-31 18:06:34 -04:00
|
|
|
fixnum gc_sample_count;
|
2011-11-02 02:40:46 -04:00
|
|
|
// Number of samples taken during unoptimized compiler
|
|
|
|
fixnum jit_sample_count;
|
2011-10-31 03:10:30 -04:00
|
|
|
// Number of samples taken during foreign code execution
|
2011-10-31 18:06:34 -04:00
|
|
|
fixnum foreign_sample_count;
|
2011-10-31 03:10:30 -04:00
|
|
|
// Number of samples taken during code execution in non-Factor threads
|
2011-10-31 18:06:34 -04:00
|
|
|
fixnum foreign_thread_sample_count;
|
2011-10-31 21:27:51 -04:00
|
|
|
|
|
|
|
profiling_sample_count() :
|
|
|
|
sample_count(0),
|
|
|
|
gc_sample_count(0),
|
2011-11-02 02:40:46 -04:00
|
|
|
jit_sample_count(0),
|
2011-10-31 21:27:51 -04:00
|
|
|
foreign_sample_count(0),
|
|
|
|
foreign_thread_sample_count(0) {}
|
|
|
|
|
|
|
|
profiling_sample_count(fixnum sample_count,
|
|
|
|
fixnum gc_sample_count,
|
2011-11-02 02:40:46 -04:00
|
|
|
fixnum jit_sample_count,
|
2011-10-31 21:27:51 -04:00
|
|
|
fixnum foreign_sample_count,
|
|
|
|
fixnum foreign_thread_sample_count) :
|
|
|
|
sample_count(sample_count),
|
|
|
|
gc_sample_count(gc_sample_count),
|
2011-11-02 02:40:46 -04:00
|
|
|
jit_sample_count(jit_sample_count),
|
2011-10-31 21:27:51 -04:00
|
|
|
foreign_sample_count(foreign_sample_count),
|
|
|
|
foreign_thread_sample_count(foreign_thread_sample_count) {}
|
2011-11-17 20:13:59 -05:00
|
|
|
|
2011-10-31 21:27:51 -04:00
|
|
|
bool empty() const
|
|
|
|
{
|
|
|
|
return sample_count
|
|
|
|
+ gc_sample_count
|
2011-11-02 02:40:46 -04:00
|
|
|
+ jit_sample_count
|
2011-10-31 21:27:51 -04:00
|
|
|
+ foreign_sample_count
|
|
|
|
+ foreign_thread_sample_count == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
profiling_sample_count record_counts() volatile;
|
|
|
|
void clear() volatile;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct profiling_sample
|
|
|
|
{
|
|
|
|
// Sample counts
|
|
|
|
profiling_sample_count counts;
|
2011-11-01 22:39:54 -04:00
|
|
|
// Active thread during sample
|
|
|
|
cell thread;
|
2011-10-29 17:41:48 -04:00
|
|
|
/* The callstack at safepoint time. Indexes to the beginning and ending
|
|
|
|
code_block entries in the vm sample_callstacks array. */
|
|
|
|
cell callstack_begin, callstack_end;
|
2011-10-28 18:42:33 -04:00
|
|
|
|
2011-10-29 17:41:48 -04:00
|
|
|
profiling_sample(factor_vm *vm,
|
2011-11-17 20:13:59 -05:00
|
|
|
bool prolog_p,
|
2011-10-31 21:27:51 -04:00
|
|
|
profiling_sample_count const &counts,
|
2011-11-01 22:39:54 -04:00
|
|
|
cell thread);
|
2011-10-28 18:42:33 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|