main: setup GJS profiler when GJS_TRACE_FD is set
This is the same environment variable that will be used in GJS to auto-connect Sysprof to the GJS profiler when the gjs binary is used.
By handling this in
main(), we allow GJS to extract stack-traces and GC marks to be correlated with the frame data from cogl when run using
sysprof-cli from a secondary VT. (See screenshot below).
sysprof-cli -c "/opt/gnome/bin/gnome-shell --wayland --display-server" --gjs --gnome-shell my-capture.syscap
--no-perf to disable the use of
perf_event_open() syscall for stacktraces.
and then to view the capture: