From: Julian Seward Date: Thu, 8 Feb 2007 06:47:19 +0000 (+0000) Subject: Add a new flag --cachegrind-log-file to cg_annotate, which tells it X-Git-Tag: svn/VALGRIND_3_3_0~391 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5748ebe52726cd16b6ce1c4d43adc612a5ef0593;p=thirdparty%2Fvalgrind.git Add a new flag --cachegrind-log-file to cg_annotate, which tells it precisely the name of the profile data file it should use (instead of assuming cachegrind.out. where is specified by the -- flag). The old mechanism is still supported though. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6573 --- diff --git a/cachegrind/cg_annotate.in b/cachegrind/cg_annotate.in index 811e5a8466..21bc4e8b31 100644 --- a/cachegrind/cg_annotate.in +++ b/cachegrind/cg_annotate.in @@ -142,11 +142,13 @@ my $version = "@VERSION@"; # Usage message. my $usage = < [source-files] +usage: cg_annotate [options] [source-files] options for the user, with defaults in [ ], are: -h --help show this message -v --version show version + -- read profile data from cachegrind.out. + --cachegrind-out-file= read profile data from --show=A,B,C only show figures for events A,B,C [all] --sort=A,B,C sort columns by events A,B,C [event column order] --threshold=<0--100> percentage of counts (of primary sort event) we @@ -158,8 +160,11 @@ usage: cg_annotate [options] -- [source-files] -I --include= add to list of directories to search for source files - Cachegrind is Copyright (C) 2002-2005 Nicholas Nethercote. - Both are licensed under the GNU General Public License, version 2. + You must use either -- or --cachegrind-out-file exactly once + in order that cg_annotate knows what file to read profile data from. + + cg_annotate is Copyright (C) 2002-2007 Nicholas Nethercote. + and licensed under the GNU General Public License, version 2. Bug reports, feedback, admiration, abuse, etc, to: njn\@valgrind.org. END @@ -236,12 +241,23 @@ sub process_cmd_line() $inc =~ s|/$||; # trim trailing '/' push(@include_dirs, "$inc/"); + # --cachegrind-out-file= + } elsif ($arg =~ /^--cachegrind-out-file=(.*)$/) { + if (not defined $input_file) { + $input_file = $1; + } else { + die("You may only specify one input file\n" . + "using the -- and --cachegrind-out-file options.\n"); + } + + # -- } elsif ($arg =~ /^--(\d+)$/) { my $pid = $1; if (not defined $input_file) { $input_file = "cachegrind.out.$pid"; } else { - die("One cachegrind.out. file at a time, please\n"); + die("You may only specify one input file\n" . + "using the -- and --cachegrind-out-file options.\n"); } } else { # -h and --help fall under this case @@ -307,7 +323,8 @@ sub line_to_CC ($) sub read_input_file() { - open(INPUTFILE, "< $input_file") || die "File $input_file not opened\n"; + open(INPUTFILE, "< $input_file") + || die "Cannot open $input_file for reading\n"; # Read "desc:" lines. my $line; diff --git a/cachegrind/docs/cg-manual.xml b/cachegrind/docs/cg-manual.xml index cfc1c8339c..91bcfc16a3 100644 --- a/cachegrind/docs/cg-manual.xml +++ b/cachegrind/docs/cg-manual.xml @@ -278,13 +278,17 @@ file: recycled). To use a basename other than the default - cachegrind.out., + cachegrind.out, use the --cachegrind-out-file switch. To add further qualifiers to the output filename you can use the core's --log-file-qualifier - flag. + flag. This extends the file name further with the text + .lfq.followed by the + contents of the environment variable specified by + --log-file-qualifier. + It can be huge: ls -l @@ -359,9 +363,10 @@ configuration, or failing that, via defaults). - Write the profile data to .]]> + Write the profile data to + basename.pid rather than to the default output file, - ]]>. + cachegrind.out.pid. @@ -732,9 +737,26 @@ way as for C/C++ programs. --pid - Indicates which - cachegrind.out.pid file to - read. Not actually an option -- it is required. + Indicates that profile data should be read from + the file + cachegrind.out.pid. + read. + Note that you must specify either + --pid + or --cachegrind-out-file=filename + exactly once. + + + + + --cachegrind-out-file=filename + Indicates that profile data + should be read from filename. + Note that you must specify either + --pid + or --cachegrind-out-file=filename + exactly once. +