2011-10-28 18:42:33 -04:00
|
|
|
namespace factor
|
|
|
|
{
|
|
|
|
|
|
|
|
#define FACTOR_PROFILE_SAMPLES_PER_SECOND 1000
|
|
|
|
|
|
|
|
struct profiling_sample
|
|
|
|
{
|
|
|
|
// 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-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-28 18:42:33 -04:00
|
|
|
// Active context during sample
|
|
|
|
context *ctx;
|
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-10-31 18:06:34 -04:00
|
|
|
fixnum sample_count,
|
|
|
|
fixnum gc_sample_count,
|
|
|
|
fixnum foreign_sample_count,
|
|
|
|
fixnum foreign_thread_sample_count,
|
2011-10-29 17:41:48 -04:00
|
|
|
context *ctx);
|
2011-10-28 18:42:33 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|