Skip to content

Commit a15b666

Browse files
author
njn
committed
Overhaul Massif's manual, and a few minor related things.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10706 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent a437a60 commit a15b666

File tree

5 files changed

+45
-58
lines changed

5 files changed

+45
-58
lines changed

cachegrind/docs/cg-manual.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,7 @@ configuration, or failing that, via defaults).</para>
441441
<option>%p</option> and <option>%q</option> format specifiers
442442
can be used to embed the process ID and/or the contents of an
443443
environment variable in the name, as is the case for the core
444-
option <option>--log-file</option>. See <link
445-
linkend="manual-core.basicopts">here</link> for details.
444+
option <option><xref linkend="opt.log-file"/></option>.
446445
</para>
447446
</listitem>
448447
</varlistentry>

callgrind/docs/cl-manual.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,7 @@ These options influence the name and format of the profile data files.
534534
<option>%p</option> and <option>%q</option> format specifiers
535535
can be used to embed the process ID and/or the contents of an
536536
environment variable in the name, as is the case for the core
537-
option <option>--log-file</option>. See <link
538-
linkend="manual-core.basicopts">here</link> for details.
537+
option <option><xref linkend="opt.log-file"/></option>.
539538
When multiple dumps are made, the file name
540539
is modified further; see below.</para>
541540
</listitem>

massif/docs/ms-manual.xml

Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ is unlikely to affect the heap memory usage.</para>
6161
<para>Then, to gather heap profiling information about the program
6262
<computeroutput>prog</computeroutput>, type:</para>
6363
<screen><![CDATA[
64-
% valgrind --tool=massif prog
64+
valgrind --tool=massif prog
6565
]]></screen>
6666

6767
<para>The program will execute (slowly). Upon completion, no summary
@@ -74,7 +74,7 @@ data is written to a file. By default, this file is called
7474
the ms_print script. If the output file's name is
7575
<filename>massif.out.12345</filename>, type:</para>
7676
<screen><![CDATA[
77-
% ms_print massif.out.12345]]></screen>
77+
ms_print massif.out.12345]]></screen>
7878

7979
<para>ms_print will produce (a) a graph showing the memory consumption over
8080
the program's execution, and (b) detailed information about the responsible
@@ -257,7 +257,7 @@ deallocate heap memory, Massif will not record a peak snapshot.</para>
257257

258258
<para>Some more details about the peak: the peak is determined by looking
259259
at every allocation, i.e. it is <emphasis>not</emphasis> just the peak among
260-
the regular snapshots. However, recording the true peak is expensive, and
260+
the regular snapshots. However, recording the true peak can be expensive, and
261261
so by default Massif records a peak whose size is within 1% of the size of
262262
the true peak. See the description of the
263263
<option>--peak-inaccuracy</option> option below for more
@@ -350,12 +350,11 @@ a small amount of information is recorded for each one:</para>
350350
<option>--heap-admin</option> option.</para>
351351

352352
<para>Second, allocators often round up the number of bytes asked for to a
353-
larger number. By default, if N bytes are asked for, Massif rounds N up
354-
to the nearest multiple of 8 that is equal to or greater than N. This is
355-
typical behaviour for allocators, and is required to ensure that elements
356-
within the block are suitably aligned. The rounding size can be changed
357-
with the <option>--alignment</option> option, although it
358-
cannot be less than 8, and must be a power of two.</para></listitem>
353+
larger number, usually 8 or 16. This is required to ensure that elements
354+
within the block are suitably aligned. If N bytes are asked for, Massif
355+
rounds N up to the nearest multiple of the value specified by the
356+
<option><xref linkend="opt.alignment"/></option> option.
357+
</para></listitem>
359358

360359
<listitem><para>The size of the stack(s). By default, stack profiling is
361360
off as it slows Massif down greatly. Therefore, the stack column is zero
@@ -377,7 +376,7 @@ indicates all heap allocation functions such as <function>malloc</function>
377376
and C++ <function>new</function>. All heap allocations go through these
378377
functions, and so all 9,000 useful bytes (which is 99.21% of all allocated
379378
bytes) go through them. But how were <function>malloc</function> and new
380-
called? At this point, every allocation so far has been due to line 21
379+
called? At this point, every allocation so far has been due to line 20
381380
inside <function>main</function>, hence the second line in the tree. The
382381
<option>-></option> indicates that main (line 20) called
383382
<function>malloc</function>.</para>
@@ -407,9 +406,9 @@ inside <function>main</function>, hence the second line in the tree. The
407406
]]></screen>
408407

