VM: remove the reversing from sampling profiler callstack collection #452

char-rename
Björn Lindqvist 2016-10-11 10:45:09 +02:00
parent 46105b62f6
commit 55e6ccb708
3 changed files with 9 additions and 4 deletions

View File

@ -1,8 +1,14 @@
USING: byte-arrays calendar kernel math memory namespaces parser
random sequences threads tools.profiler.sampling
USING: assocs byte-arrays calendar kernel math memory namespaces
parser random sequences threads tools.profiler.sampling
tools.profiler.sampling.private tools.test ;
IN: tools.profiler.sampling.tests
! collect-tops: top is the last element in the array
{ 5 } [
{ { 1 2 3 4 5 6 { 3 4 5 } } } 1 2 collect-tops
keys first
] unit-test
! Make sure the profiler doesn't blow up the VM
TUPLE: boom ;
{ } [ 10 [ [ ] profile ] times ] unit-test

View File

@ -41,7 +41,7 @@ PRIVATE>
: sample-thread ( sample -- thread ) 5 swap nth ;
: sample-callstack ( sample -- array ) 6 swap nth ;
: unclip-callstack ( sample -- sample' callstack-top )
clone 6 over [ unclip swap ] change-nth ;
clone 6 over [ unclip-last swap ] change-nth ;
: samples>time ( samples -- seconds )
samples-per-second get-global / ;

View File

@ -49,7 +49,6 @@ void factor_vm::record_sample(bool prolog_p) {
};
iterate_callstack(ctx, recorder);
cell end = sample_callstacks.size();
std::reverse(sample_callstacks.begin() + begin, sample_callstacks.end());
// Add the sample.
cell thread = special_objects[OBJ_CURRENT_THREAD];