271615 Unhandled instruction "popcnt" on x86
295974 Add SSE4.1 PEXTRD instruction for x86 32 bit
-391311 [Patch] Fix arm64 valgrind tests compilation with clang
+387080 Add --peak-only option to ms_print
+391311 Fix arm64 valgrind tests compilation with clang
519223 Recognize ioctl(UFFDIO_*) operations
519539 Darwin shm_open mode is optional and depends on oflag
519574 valgrind 3.27 "--fair-sched=yes" does not work
a bar consisting of '#' characters. The text at the bottom shows
that snapshot 14 was the peak.</para>
+<para> The option <option>--peak-only</option> limits the output to just the
+peak memory consumption figure and omits the full snapshot graph and
+associated output. This is primarily intended for use in automated
+environments such as CI pipelines, where the peak value is captured by a
+script for comparison against a threshold. The number of bytes printed
+does not use thousands separators to make parsing easier.</para>
+
<para>Massif's determination of when the peak occurred can be wrong, for
two reasons.</para>
</listitem>
</varlistentry>
+ <varlistentry id="opt.peak-only" xreflabel="--peak-only">
+ <term>
+ <option><![CDATA[--peak-only]]></option>
+ </term>
+ <listitem>
+ <para>Print only the peak memory usage figure in bytes, omitting
+ the snapshot graph and all other output.</para>
+ </listitem>
+</varlistentry>
+
<varlistentry id="opt.time-unit" xreflabel="--time-unit">
<term>
<option><![CDATA[--time-unit=<i|ms|B> [default: i] ]]></option>
# Time unit used in profile.
my $time_unit;
+# Indicates whether only peak memory usage should be given.
+my $peak_only = 0;
+
# Threshold dictating what percentage an entry must represent for us to
# bother showing it.
my $threshold = 1.0;
options for the user, with defaults in [ ], are:
-h --help show this message
--version show version
+ --peak-only show only the peak memory usage [no]
--threshold=<m.n> significance threshold, in percent [$threshold]
--x=<4..1000> graph width, in columns [72]
--y=<4..1000> graph height, in rows [20]
if ($arg =~ /^--version$/) {
die("ms_print-$version\n");
+ # --peak-only
+ } elsif ($arg eq '--peak-only') {
+ $peak_only = 1;
# --threshold=X (tolerates a trailing '%')
} elsif ($arg =~ /^--threshold=([\d\.]+)%?$/) {
$threshold = $1;
close(INPUTFILE);
close(TMPFILE);
+ if ($peak_only) {
+ print "Peak memory usage: $peak_mem_total_szB bytes\n";
+ unlink($tmp_file);
+ return;
+ }
+
#-------------------------------------------------------------------------
# Print header.
#-------------------------------------------------------------------------
overloaded-new.stderr.exp overloaded-new.vgtest \
pages_as_heap.stderr.exp pages_as_heap.vgtest \
peak.post.exp peak.stderr.exp peak.vgtest \
+ peak_only.post.exp peak_only.stderr.exp peak_only.vgtest \
peak2.post.exp peak2.stderr.exp peak2.vgtest \
realloc.post.exp realloc.stderr.exp realloc.vgtest \
thresholds_0_0.post.exp \
--- /dev/null
+Peak memory usage: 34704 bytes
--- /dev/null
+prog: peak
+vgopts: --stacks=no --time-unit=B --peak-inaccuracy=0 --heap-admin=128 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
+# Darwin ignore functions, for macOS 10.13
+vgopts: --alloc-fn=_xpc_malloc --ignore-fn=_xpc_dictionary_insert --ignore-fn=map_images_nolock --ignore-fn="allocBuckets(void*, unsigned int)" --ignore-fn="realizeClass(objc_class*)" --ignore-fn=_NXHashRehashToCapacity --ignore-fn=NXCreateHashTableFromZone --ignore-fn=NXCreateMapTableFromZone --ignore-fn=NXHashInsert --ignore-fn=add_class_to_loadable_list --ignore-fn=class_createInstance --ignore-fn=xpc_string_create --alloc-fn=strdup --alloc-fn=_xpc_calloc --ignore-fn=xpc_array_create
+# Darwin ignore functions, for macOS 10.14
+vgopts: --ignore-fn="_NXMapRehash(_NXMapTable*)" --ignore-fn=arc4_init --ignore-fn="realizeClassWithoutSwift(objc_class*)" --ignore-fn="objc_class::setHasCustomRR(bool)" --ignore-fn=_objc_flush_caches --ignore-fn="remapClass(objc_class*)" --ignore-fn="isEqualPrototype(void const*, void const*, void const*)" --ignore-fn="TimeLogger::log(char const*)" --ignore-fn="freeBuckets(NXHashTable*, int)" --ignore-fn=NXHashGet --ignore-fn=call_load_methods --ignore-fn=objc_msgLookup
+# Darwin ignore functions, for macOS 10.15
+vgopts: --ignore-fn=_objc_init --ignore-fn="objc::DenseMap<char const*, objc::detail::DenseSetEmpty, objc::DenseMapValueInfo<objc::detail::DenseSetEmpty>, objc::DenseMapInfo<char const*>, objc::detail::DenseSetPair<char const*> >::grow(unsigned int)" --ignore-fn="realizeClassWithoutSwift(objc_class*, objc_class*)" --ignore-fn="schedule_class_load(objc_class*)" --ignore-fn="objc::SafeRanges::add(unsigned long, unsigned long)" --ignore-fn="getProtocol(char const*)" --ignore-fn="class_setWeakIvarLayout" --ignore-fn="NXMapRemove" --ignore-fn="int sliceRequiresGC<Arch32>(Arch32::mh_t, FileSlice)" --ignore-fn="_mapStrIsEqual(_NXMapTable*, void const*, void const*)" --ignore-fn="_NXMapMember(_NXMapTable*, void const*, void**)" --ignore-fn=NXMapInsert --ignore-fn="objc::DenseMap<objc_class*, objc_class*, objc::DenseMapValueInfo<objc_class*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, objc_class*> >::grow(unsigned int)" --ignore-fn="object_setClass" --ignore-fn="objc_msgSend_stret" --ignore-fn="protocols()" --ignore-fn="copySwiftV1MangledName(char const*, bool)" --ignore-fn="_getObjc2ProtocolList(header_info const*, unsigned long*)"
+# Darwin ignore functions, for macOS 12
+vgopts: --ignore-fn=_xpc_alloc
+# Darwin ignore functions, for macOS 13
+vgopts: --ignore-fn=_xpc_strdup --ignore-fn=_vasprintf --ignore-fn="_fetchInitializingClassList(bool)" --ignore-fn="cache_t::allocateBuckets(unsigned int)"
+post: perl ../../massif/ms_print --peak-only massif.out
+#| ../../tests/filter_addresses | ./filter_ignore_fn
+cleanup: rm massif.out