409408
<para>The first four snapshots are similar to the previous ones. But then
410-
the global allocation peak is reached, and a detailed snapshot is taken.
411-
Its allocation tree shows that 20,000B of useful heap memory has been
412-
allocated, and the lines and arrows indicate that this is from three
409+
the global allocation peak is reached, and a detailed snapshot (number 14)
410+
is taken. Its allocation tree shows that 20,000B of useful heap memory has
411+
been allocated, and the lines and arrows indicate that this is from three
413412
different code locations: line 20, which is responsible for 10,000B
414413
(49.74%); line 5, which is responsible for 8,000B (39.79%); and line 10,
415414
which is responsible for 2,000B (9.95%).</para>
@@ -529,16 +528,16 @@ file, which will almost certainly make it unreadable by ms_print.</para>
529528

530529
<varlistentry id="opt.heap-admin" xreflabel="--heap-admin">
531530
<term>
532-
<option><![CDATA[--heap-admin=<number> [default: 8] ]]></option>
531+
<option><![CDATA[--heap-admin=<size> [default: 8] ]]></option>
533532
</term>
534533
<listitem>
535534
<para>If heap profiling is enabled, gives the number of administrative
536535
bytes per block to use. This should be an estimate of the average,
537536
since it may vary. For example, the allocator used by
538537
glibc on Linux requires somewhere between 4 to
539-
15 bytes per block, depending on various factors. It also requires
540-
admin space for freed blocks, although Massif does not account
541-
for this.</para>
538+
15 bytes per block, depending on various factors. That allocator also
539+
requires admin space for freed blocks, but Massif cannot
540+
account for this.</para>
542541
</listitem>
543542
</varlistentry>
544543

@@ -550,9 +549,9 @@ file, which will almost certainly make it unreadable by ms_print.</para>
550549
<para>Specifies whether stack profiling should be done. This option
551550
slows Massif down greatly, and so is off by default. Note that Massif
552551
assumes that the main stack has size zero at start-up. This is not
553-
true, but measuring the actual stack size is not easy, and it reflects
554-
the size of the part of the main stack that a user program actually
555-
has control over.</para>
552+
true, but doing otherwise accurately is difficult. Furthermore,
553+
starting at zero better indicates the size of the part of the main
554+
stack that a user program actually has control over.</para>
556555
</listitem>
557556
</varlistentry>
558557

@@ -580,11 +579,11 @@ file, which will almost certainly make it unreadable by ms_print.</para>
580579
This option can be specified multiple times on the command line, to
581580
name multiple functions.</para>
582581

583-
<para>Note that overloaded C++ names must be written in full. Single
584-
quotes may be necessary to prevent the shell from breaking them up.
585-
For example:
582+
<para>Note that C++ names are demangled. Note also that overloaded
583+
C++ names must be written in full. Single quotes may be necessary to
584+
prevent the shell from breaking them up. For example:
586585
<screen><![CDATA[
587-
--alloc-fn='operator new(unsigned, std::nothrow_t const&amp;)'
586+
--alloc-fn='operator new(unsigned, std::nothrow_t const&)'
588587
]]></screen>
589588
</para>
590589
</listitem>
@@ -597,7 +596,7 @@ file, which will almost certainly make it unreadable by ms_print.</para>
597596
<listitem>
598597
<para>Any direct heap allocation (i.e. a call to
599598
<function>malloc</function>, <function>new</function>, etc, or a call
600-
to a function name in a <option>--alloc-fn</option>
599+
to a function named by an <option>--alloc-fn</option>
601600
option) that occurs in a function specified by this option will be
602601
ignored. This is mostly useful for testing purposes. This option can
603602
be specified multiple times on the command line, to name multiple
@@ -611,8 +610,8 @@ file, which will almost certainly make it unreadable by ms_print.</para>
611610
<function>realloc</function>.
612611
</para>
613612

614-
<para>Note that overloaded C++ names must be written in full, as for
615-
<option>--alloc-fn</option> above.
613+
<para>The rules for writing C++ function names are the same as
614+
for <option>--alloc-fn</option> above.
616615
</para>
617616
</listitem>
618617
</varlistentry>
@@ -623,9 +622,9 @@ file, which will almost certainly make it unreadable by ms_print.</para>
623622
</term>
624623
<listitem>
625624
<para>The significance threshold for heap allocations, as a
626-
percentage. Allocation tree entries that account for less than this
627-
will be aggregated. Note that this should be specified in tandem with
628-
ms_print's option of the same name.</para>
625+
percentage of total memory size. Allocation tree entries that account
626+
for less than this will be aggregated. Note that this should be
627+
specified in tandem with ms_print's option of the same name.</para>
629628
</listitem>
630629
</varlistentry>
631630

@@ -647,7 +646,7 @@ file, which will almost certainly make it unreadable by ms_print.</para>
647646

648647
<varlistentry id="opt.time-unit" xreflabel="--time-unit">
649648
<term>
650-
<option><![CDATA[--time-unit=i|ms|B [default: i] ]]></option>
649+
<option><![CDATA[--time-unit=<i|ms|B> [default: i] ]]></option>
651650
</term>
652651
<listitem>
653652
<para>The time unit used for the profiling. There are three
@@ -692,21 +691,11 @@ file, which will almost certainly make it unreadable by ms_print.</para>
692691
<option>%p</option> and <option>%q</option> format specifiers can be
693692
used to embed the process ID and/or the contents of an environment
694693
variable in the name, as is the case for the core option
695-
<option>--log-file</option>. See <xref
696-
linkend="manual-core.basicopts"/> for details.
694+
<option><xref linkend="opt.log-file"/></option>.
697695
</para>
698696
</listitem>
699697
</varlistentry>
700698

