also rename the private primitives words in tools.profiler.sampling.
{
"tools.profiler.sampling.private"
{
- { "profiling" ( n -- ) "sampling_profiler" { object } { } f }
- { "(get-samples)" ( -- samples/f ) "get_samples" { } { object } f }
+ { "set-profiling" ( n -- ) "set_profiling" { object } { } f }
+ { "get-samples" ( -- samples/f ) "get_samples" { } { object } f }
}
}
{
{ t t } [
! Seed the samples data
[ "resource:basis/tools/memory/memory.factor" run-file ] profile
- (get-samples) length 0 >
+ get-samples length 0 >
OBJ-SAMPLE-CALLSTACKS special-object first 0 >
] unit-test
! On x86.64, [ ] profile doesn't generate any samples at all
! because it runs so quickly. On x86.32, one spurious sample is
! sometimes generated for some unknown reason.
- gc [ ] profile (get-samples) length 1 <=
+ gc [ ] profile get-samples length 1 <=
] unit-test
IN: tools.profiler.sampling
<PRIVATE
-PRIMITIVE: (get-samples) ( -- samples/f )
-PRIMITIVE: profiling ( n -- )
+PRIMITIVE: get-samples ( -- samples/f )
+PRIMITIVE: set-profiling ( n -- )
PRIVATE>
SYMBOL: samples-per-second
raw-profile-data get-global [ "No profile data" throw ] unless* ;
: profile ( quot -- )
- samples-per-second get-global profiling
- [ 0 profiling (get-samples) raw-profile-data set-global ]
+ samples-per-second get-global set-profiling
+ [ 0 set-profiling get-samples raw-profile-data set-global ]
finally ; inline
: total-sample-count ( sample -- count ) 0 swap nth ;
_(minor_gc) _(modify_code_heap) _(nano_count) _(quotation_code) \
_(quotation_compiled_p) _(reset_dispatch_stats) _(resize_array) \
_(resize_byte_array) _(resize_string) _(retainstack_for) \
- _(sampling_profiler) _(save_image) _(set_context_object) \
- _(set_datastack) _(set_innermost_stack_frame_quotation) \
+ _(save_image) _(set_context_object) _(set_datastack) \
+ _(set_innermost_stack_frame_quotation) _(set_profiling) \
_(set_retainstack) _(set_slot) _(set_special_object) \
_(set_string_nth_fast) _(size) _(sleep) _(special_object) _(string) \
_(strip_stack_traces) _(tuple) _(tuple_boa) \
}
// Allocates memory
-void factor_vm::set_sampling_profiler(fixnum rate) {
+void factor_vm::set_profiling(fixnum rate) {
bool running_p = atomic::load(&sampling_profiler_p);
if (rate > 0 && !running_p)
start_sampling_profiler(rate);
}
// Allocates memory
-void factor_vm::primitive_sampling_profiler() {
- set_sampling_profiler(to_fixnum(ctx->pop()));
+void factor_vm::primitive_set_profiling() {
+ set_profiling(to_fixnum(ctx->pop()));
}
// Allocates memory
void record_sample(bool prolog_p);
void start_sampling_profiler(fixnum rate);
void end_sampling_profiler();
- void set_sampling_profiler(fixnum rate);
- void primitive_sampling_profiler();
+ void set_profiling(fixnum rate);
+ void primitive_set_profiling();
void primitive_get_samples();
array* allot_growarr();
void growarr_add(array *growarr_, cell value);