add environment variable to enable profile stats collection
This commit is contained in:
parent
1486e5a9e0
commit
17e3e0397f
@ -8,6 +8,10 @@
|
||||
|
||||
(import-macros { : define-tests : expect : expect= } :assert)
|
||||
|
||||
(local profile
|
||||
(and (os.getenv "IN_NIX_SHELL")
|
||||
(require :libluaperf)))
|
||||
|
||||
(macro with-timing [label & body]
|
||||
`(let [before# (ptime.clock_gettime ptime.CLOCK_PROCESS_CPUTIME_ID)
|
||||
ret# (table.pack (do ,body))]
|
||||
@ -58,13 +62,17 @@ label.readout {
|
||||
)
|
||||
(style_provider:load_from_data CSS)))
|
||||
|
||||
(fn main-quit []
|
||||
(when profile (profile:stop))
|
||||
(Gtk.main_quit))
|
||||
|
||||
(local window (Gtk.Window {
|
||||
:title "Map"
|
||||
:name "toplevel"
|
||||
:default_width viewport-width
|
||||
:default_height viewport-height
|
||||
|
||||
:on_destroy Gtk.main_quit
|
||||
:on_destroy main-quit
|
||||
}))
|
||||
|
||||
(local state-widgets { })
|
||||
@ -453,6 +461,15 @@ label.readout {
|
||||
true)
|
||||
nil nil)
|
||||
|
||||
(fn collect-profile []
|
||||
(GLib.timeout_add
|
||||
GLib.PRIORITY_DEFAULT
|
||||
(* 60 1000) main-quit
|
||||
nil nil)
|
||||
(print "profiling for 60 seconds")
|
||||
(profile.start 0))
|
||||
|
||||
|
||||
(window:add
|
||||
(doto (Gtk.Overlay {})
|
||||
(: :add (osm-widget))
|
||||
@ -463,4 +480,5 @@ label.readout {
|
||||
|
||||
(window:show_all)
|
||||
(styles)
|
||||
(when (os.getenv "MAP_PROFILE") (collect-profile))
|
||||
(Gtk:main)
|
||||
|
Loading…
Reference in New Issue
Block a user