-USING: byte-arrays calendar kernel math memory namespaces
-random threads tools.profiler.sampling
-tools.profiler.sampling.private tools.test sequences ;
+USING: 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
! Make sure the profiler doesn't blow up the VM
f raw-profile-data set-global
gc
+
+{ t 0 } [
+ ! Seed the samples data
+ [ "resource:basis/tools/memory/memory.factor" run-file ] profile
+ (get-samples) length 0 >
+ ! Should clear it
+ [ ] profile (get-samples) length
+] unit-test
samples_per_second = rate;
safepoint.sample_counts.clear();
// Release the memory consumed by colleting samples.
+ samples.clear();
samples.shrink_to_fit();
+ sample_callstacks.clear();
sample_callstacks.shrink_to_fit();
+
samples.reserve(10 * rate);
sample_callstacks.reserve(100 * rate);
atomic::store(&sampling_profiler_p, true);