mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 19:03:59 +08:00
6e9bd0f898
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
48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
/* 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
|
|
}
|