* gprof.c (inline_file_names): New variable.
(OPTION_INLINE_FILE_NAMES): Define. (long_options): Add --inline-file-names. (usage): Likewise. (main): Process --inline-file-names. * gprof.h: Add prototype for inline_file_names. * utils.c (print_name_only): Handle inline_file_names. * gprof.texi: Document new command line option.
This commit is contained in:
parent
97122a4cff
commit
630b051036
5 changed files with 46 additions and 19 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2013-11-21 Conrad Hoffmann <ch@bitfehler.net>
|
||||||
|
|
||||||
|
* gprof.c (inline_file_names): New variable.
|
||||||
|
(OPTION_INLINE_FILE_NAMES): Define.
|
||||||
|
(long_options): Add --inline-file-names.
|
||||||
|
(usage): Likewise.
|
||||||
|
(main): Process --inline-file-names.
|
||||||
|
* gprof.h: Add prototype for inline_file_names.
|
||||||
|
* utils.c (print_name_only): Handle inline_file_names.
|
||||||
|
* gprof.texi: Document new command line option.
|
||||||
|
|
||||||
2013-11-02 Alan Modra <amodra@gmail.com>
|
2013-11-02 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* Makefile.am (.m.c): Fix input and output file specification.
|
* Makefile.am (.m.c): Fix input and output file specification.
|
||||||
|
|
|
@ -68,6 +68,7 @@ bfd_boolean line_granularity = FALSE;
|
||||||
bfd_boolean print_descriptions = TRUE;
|
bfd_boolean print_descriptions = TRUE;
|
||||||
bfd_boolean print_path = FALSE;
|
bfd_boolean print_path = FALSE;
|
||||||
bfd_boolean ignore_non_functions = FALSE;
|
bfd_boolean ignore_non_functions = FALSE;
|
||||||
|
bfd_boolean inline_file_names = FALSE;
|
||||||
File_Format file_format = FF_AUTO;
|
File_Format file_format = FF_AUTO;
|
||||||
|
|
||||||
bfd_boolean first_output = TRUE;
|
bfd_boolean first_output = TRUE;
|
||||||
|
@ -91,8 +92,9 @@ static char *default_excluded_list[] =
|
||||||
/* Codes used for the long options with no short synonyms. 150 isn't
|
/* Codes used for the long options with no short synonyms. 150 isn't
|
||||||
special; it's just an arbitrary non-ASCII char value. */
|
special; it's just an arbitrary non-ASCII char value. */
|
||||||
|
|
||||||
#define OPTION_DEMANGLE (150)
|
#define OPTION_DEMANGLE (150)
|
||||||
#define OPTION_NO_DEMANGLE (OPTION_DEMANGLE + 1)
|
#define OPTION_NO_DEMANGLE (OPTION_DEMANGLE + 1)
|
||||||
|
#define OPTION_INLINE_FILE_NAMES (OPTION_DEMANGLE + 2)
|
||||||
|
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
|
@ -123,6 +125,7 @@ static struct option long_options[] =
|
||||||
{"no-demangle", no_argument, 0, OPTION_NO_DEMANGLE},
|
{"no-demangle", no_argument, 0, OPTION_NO_DEMANGLE},
|
||||||
{"directory-path", required_argument, 0, 'I'},
|
{"directory-path", required_argument, 0, 'I'},
|
||||||
{"display-unused-functions", no_argument, 0, 'z'},
|
{"display-unused-functions", no_argument, 0, 'z'},
|
||||||
|
{"inline-file-names", no_argument, 0, OPTION_INLINE_FILE_NAMES},
|
||||||
{"min-count", required_argument, 0, 'm'},
|
{"min-count", required_argument, 0, 'm'},
|
||||||
{"print-path", no_argument, 0, 'L'},
|
{"print-path", no_argument, 0, 'L'},
|
||||||
{"separate-files", no_argument, 0, 'y'},
|
{"separate-files", no_argument, 0, 'y'},
|
||||||
|
@ -162,7 +165,7 @@ Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqSQZ][name]] [-I dirs]\n\
|
||||||
[--[no-]annotated-source[=name]] [--[no-]exec-counts[=name]]\n\
|
[--[no-]annotated-source[=name]] [--[no-]exec-counts[=name]]\n\
|
||||||
[--[no-]flat-profile[=name]] [--[no-]graph[=name]]\n\
|
[--[no-]flat-profile[=name]] [--[no-]graph[=name]]\n\
|
||||||
[--[no-]time=name] [--all-lines] [--brief] [--debug[=level]]\n\
|
[--[no-]time=name] [--all-lines] [--brief] [--debug[=level]]\n\
|
||||||
[--function-ordering] [--file-ordering]\n\
|
[--function-ordering] [--file-ordering] [--inline-file-names]\n\
|
||||||
[--directory-path=dirs] [--display-unused-functions]\n\
|
[--directory-path=dirs] [--display-unused-functions]\n\
|
||||||
[--file-format=name] [--file-info] [--help] [--line] [--min-count=n]\n\
|
[--file-format=name] [--file-info] [--help] [--line] [--min-count=n]\n\
|
||||||
[--no-static] [--print-path] [--separate-files]\n\
|
[--no-static] [--print-path] [--separate-files]\n\
|
||||||
|
@ -470,6 +473,9 @@ This program is free software. This program has absolutely no warranty.\n"));
|
||||||
case OPTION_NO_DEMANGLE:
|
case OPTION_NO_DEMANGLE:
|
||||||
demangle = FALSE;
|
demangle = FALSE;
|
||||||
break;
|
break;
|
||||||
|
case OPTION_INLINE_FILE_NAMES:
|
||||||
|
inline_file_names = TRUE;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage (stderr, 1);
|
usage (stderr, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,7 @@ extern bfd_boolean line_granularity; /* function or line granularity? */
|
||||||
extern bfd_boolean print_descriptions; /* output profile description */
|
extern bfd_boolean print_descriptions; /* output profile description */
|
||||||
extern bfd_boolean print_path; /* print path or just filename? */
|
extern bfd_boolean print_path; /* print path or just filename? */
|
||||||
extern bfd_boolean ignore_non_functions; /* Ignore non-function symbols. */
|
extern bfd_boolean ignore_non_functions; /* Ignore non-function symbols. */
|
||||||
|
extern bfd_boolean inline_file_names; /* print file names after symbols */
|
||||||
|
|
||||||
extern File_Format file_format; /* requested file format */
|
extern File_Format file_format; /* requested file format */
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
\input texinfo @c -*-texinfo-*-
|
\input texinfo @c -*-texinfo-*-
|
||||||
@setfilename gprof.info
|
@setfilename gprof.info
|
||||||
@c Copyright 1988, 1992, 1993, 1998, 1999, 2000, 2001, 2002, 2003,
|
@c Copyright 1988-2013 Free Software Foundation, Inc.
|
||||||
@c 2004, 2007, 2008, 2009
|
|
||||||
@c Free Software Foundation, Inc.
|
|
||||||
@settitle GNU gprof
|
@settitle GNU gprof
|
||||||
@setchapternewpage odd
|
@setchapternewpage odd
|
||||||
|
|
||||||
|
@ -23,8 +21,7 @@
|
||||||
This file documents the gprof profiler of the GNU system.
|
This file documents the gprof profiler of the GNU system.
|
||||||
|
|
||||||
@c man begin COPYRIGHT
|
@c man begin COPYRIGHT
|
||||||
Copyright @copyright{} 1988, 1992, 1997, 1998, 1999, 2000, 2001, 2003,
|
Copyright @copyright{} 1988-2013 Free Software Foundation, Inc.
|
||||||
2007, 2008, 2009 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3
|
under the terms of the GNU Free Documentation License, Version 1.3
|
||||||
|
@ -57,8 +54,7 @@ execute programs. @sc{gnu} @code{gprof} was written by Jay Fenlason.
|
||||||
Eric S. Raymond made some minor corrections and additions in 2003.
|
Eric S. Raymond made some minor corrections and additions in 2003.
|
||||||
|
|
||||||
@vskip 0pt plus 1filll
|
@vskip 0pt plus 1filll
|
||||||
Copyright @copyright{} 1988, 1992, 1997, 1998, 1999, 2000, 2003, 2008,
|
Copyright @copyright{} 1988-2013 Free Software Foundation, Inc.
|
||||||
2009 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3
|
under the terms of the GNU Free Documentation License, Version 1.3
|
||||||
|
@ -124,12 +120,13 @@ gprof [ -[abcDhilLrsTvwxyz] ] [ -[ACeEfFJnNOpPqQZ][@var{name}] ]
|
||||||
[ --debug[=@var{level}] ] [ --function-ordering ]
|
[ --debug[=@var{level}] ] [ --function-ordering ]
|
||||||
[ --file-ordering @var{map_file} ] [ --directory-path=@var{dirs} ]
|
[ --file-ordering @var{map_file} ] [ --directory-path=@var{dirs} ]
|
||||||
[ --display-unused-functions ] [ --file-format=@var{name} ]
|
[ --display-unused-functions ] [ --file-format=@var{name} ]
|
||||||
[ --file-info ] [ --help ] [ --line ] [ --min-count=@var{n} ]
|
[ --file-info ] [ --help ] [ --line ] [ --inline-file-names ]
|
||||||
[ --no-static ] [ --print-path ] [ --separate-files ]
|
[ --min-count=@var{n} ] [ --no-static ] [ --print-path ]
|
||||||
[ --static-call-graph ] [ --sum ] [ --table-length=@var{len} ]
|
[ --separate-files ] [ --static-call-graph ] [ --sum ]
|
||||||
[ --traditional ] [ --version ] [ --width=@var{n} ]
|
[ --table-length=@var{len} ] [ --traditional ] [ --version ]
|
||||||
[ --ignore-non-functions ] [ --demangle[=@var{STYLE}] ]
|
[ --width=@var{n} ] [ --ignore-non-functions ]
|
||||||
[ --no-demangle ] [--external-symbol-table=name]
|
[ --demangle[=@var{STYLE}] ] [ --no-demangle ]
|
||||||
|
[--external-symbol-table=name]
|
||||||
[ @var{image-file} ] [ @var{profile-file} @dots{} ]
|
[ @var{image-file} ] [ @var{profile-file} @dots{} ]
|
||||||
@c man end
|
@c man end
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
@ -712,6 +709,11 @@ the running time of @code{gprof}, and magnifies statistical
|
||||||
inaccuracies.
|
inaccuracies.
|
||||||
@xref{Sampling Error, ,Statistical Sampling Error}.
|
@xref{Sampling Error, ,Statistical Sampling Error}.
|
||||||
|
|
||||||
|
@item --inline-file-names
|
||||||
|
This option causes @code{gprof} to print the source file after each
|
||||||
|
symbol in both the flat profile and the call graph. The full path to the
|
||||||
|
file is printed if used with the @samp{-L} option.
|
||||||
|
|
||||||
@item -m @var{num}
|
@item -m @var{num}
|
||||||
@itemx --min-count=@var{num}
|
@itemx --min-count=@var{num}
|
||||||
This option affects execution count output only.
|
This option affects execution count output only.
|
||||||
|
|
|
@ -58,7 +58,7 @@ print_name_only (Sym *self)
|
||||||
}
|
}
|
||||||
printf ("%s", name);
|
printf ("%s", name);
|
||||||
size = strlen (name);
|
size = strlen (name);
|
||||||
if (line_granularity && self->file)
|
if ((line_granularity || inline_file_names) && self->file)
|
||||||
{
|
{
|
||||||
filename = self->file->name;
|
filename = self->file->name;
|
||||||
if (!print_path)
|
if (!print_path)
|
||||||
|
@ -73,8 +73,15 @@ print_name_only (Sym *self)
|
||||||
filename = self->file->name;
|
filename = self->file->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf (buf, " (%s:%d @ %lx)", filename, self->line_num,
|
if (line_granularity)
|
||||||
(unsigned long) self->addr);
|
{
|
||||||
|
sprintf (buf, " (%s:%d @ %lx)", filename, self->line_num,
|
||||||
|
(unsigned long) self->addr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (buf, " (%s:%d)", filename, self->line_num);
|
||||||
|
}
|
||||||
printf ("%s", buf);
|
printf ("%s", buf);
|
||||||
size += strlen (buf);
|
size += strlen (buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue