Skip to content

Commit ca3532e

Browse files
committed
Add do-nothing option for the idle loop test for overhead measurement
1 parent b86fbf1 commit ca3532e

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

README.org

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,13 @@ once. ~IUP:+CLOSE+~ will exit the event loop.
276276
:alignment :acenter))
277277
(start-button (iup:button :title "&Start" :expand :horizontal))
278278
(stop-button (iup:button :title "S&top" :expand :horizontal))
279+
(do-nothing nil)
280+
(do-nothing-toggle (iup:toggle :title "Do nothing"
281+
:action (lambda (handle state)
282+
(setf do-nothing (not do-nothing))
283+
iup:+default+)))
279284
(vbox (iup:vbox (list counter
280-
(iup:hbox (list start-button stop-button)
285+
(iup:hbox (list start-button stop-button do-nothing-toggle)
281286
:cgap 5))
282287
:margin "5x5"))
283288
(dialog (iup:dialog vbox
@@ -287,8 +292,9 @@ once. ~IUP:+CLOSE+~ will exit the event loop.
287292
(lambda (handle)
288293
(setf (iup:idle-action)
289294
(lambda ()
290-
(setf (iup:attribute counter :title)
291-
(1+ (iup:attribute counter :title 'number)))
295+
(unless do-nothing
296+
(setf (iup:attribute counter :title)
297+
(1+ (iup:attribute counter :title 'number))))
292298
iup:+default+))
293299
iup:+default+))
294300
(setf (iup:callback stop-button :action)

examples/idle.lisp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@
1717
:alignment :acenter))
1818
(start-button (iup:button :title "&Start" :expand :horizontal))
1919
(stop-button (iup:button :title "S&top" :expand :horizontal))
20+
(do-nothing nil)
21+
(do-nothing-toggle (iup:toggle :title "Do nothing"
22+
:action (lambda (handle state)
23+
(setf do-nothing (not do-nothing))
24+
iup:+default+)))
2025
(vbox (iup:vbox (list counter
21-
(iup:hbox (list start-button stop-button)
26+
(iup:hbox (list start-button stop-button do-nothing-toggle)
2227
:cgap 5))
2328
:margin "5x5"))
2429
(dialog (iup:dialog vbox
@@ -28,8 +33,9 @@
2833
(lambda (handle)
2934
(setf (iup:idle-action)
3035
(lambda ()
31-
(setf (iup:attribute counter :title)
32-
(1+ (iup:attribute counter :title 'number)))
36+
(unless do-nothing
37+
(setf (iup:attribute counter :title)
38+
(1+ (iup:attribute counter :title 'number))))
3339
iup:+default+))
3440
iup:+default+))
3541
(setf (iup:callback stop-button :action)

0 commit comments

Comments
 (0)