mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 21:33:09 +02: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.h"
|
||||||
#include "gspawn-private.h"
|
#include "gspawn-private.h"
|
||||||
#include "gthread.h"
|
#include "gthread.h"
|
||||||
|
#include "gtrace-private.h"
|
||||||
#include "glib/gstdio.h"
|
#include "glib/gstdio.h"
|
||||||
|
|
||||||
#include "genviron.h"
|
#include "genviron.h"
|
||||||
@ -1760,7 +1761,10 @@ fork_exec_with_fds (gboolean intermediate_child,
|
|||||||
if (!intermediate_child && working_directory == NULL && !close_descriptors &&
|
if (!intermediate_child && working_directory == NULL && !close_descriptors &&
|
||||||
!search_path_from_envp && child_setup == NULL)
|
!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,
|
status = do_posix_spawn (argv,
|
||||||
envp,
|
envp,
|
||||||
search_path,
|
search_path,
|
||||||
@ -1796,12 +1800,14 @@ fork_exec_with_fds (gboolean intermediate_child,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_debug ("posix_spawn avoided %s%s%s%s%s",
|
g_trace_mark (G_TRACE_CURRENT_TIME, 0,
|
||||||
!intermediate_child ? "" : "(automatic reaping requested) ",
|
"GLib", "fork",
|
||||||
working_directory == NULL ? "" : "(workdir specified) ",
|
"posix_spawn avoided %s%s%s%s%s",
|
||||||
!close_descriptors ? "" : "(fd close requested) ",
|
!intermediate_child ? "" : "(automatic reaping requested) ",
|
||||||
!search_path_from_envp ? "" : "(using envp for search path) ",
|
working_directory == NULL ? "" : "(workdir specified) ",
|
||||||
child_setup == NULL ? "" : "(child_setup 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 */
|
#endif /* POSIX_SPAWN_AVAILABLE */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user