VM: remove the reversing from sampling profiler callstack collection #452
parent
46105b62f6
commit
55e6ccb708
|
@ -1,8 +1,14 @@
|
||||||
USING: byte-arrays calendar kernel math memory namespaces parser
|
USING: assocs byte-arrays calendar kernel math memory namespaces
|
||||||
random sequences threads tools.profiler.sampling
|
parser random sequences threads tools.profiler.sampling
|
||||||
tools.profiler.sampling.private tools.test ;
|
tools.profiler.sampling.private tools.test ;
|
||||||
IN: tools.profiler.sampling.tests
|
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
|
! Make sure the profiler doesn't blow up the VM
|
||||||
TUPLE: boom ;
|
TUPLE: boom ;
|
||||||
{ } [ 10 [ [ ] profile ] times ] unit-test
|
{ } [ 10 [ [ ] profile ] times ] unit-test
|
||||||
|
|
|
@ -41,7 +41,7 @@ PRIVATE>
|
||||||
: sample-thread ( sample -- thread ) 5 swap nth ;
|
: sample-thread ( sample -- thread ) 5 swap nth ;
|
||||||
: sample-callstack ( sample -- array ) 6 swap nth ;
|
: sample-callstack ( sample -- array ) 6 swap nth ;
|
||||||
: unclip-callstack ( sample -- sample' callstack-top )
|
: 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>time ( samples -- seconds )
|
||||||
samples-per-second get-global / ;
|
samples-per-second get-global / ;
|
||||||
|
|
|
@ -49,7 +49,6 @@ void factor_vm::record_sample(bool prolog_p) {
|
||||||
};
|
};
|
||||||
iterate_callstack(ctx, recorder);
|
iterate_callstack(ctx, recorder);
|
||||||
cell end = sample_callstacks.size();
|
cell end = sample_callstacks.size();
|
||||||
std::reverse(sample_callstacks.begin() + begin, sample_callstacks.end());
|
|
||||||
|
|
||||||
// Add the sample.
|
// Add the sample.
|
||||||
cell thread = special_objects[OBJ_CURRENT_THREAD];
|
cell thread = special_objects[OBJ_CURRENT_THREAD];
|
||||||
|
|
Loading…
Reference in New Issue