[PATCH] Report LTO phase in lto1 process name v2
On larger parallel WHOPR builds I find it useful to see in top which phase a given lto1 is in. Set the process name to lto1-wpa, lto1-ltrans, lto1-lto depending on the current mode. This is currently only implemented for Linux and only using the "comm" process name, which is reported in top. v2: Moved function to libiberty, renamed setproctitle to match BSD. In theory it should pick up BSD's libc function for this on a BSD system, but I haven't tested this. gcc/lto/ 2010-10-06 Andi Kleen <ak@linux.intel.com> * lto.c (lto_process_name): Add. (lto_main): Call lto_process_name. include/ 2010-10-06 Andi Kleen <ak@linux.intel.com> * libiberty.h (setproctitle): Add prototype. libiberty/ 2010-10-06 Andi Kleen <ak@linux.intel.com> * Makefile.in (CFILES): Add setproctitle. (CONFIGURED_OFILES): Add setproctitle. (setproctitle): Add rule. * config.in: Regenerate. * configure: Regenerate. * configure.ac: Add checks for prctl PR_SET_NAME and setproctitle. * setproctitle.c: Add file. * functions.texi: Regenerate. From-SVN: r165066
This commit is contained in:
parent
826d817fae
commit
6e9bd0f898
11 changed files with 155 additions and 13 deletions
|
@ -1,3 +1,8 @@
|
|||
2010-10-06 Andi Kleen <ak@linux.intel.com>
|
||||
|
||||
* lto.c (lto_process_name): Add.
|
||||
(lto_main): Call lto_process_name.
|
||||
|
||||
2010-10-06 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* lto.c (partition_cgraph_node_p, partition_varpool_node_p): Handle
|
||||
|
|
|
@ -2379,6 +2379,18 @@ lto_eh_personality (void)
|
|||
return lto_eh_personality_decl;
|
||||
}
|
||||
|
||||
/* Set the process name based on the LTO mode. */
|
||||
|
||||
static void
|
||||
lto_process_name (void)
|
||||
{
|
||||
if (flag_lto)
|
||||
setproctitle ("lto1-lto");
|
||||
if (flag_wpa)
|
||||
setproctitle ("lto1-wpa");
|
||||
if (flag_ltrans)
|
||||
setproctitle ("lto1-ltrans");
|
||||
}
|
||||
|
||||
/* Main entry point for the GIMPLE front end. This front end has
|
||||
three main personalities:
|
||||
|
@ -2403,6 +2415,8 @@ lto_eh_personality (void)
|
|||
void
|
||||
lto_main (int debug_p ATTRIBUTE_UNUSED)
|
||||
{
|
||||
lto_process_name ();
|
||||
|
||||
lto_init_reader ();
|
||||
|
||||
/* Read all the symbols and call graph from all the files in the
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2010-10-06 Andi Kleen <ak@linux.intel.com>
|
||||
|
||||
* libiberty.h (setproctitle): Add prototype.
|
||||
|
||||
2010-09-09 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* dwarf2.h (DW_OP_GNU_implicit_pointer): New.
|
||||
|
|
|
@ -634,6 +634,9 @@ extern int vsnprintf (char *, size_t, const char *, va_list) ATTRIBUTE_PRINTF(3,
|
|||
extern int strverscmp (const char *, const char *);
|
||||
#endif
|
||||
|
||||
/* Set the title of a process */
|
||||
extern void setproctitle (const char *name, ...);
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
|
||||
|
||||
/* Drastically simplified alloca configurator. If we're using GCC,
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
2010-10-06 Andi Kleen <ak@linux.intel.com>
|
||||
|
||||
* Makefile.in (CFILES): Add setproctitle.
|
||||
(CONFIGURED_OFILES): Add setproctitle.
|
||||
(setproctitle): Add rule.
|
||||
* config.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
* configure.ac: Add checks for prctl PR_SET_NAME and setproctitle.
|
||||
* setproctitle.c: Add file.
|
||||
* functions.texi: Regenerate.
|
||||
|
||||
2010-09-22 Tristan Gingold <gingold@adacore.com>
|
||||
|
||||
* cplus-dem.c (ada_demangle): Add comments.
|
||||
|
|
|
@ -144,7 +144,8 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \
|
|||
pex-unix.c pex-win32.c \
|
||||
physmem.c putenv.c \
|
||||
random.c regex.c rename.c rindex.c \
|
||||
safe-ctype.c setenv.c sha1.c sigsetmask.c snprintf.c sort.c \
|
||||
safe-ctype.c setenv.c setproctitle.c sha1.c sigsetmask.c \
|
||||
snprintf.c sort.c \
|
||||
spaces.c splay-tree.c stpcpy.c stpncpy.c strcasecmp.c \
|
||||
strchr.c strdup.c strerror.c strncasecmp.c strncmp.c \
|
||||
strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c \
|
||||
|
@ -201,7 +202,9 @@ CONFIGURED_OFILES = ./asprintf.$(objext) ./atexit.$(objext) \
|
|||
./pex-unix.$(objext) ./pex-win32.$(objext) \
|
||||
./putenv.$(objext) \
|
||||
./random.$(objext) ./rename.$(objext) ./rindex.$(objext) \
|
||||
./setenv.$(objext) ./sigsetmask.$(objext) ./snprintf.$(objext) \
|
||||
./setenv.$(objext) \
|
||||
./setproctitle.$(objext) \
|
||||
./sigsetmask.$(objext) ./snprintf.$(objext) \
|
||||
./stpcpy.$(objext) ./stpncpy.$(objext) ./strcasecmp.$(objext) \
|
||||
./strchr.$(objext) ./strdup.$(objext) ./strncasecmp.$(objext) \
|
||||
./strncmp.$(objext) ./strndup.$(objext) ./strrchr.$(objext) \
|
||||
|
@ -944,6 +947,12 @@ $(CONFIGURED_OFILES): stamp-picdir
|
|||
else true; fi
|
||||
$(COMPILE.c) $(srcdir)/setenv.c $(OUTPUT_OPTION)
|
||||
|
||||
./setproctitle.$(objext): $(srcdir)/setproctitle.c config.h $(INCDIR)/ansidecl.h
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.c) $(PICFLAG) $(srcdir)/setproctitle.c -o pic/$@; \
|
||||
else true; fi
|
||||
$(COMPILE.c) $(srcdir)/setproctitle.c $(OUTPUT_OPTION)
|
||||
|
||||
./sha1.$(objext): $(srcdir)/sha1.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/sha1.h
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.c) $(PICFLAG) $(srcdir)/sha1.c -o pic/$@; \
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
don't. */
|
||||
#undef HAVE_DECL_ASPRINTF
|
||||
|
||||
/* Define to 1 if you have the declaration of `basename', and to 0 if you
|
||||
don't. */
|
||||
/* Define to 1 if you have the declaration of `basename(char *)', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_BASENAME
|
||||
|
||||
/* Define to 1 if you have the declaration of `calloc', and to 0 if you don't.
|
||||
|
@ -154,9 +154,6 @@
|
|||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `mempcpy' function. */
|
||||
#undef HAVE_MEMPCPY
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
|
@ -169,6 +166,9 @@
|
|||
/* Define to 1 if you have the `on_exit' function. */
|
||||
#undef HAVE_ON_EXIT
|
||||
|
||||
/* Define if you have prctl PR_SET_NAME */
|
||||
#undef HAVE_PRCTL_SET_NAME
|
||||
|
||||
/* Define to 1 if you have the `psignal' function. */
|
||||
#undef HAVE_PSIGNAL
|
||||
|
||||
|
@ -199,6 +199,9 @@
|
|||
/* Define to 1 if you have the `setenv' function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define to 1 if you have the `setproctitle' function. */
|
||||
#undef HAVE_SETPROCTITLE
|
||||
|
||||
/* Define to 1 if you have the `sigsetmask' function. */
|
||||
#undef HAVE_SIGSETMASK
|
||||
|
||||
|
@ -358,9 +361,6 @@
|
|||
/* Define to 1 if you have the `vprintf' function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `vsprintf' function. */
|
||||
#undef HAVE_VSPRINTF
|
||||
|
||||
|
|
31
libiberty/configure
vendored
31
libiberty/configure
vendored
|
@ -5276,6 +5276,7 @@ funcs="$funcs vprintf"
|
|||
funcs="$funcs vsnprintf"
|
||||
funcs="$funcs vsprintf"
|
||||
funcs="$funcs waitpid"
|
||||
funcs="$funcs setproctitle"
|
||||
|
||||
# Also in the old function.def file: alloca, vfork, getopt.
|
||||
|
||||
|
@ -5298,7 +5299,8 @@ if test "x" = "y"; then
|
|||
on_exit \
|
||||
psignal pstat_getdynamic pstat_getstatic putenv \
|
||||
random realpath rename rindex \
|
||||
sbrk setenv sigsetmask snprintf stpcpy stpncpy strcasecmp strchr strdup \
|
||||
sbrk setenv setproctitle sigsetmask snprintf stpcpy stpncpy strcasecmp strchr \
|
||||
strdup \
|
||||
strerror strncasecmp strndup strrchr strsignal strstr strtod strtol \
|
||||
strtoul strverscmp sysconf sysctl sysmp \
|
||||
table times tmpnam \
|
||||
|
@ -5704,6 +5706,33 @@ fi
|
|||
|
||||
|
||||
|
||||
# check for prctl PR_SET_NAME
|
||||
if test "$cross_compiling" = yes; then :
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error "cannot run test program while cross compiling
|
||||
See \`config.log' for more details." "$LINENO" 5; }
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <sys/prctl.h>
|
||||
int main()
|
||||
{
|
||||
return (prctl(PR_SET_NAME, "foo") == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"; then :
|
||||
|
||||
$as_echo "#define HAVE_PRCTL_SET_NAME 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
|
||||
case "${host}" in
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
$as_echo "#define HAVE_SYS_ERRLIST 1" >>confdefs.h
|
||||
|
|
|
@ -351,6 +351,7 @@ funcs="$funcs vprintf"
|
|||
funcs="$funcs vsnprintf"
|
||||
funcs="$funcs vsprintf"
|
||||
funcs="$funcs waitpid"
|
||||
funcs="$funcs setproctitle"
|
||||
|
||||
# Also in the old function.def file: alloca, vfork, getopt.
|
||||
|
||||
|
@ -373,7 +374,8 @@ if test "x" = "y"; then
|
|||
on_exit \
|
||||
psignal pstat_getdynamic pstat_getstatic putenv \
|
||||
random realpath rename rindex \
|
||||
sbrk setenv sigsetmask snprintf stpcpy stpncpy strcasecmp strchr strdup \
|
||||
sbrk setenv setproctitle sigsetmask snprintf stpcpy stpncpy strcasecmp strchr \
|
||||
strdup \
|
||||
strerror strncasecmp strndup strrchr strsignal strstr strtod strtol \
|
||||
strtoul strverscmp sysconf sysctl sysmp \
|
||||
table times tmpnam \
|
||||
|
@ -533,6 +535,16 @@ fi
|
|||
AC_SUBST(CHECK)
|
||||
AC_SUBST(target_header_dir)
|
||||
|
||||
# check for prctl PR_SET_NAME
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <sys/prctl.h>
|
||||
int main()
|
||||
{
|
||||
return (prctl(PR_SET_NAME, "foo") == 0) ? 0 : 1;
|
||||
}
|
||||
]])], AC_DEFINE(HAVE_PRCTL_SET_NAME, 1,
|
||||
[Define if you have prctl PR_SET_NAME]))
|
||||
|
||||
case "${host}" in
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
AC_DEFINE(HAVE_SYS_ERRLIST)
|
||||
|
|
|
@ -667,7 +667,7 @@ relative prefix can be found, return @code{NULL}.
|
|||
|
||||
@end deftypefn
|
||||
|
||||
@c make-temp-file.c:168
|
||||
@c make-temp-file.c:173
|
||||
@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
|
||||
|
||||
Return a temporary file name (as a string) or @code{NULL} if unable to
|
||||
|
@ -1146,6 +1146,14 @@ environment. This implementation is not safe for multithreaded code.
|
|||
|
||||
@end deftypefn
|
||||
|
||||
@c setproctitle.c:30
|
||||
@deftypefn Supplemental void setproctitle(const char *@var{fmt} ...)
|
||||
|
||||
Set the title of a process to @var{fmt}. va args not supported for now,
|
||||
but defined for compatibility with BSD.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strsignal.c:348
|
||||
@deftypefn Extension int signo_max (void)
|
||||
|
||||
|
|
47
libiberty/setproctitle.c
Normal file
47
libiberty/setproctitle.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* Set the title of a process.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the libiberty library.
|
||||
Libiberty is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
Libiberty is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with libiberty; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_PRCTL_SET_NAME
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
#include "ansidecl.h"
|
||||
|
||||
/*
|
||||
|
||||
@deftypefn Supplemental void setproctitle(const char *@var{fmt} ...)
|
||||
|
||||
Set the title of a process to @var{fmt}. va args not supported for now,
|
||||
but defined for compatibility with BSD.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
*/
|
||||
|
||||
void
|
||||
setproctitle (const char *name ATTRIBUTE_UNUSED, ...)
|
||||
{
|
||||
#ifdef HAVE_PRCTL_SET_NAME
|
||||
/* On Linux this sets the top visible "comm", but not necessarily
|
||||
the name visible in ps. */
|
||||
prctl (PR_SET_NAME, name);
|
||||
#endif
|
||||
}
|
Loading…
Add table
Reference in a new issue