From 1745e22211fe0abca3c98105d76efc2430e75d65 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Tue, 1 Nov 2011 20:24:17 -0700 Subject: [PATCH] tools.profiler.sampling: make rate a global var --- basis/tools/profiler/sampling/sampling.factor | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/basis/tools/profiler/sampling/sampling.factor b/basis/tools/profiler/sampling/sampling.factor index 193c40570e..01fe6b6501 100644 --- a/basis/tools/profiler/sampling/sampling.factor +++ b/basis/tools/profiler/sampling/sampling.factor @@ -11,7 +11,7 @@ IN: tools.profiler.sampling SYMBOL: raw-profile-data SYMBOL: samples-per-second -CONSTANT: default-samples-per-second 1000 +samples-per-second [ 1,000 ] initialize CONSTANT: ignore-words { signal-handler leaf-signal-handler profiling minor-gc } @@ -21,13 +21,11 @@ CONSTANT: ignore-words : get-raw-profile-data ( -- data ) raw-profile-data get-global [ "No profile data" throw ] unless* ; -: profile* ( rate quot -- ) - [ [ samples-per-second set-global ] [ profiling ] bi ] dip +: profile ( quot -- ) + samples-per-second get-global profiling [ 0 profiling ] [ ] cleanup (get-samples) raw-profile-data set-global ; inline -: profile ( quot -- ) default-samples-per-second swap profile* ; inline - : total-sample-count ( sample -- count ) first ; : gc-sample-count ( sample -- count ) second ; : foreign-sample-count ( sample -- count ) third ;