701-
<varlistentry id="opt.alignment" xreflabel="--alignment">
702-
<term>
703-
<option><![CDATA[--alignment=<n> [default: 1.0] ]]></option>
704-
</term>
705-
<listitem>
706-
<para>The minimum alignment (and thus size) of heap blocks.</para>
707-
</listitem>
708-
</varlistentry>
709-
710699
</variablelist>
711700
<!-- end of xi:include in the manpage -->
712701

@@ -731,7 +720,7 @@ file, which will almost certainly make it unreadable by ms_print.</para>
731720

732721
<varlistentry>
733722
<term>
734-
<option><![CDATA[-v --version ]]></option>
723+
<option><![CDATA[--version ]]></option>
735724
</term>
736725
<listitem>
737726
<para>Show the version number.</para>
@@ -750,7 +739,7 @@ file, which will almost certainly make it unreadable by ms_print.</para>
750739

751740
<varlistentry>
752741
<term>
753-
<option><![CDATA[--x=<n> [default: 72]]]></option>
742+
<option><![CDATA[--x=<4..1000> [default: 72]]]></option>
754743
</term>
755744
<listitem>
756745
<para>Width of the graph, in columns.</para>
@@ -759,7 +748,7 @@ file, which will almost certainly make it unreadable by ms_print.</para>
759748

760749
<varlistentry>
761750
<term>
762-
<option><![CDATA[--y=<n> [default: 20] ]]></option>
751+
<option><![CDATA[--y=<4..1000> [default: 20] ]]></option>
763752
</term>
764753
<listitem>
765754
<para>Height of the graph, in rows.</para>
@@ -775,9 +764,9 @@ file, which will almost certainly make it unreadable by ms_print.</para>
775764
<para>Massif's file format is plain text (i.e. not binary) and deliberately
776765
easy to read for both humans and machines. Nonetheless, the exact format
777766
is not described here. This is because the format is currently very
778-
Massif-specific. We plan to make the format more general, and thus suitable
779-
for possible use with other tools. Once this has been done, the format will
780-
be documented here.</para>
767+
Massif-specific. In the future we hope to make the format more general, and
768+
thus suitable for possible use with other tools. Once this has been done,
769+
the format will be documented here.</para>
781770

782771
</sect1>
783772

massif/ms_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
// identified? [hmm, could make getting the name of alloc-fns more
5050
// difficult] [could dump full names to file, truncate in ms_print]
5151
// - make --show-below-main=no work
52-
// - Options like --alloc-fn='operator new(unsigned, std::nothrow_t const&amp;)'
52+
// - Options like --alloc-fn='operator new(unsigned, std::nothrow_t const&)'
5353
// don't work in a .valgrindrc file or in $VALGRIND_OPTS.
5454
// m_commandline.c:add_args_from_string() needs to respect single quotes.
5555
// - With --stack=yes, want to add a stack trace for detailed snapshots so
@@ -446,7 +446,7 @@ static void ms_print_usage(void)
446446
{
447447
VG_(printf)(
448448
" --heap=no|yes profile heap blocks [yes]\n"
449-
" --heap-admin=<number> average admin bytes per heap block;\n"
449+
" --heap-admin=<size> average admin bytes per heap block;\n"
450450
" ignored if --heap=no [8]\n"
451451
" --stacks=no|yes profile stack(s) [no]\n"
452452
" --depth=<number> depth of contexts [30]\n"

massif/ms_print.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ usage: ms_print [options] <file>
6666

6767
options for the user, with defaults in [ ], are:
6868
-h --help show this message
69-
-v --version show version
69+
--version show version
7070
--threshold=<n.n> significance threshold, in percent [$threshold]
71-
--x=<n> graph width, in columns; min=4, max=1000 [72]
72-
--y=<n> graph height, in rows; min=4, max=1000 [20]
71+
--x=<4..1000> graph width, in columns [72]
72+
--y=<4..1000> graph height, in rows [20]
7373

7474
ms_print is Copyright (C) 2007-2007 Nicholas Nethercote.
7575
and licensed under the GNU General Public License, version 2.
@@ -107,7 +107,7 @@ sub process_cmd_line()
107107
if ($arg =~ /^-/) {
108108

109109
# --version
110-
if ($arg =~ /^-v$|^--version$/) {
110+
if ($arg =~ /^--version$/) {
111111
die("ms_print-$version\n");
112112

113113
# --threshold=X (tolerates a trailing '%')

0 commit comments

Comments
 (0)