From ad48dd1cfb43b64d10c97eb668cddfd4d755baf4 Mon Sep 17 00:00:00 2001 From: Rodrigo Reichert Date: Tue, 26 May 2020 11:15:10 +1000 Subject: [PATCH 1/2] added additional massif options --- Valgrind.cmake | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Valgrind.cmake b/Valgrind.cmake index 9de35a3..ead2a19 100644 --- a/Valgrind.cmake +++ b/Valgrind.cmake @@ -109,6 +109,18 @@ # ### MASSIF SPECIFIC OPTIONS: # +# DEPTH maximum depth of the allocation trees recorded for detailed snapshots. +# +# DETAILED_FREQUENCY frequency of detailed snapshots. With value of `1`, +# every snapshot is detailed. +# +# MAX_SNAPSHOTS the maximum number of snapshots recorded. +# +# PEAK_INACCURACY does not necessarily record the actual global memory +# allocation peak; by default it records a peak only when the global memory +# allocation size exceeds the previous peak by at least 1.0%. Setting this value +# to `0.0` gives the true value of the peak. +# # STACKS specifies whether stack profiling should be done. This option slows # Massif down greatly. # @@ -284,7 +296,7 @@ endfunction() function(swift_add_valgrind_massif target) set(argOption STACKS PAGES_AS_HEAP XTREE_MEMORY) - set(argSingle THRESHOLD TIME_UNIT) + set(argSingle DEPTH DETAILED_FREQUENCY MAX_SNAPSHOTS PEAK_INACCURACY THRESHOLD TIME_UNIT) set(argMulti "") _valgrind_arguments_setup(${target} massif "${argOption}" "${argSingle}" "${argMulti}" "${ARGN}") @@ -309,6 +321,22 @@ function(swift_add_valgrind_massif target) list(APPEND valgrind_tool_options --xtree-memory-file=${target}.kcg.%p) endif() + if (x_DEPTH) + list(APPEND valgrind_tool_options "--depth=${x_DEPTH}") + endif() + + if (x_DETAILED_FREQUENCY) + list(APPEND valgrind_tool_options "--detailed-freq=${x_DETAILED_FREQUENCY}") + endif() + + if (x_MAX_SNAPSHOTS) + list(APPEND valgrind_tool_options "--max-snapshots=${x_MAX_SNAPSHOTS}") + endif() + + if (x_PEAK_INACCURACY) + list(APPEND valgrind_tool_options "--peak-inaccuracy=${x_PEAK_INACCURACY}") + endif() + if (x_THRESHOLD) list(APPEND valgrind_tool_options "--threshold=${x_THRESHOLD}") endif() From f4d51413389ead5a17b21c0a3c24b1b4c6fb5cbf Mon Sep 17 00:00:00 2001 From: Rodrigo Reichert Date: Wed, 27 May 2020 13:54:21 +1000 Subject: [PATCH 2/2] added further documentation to single argument parameters --- Valgrind.cmake | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Valgrind.cmake b/Valgrind.cmake index ead2a19..1a86f30 100644 --- a/Valgrind.cmake +++ b/Valgrind.cmake @@ -92,7 +92,8 @@ # ### MEMCHECK SPECIFIC OPTIONS: # -# LEAK_CHECK searches for memory leaks when the application finishes. +# LEAK_CHECK= [default: summary], searches for memory leaks +# when the application finishes. # # * If set to `summary`, it says how many leaks occurred. # * If set to `full` or `yes`, each individual leak will be shown in detail @@ -109,17 +110,19 @@ # ### MASSIF SPECIFIC OPTIONS: # -# DEPTH maximum depth of the allocation trees recorded for detailed snapshots. +# DEPTH= [default: 30], maximum depth of the allocation trees recorded +# for detailed snapshots. # -# DETAILED_FREQUENCY frequency of detailed snapshots. With value of `1`, -# every snapshot is detailed. +# DETAILED_FREQUENCY= [default: 10], frequency of detailed snapshots. +# With value of `1`, every snapshot is detailed. # -# MAX_SNAPSHOTS the maximum number of snapshots recorded. +# MAX_SNAPSHOTS= [default: 100], the maximum number of snapshots +# recorded. # -# PEAK_INACCURACY does not necessarily record the actual global memory -# allocation peak; by default it records a peak only when the global memory -# allocation size exceeds the previous peak by at least 1.0%. Setting this value -# to `0.0` gives the true value of the peak. +# PEAK_INACCURACY= [default: 1.0], Massif does not necessarily record +# the actual global memory allocation peak; by default it records a peak only +# when the global memory allocation size exceeds the previous peak by at least +# 1.0%. Setting this value to `0.0` gives the true value of the peak. # # STACKS specifies whether stack profiling should be done. This option slows # Massif down greatly. @@ -127,16 +130,16 @@ # PAGES_AS_HEAP tells Massif to profile memory at the page level rather than at # the malloc'd block level. # -# TIME_UNIT offers three settings: +# TIME_UNIT=, offers three settings: # # * Instructions executed `i`, which is good for most cases. # * Time `ms`, which is sometimes useful. # * Bytes allocated/deallocated on the heap and/or stack `B`, which is useful # for very short-run programs and for testing purposes. # -# THRESHOLD the significance threshold for heap allocations, as a percentage of -# total memory size. Allocation tree entries that account for less than this -# will be aggregated. +# THRESHOLD= [default: 1.0], the significance threshold for heap +# allocations, as a percentage of total memory size. Allocation tree entries +# that account for less than this will be aggregated. # ### NOTES #