mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-28 02:20:04 +01:00
gspawn: Add sysprof trace support for spawning
Use this to replace the much-hated `g_debug()` which told people that `posix_spawn()` (the fast path) wasn’t being used for various reasons. If people want to make their process spawning faster now, they’ll have to use a profiling tool like sysprof to check their program’s performance. Shocking. I think I was wrong to put this `g_debug()` in there in the first place — it hasn’t served its purpose of making people speed up their spawn paths to use `posix_spawn()`, it’s only cluttered up logs and frustrated people. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
6f281ce2e5
commit
7cd67c935f
@ -54,6 +54,7 @@
|
||||
#include "gspawn.h"
|
||||
#include "gspawn-private.h"
|
||||
#include "gthread.h"
|
||||
#include "gtrace-private.h"
|
||||
#include "glib/gstdio.h"
|
||||
|
||||
#include "genviron.h"
|
||||
@ -1760,7 +1761,10 @@ fork_exec_with_fds (gboolean intermediate_child,
|
||||
if (!intermediate_child && working_directory == NULL && !close_descriptors &&
|
||||
!search_path_from_envp && child_setup == NULL)
|
||||
{
|
||||
g_debug ("Launching with posix_spawn");
|
||||
g_trace_mark (G_TRACE_CURRENT_TIME, 0,
|
||||
"GLib", "posix_spawn",
|
||||
"%s", argv[0]);
|
||||
|
||||
status = do_posix_spawn (argv,
|
||||
envp,
|
||||
search_path,
|
||||
@ -1796,12 +1800,14 @@ fork_exec_with_fds (gboolean intermediate_child,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_debug ("posix_spawn avoided %s%s%s%s%s",
|
||||
!intermediate_child ? "" : "(automatic reaping requested) ",
|
||||
working_directory == NULL ? "" : "(workdir specified) ",
|
||||
!close_descriptors ? "" : "(fd close requested) ",
|
||||
!search_path_from_envp ? "" : "(using envp for search path) ",
|
||||
child_setup == NULL ? "" : "(child_setup specified) ");
|
||||
g_trace_mark (G_TRACE_CURRENT_TIME, 0,
|
||||
"GLib", "fork",
|
||||
"posix_spawn avoided %s%s%s%s%s",
|
||||
!intermediate_child ? "" : "(automatic reaping requested) ",
|
||||
working_directory == NULL ? "" : "(workdir specified) ",
|
||||
!close_descriptors ? "" : "(fd close requested) ",
|
||||
!search_path_from_envp ? "" : "(using envp for search path) ",
|
||||
child_setup == NULL ? "" : "(child_setup specified) ");
|
||||
}
|
||||
#endif /* POSIX_SPAWN_AVAILABLE */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user