Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: newnames
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (36 sloc) 1.23 KB
;; tests for Nu profiling helpers.
;; Copyright (c) 2009 Tim Burks, Neon Design Technology, Inc.
(function dosomething ()
(1000 times:(do (i) (+ i i))))
(class TestProfiler is NuTestCase
(- (id) testProfile is
(set profiler (NuProfiler defaultProfiler))
(profiler start:"top")
(1 times:
(do (i)
(profiler start:"1")
(profiler stop)))
(2 times:
(do (i)
(profiler start:"2")
(profiler stop)))
(3 times:
(do (i)
(profiler start:"3")
(profiler stop)))
(profiler stop)
(set results (profiler sections))
;(puts (results description))
(assert_equal 2 ((results "2") count))
(assert_equal 3 ((results "3") count))
(set toptime ((results "top") time))
(set onetime ((results "1") time))
(set twotime ((results "2") time))
(set threetime ((results "3") time))
(if (eq (uname) "Darwin")
(assert_true (>= toptime (+ onetime twotime threetime))))))
Jump to Line
Something went wrong with that request. Please try again.