@@ -61,7 +61,7 @@ is unlikely to affect the heap memory usage.</para>
61
61
<para >Then, to gather heap profiling information about the program
62
62
<computeroutput >prog</computeroutput >, type:</para >
63
63
<screen ><![CDATA[
64
- % valgrind --tool=massif prog
64
+ valgrind --tool=massif prog
65
65
]]> </screen >
66
66
67
67
<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
74
74
the ms_print script. If the output file's name is
75
75
<filename >massif.out.12345</filename >, type:</para >
76
76
<screen ><![CDATA[
77
- % ms_print massif.out.12345]]> </screen >
77
+ ms_print massif.out.12345]]> </screen >
78
78
79
79
<para >ms_print will produce (a) a graph showing the memory consumption over
80
80
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>
257
257
258
258
<para >Some more details about the peak: the peak is determined by looking
259
259
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
261
261
so by default Massif records a peak whose size is within 1% of the size of
262
262
the true peak. See the description of the
263
263
<option >--peak-inaccuracy</option > option below for more
@@ -350,12 +350,11 @@ a small amount of information is recorded for each one:</para>
350
350
<option >--heap-admin</option > option.</para >
351
351
352
352
<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 >
359
358
360
359
<listitem ><para >The size of the stack(s). By default, stack profiling is
361
360
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>
377
376
and C++ <function >new</function >. All heap allocations go through these
378
377
functions, and so all 9,000 useful bytes (which is 99.21% of all allocated
379
378
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
381
380
inside <function >main</function >, hence the second line in the tree. The
382
381
<option >-></option > indicates that main (line 20) called
383
382
<function >malloc</function >.</para >
@@ -407,9 +406,9 @@ inside <function>main</function>, hence the second line in the tree. The
407
406
]]> </screen >
408
407
409
408
<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
413
412
different code locations: line 20, which is responsible for 10,000B
414
413
(49.74%); line 5, which is responsible for 8,000B (39.79%); and line 10,
415
414
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>
529
528
530
529
<varlistentry id =" opt.heap-admin" xreflabel =" --heap-admin" >
531
530
<term >
532
- <option ><![CDATA[ --heap-admin=<number > [default: 8] ]]> </option >
531
+ <option ><![CDATA[ --heap-admin=<size > [default: 8] ]]> </option >
533
532
</term >
534
533
<listitem >
535
534
<para >If heap profiling is enabled, gives the number of administrative
536
535
bytes per block to use. This should be an estimate of the average,
537
536
since it may vary. For example, the allocator used by
538
537
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 >
542
541
</listitem >
543
542
</varlistentry >
544
543
@@ -550,9 +549,9 @@ file, which will almost certainly make it unreadable by ms_print.</para>
550
549
<para >Specifies whether stack profiling should be done. This option
551
550
slows Massif down greatly, and so is off by default. Note that Massif
552
551
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 >
556
555
</listitem >
557
556
</varlistentry >
558
557
@@ -580,11 +579,11 @@ file, which will almost certainly make it unreadable by ms_print.</para>
580
579
This option can be specified multiple times on the command line, to
581
580
name multiple functions.</para >
582
581
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:
586
585
<screen ><![CDATA[
587
- --alloc-fn='operator new(unsigned, std::nothrow_t const& )'
586
+ --alloc-fn='operator new(unsigned, std::nothrow_t const&)'
588
587
]]> </screen >
589
588
</para >
590
589
</listitem >
@@ -597,7 +596,7 @@ file, which will almost certainly make it unreadable by ms_print.</para>
597
596
<listitem >
598
597
<para >Any direct heap allocation (i.e. a call to
599
598
<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 >
601
600
option) that occurs in a function specified by this option will be
602
601
ignored. This is mostly useful for testing purposes. This option can
603
602
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>
611
610
<function >realloc</function >.
612
611
</para >
613
612
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.
616
615
</para >
617
616
</listitem >
618
617
</varlistentry >
@@ -623,9 +622,9 @@ file, which will almost certainly make it unreadable by ms_print.</para>
623
622
</term >
624
623
<listitem >
625
624
<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 >
629
628
</listitem >
630
629
</varlistentry >
631
630
@@ -647,7 +646,7 @@ file, which will almost certainly make it unreadable by ms_print.</para>
647
646
648
647
<varlistentry id =" opt.time-unit" xreflabel =" --time-unit" >
649
648
<term >
650
- <option ><![CDATA[ --time-unit=i|ms|B [default: i] ]]> </option >
649
+ <option ><![CDATA[ --time-unit=< i|ms|B> [default: i] ]]> </option >
651
650
</term >
652
651
<listitem >
653
652
<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>
692
691
<option >%p</option > and <option >%q</option > format specifiers can be
693
692
used to embed the process ID and/or the contents of an environment
694
693
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 >.
697
695
</para >
698
696
</listitem >
699
697
</varlistentry >
700
698
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
-
710
699
</variablelist >
711
700
<!-- end of xi:include in the manpage -->
712
701
@@ -731,7 +720,7 @@ file, which will almost certainly make it unreadable by ms_print.</para>
731
720
732
721
<varlistentry >
733
722
<term >
734
- <option ><![CDATA[ -v - -version ]]> </option >
723
+ <option ><![CDATA[ --version ]]> </option >
735
724
</term >
736
725
<listitem >
737
726
<para >Show the version number.</para >
@@ -750,7 +739,7 @@ file, which will almost certainly make it unreadable by ms_print.</para>
750
739
751
740
<varlistentry >
752
741
<term >
753
- <option ><![CDATA[ --x=<n > [default: 72]]]> </option >
742
+ <option ><![CDATA[ --x=<4..1000 > [default: 72]]]> </option >
754
743
</term >
755
744
<listitem >
756
745
<para >Width of the graph, in columns.</para >
@@ -759,7 +748,7 @@ file, which will almost certainly make it unreadable by ms_print.</para>
759
748
760
749
<varlistentry >
761
750
<term >
762
- <option ><![CDATA[ --y=<n > [default: 20] ]]> </option >
751
+ <option ><![CDATA[ --y=<4..1000 > [default: 20] ]]> </option >
763
752
</term >
764
753
<listitem >
765
754
<para >Height of the graph, in rows.</para >
@@ -775,9 +764,9 @@ file, which will almost certainly make it unreadable by ms_print.</para>
775
764
<para >Massif's file format is plain text (i.e. not binary) and deliberately
776
765
easy to read for both humans and machines. Nonetheless, the exact format
777
766
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 >
781
770
782
771
</sect1 >
783
772
0 commit comments