diff --git a/core/private/common_config.cpp b/core/private/common_config.cpp index 055b8da..e5649d8 100644 --- a/core/private/common_config.cpp +++ b/core/private/common_config.cpp @@ -1,35 +1,41 @@ /* This file is part of KDevelop Copyright 2017 Anton Anikin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "common_config.h" #include "globalsettings.h" namespace Valgrind { CommonConfig::CommonConfig() : Config(QStringLiteral("Valgrind")) { - addCmdItemInt(QStringLiteral("numCallers"), m_numCallers, 12, QStringLiteral("num-callers")); - addCmdItemInt(QStringLiteral("maxStackframe"), m_maxStackframe, 2000000, QStringLiteral("max-stackframe")); + auto itemInt = addCmdItemInt(QStringLiteral("numCallers"), m_numCallers, 12, QStringLiteral("num-callers")); + itemInt->setMinValue(1); + itemInt->setMaxValue(500); + + itemInt = addCmdItemInt(QStringLiteral("maxStackframe"), m_maxStackframe, 2000000, QStringLiteral("max-stackframe")); + itemInt->setMinValue(1); + itemInt->setMaxValue(200000000); + addCmdItemBool(QStringLiteral("errorLimit"), m_errorLimit, true, QStringLiteral("error-limit")); } } diff --git a/core/private/common_configpage.ui b/core/private/common_configpage.ui index 230944d..ced5e13 100644 --- a/core/private/common_configpage.ui +++ b/core/private/common_configpage.ui @@ -1,133 +1,118 @@ Valgrind::CommonConfigPage 0 0 512 343 - - - Display stac&k to depth: kcfg_numCallers <html><head/><body><p>Specifies the maximum number of entries shown in stack traces that identify program locations. Note that errors are commoned up using only the top four function locations (the place in the current function, and that of its three immediate callers). So this doesn't affect the total number of errors reported.</p><p>The maximum value for this is 500. Note that higher settings will make Valgrind run a bit more slowly and take a bit more memory, but can be useful when working with programs with deeply-nested call chains.</p></body></html> - - 500 - - - 12 - Maximum size of a stack frame: kcfg_maxStackframe <html><head/><body><p>The maximum size of a stack frame. If the stack pointer moves by more than this amount then Valgrind will assume that the program is switching to a different stack.</p><p>You may need to use this option if your program has large stack-allocated arrays. Valgrind keeps track of your program's stack pointer. If it changes by more than the threshold amount, Valgrind assumes your program is switching to a different stack, and Memcheck behaves differently than it would for a stack pointer change smaller than the threshold. Usually this heuristic works well. However, if your program allocates large structures on the stack, this heuristic will be fooled, and Memcheck will subsequently report large numbers of invalid stack accesses. This option allows you to change the threshold to a different value.</p><p>You should only consider use of this option if Valgrind's debug output directs you to do so. In that case it will tell you the new threshold you should specify.</p><p>In general, allocating large structures on the stack is a bad idea, because you can easily run out of stack space, especially on systems with limited memory or which expect to support large numbers of threads each with a small stack, and also because the error checking performed by Memcheck is more effective for heap-allocated data than for stack-allocated data. If you have to use this option, you may wish to consider rewriting your code to allocate on the heap rather than on the stack.</p></body></html> - - 200000000 - - - 2000000 - &Extra parameters: kcfg_extraArgs true Qt::Horizontal <html><head/><body><p>When enabled, Valgrind stops reporting errors after 10,000,000 in total, or 1,000 different ones, have been seen. This is to stop the error tracking machinery from becoming a huge performance overhead in programs with many errors.</p></body></html> Limit errors if too many true Qt::Vertical 20 40 kcfg_numCallers kcfg_maxStackframe kcfg_extraArgs kcfg_errorLimit diff --git a/tools/drd/drd_config.cpp b/tools/drd/drd_config.cpp index b6ac66e..4f19138 100644 --- a/tools/drd/drd_config.cpp +++ b/tools/drd/drd_config.cpp @@ -1,52 +1,57 @@ /* This file is part of KDevelop Copyright 2017 Anton Anikin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "drd_config.h" #include "drd_tool.h" namespace Valgrind { DrdConfig::DrdConfig() : XmlConfig(DrdTool::self()->id()) { addCmdItemBool(QStringLiteral("checkStackVar"), m_checkStackVar, false, QStringLiteral("check-stack-var")); addCmdItemBool(QStringLiteral("firstRaceOnly"), m_firstRaceOnly, false, QStringLiteral("first-race-only")); addCmdItemBool(QStringLiteral("freeIsWrite"), m_freeIsWrite, false, QStringLiteral("free-is-write")); addCmdItemBool(QStringLiteral("reportSignalUnlocked"), m_reportSignalUnlocked, true, QStringLiteral("report-signal-unlocked")); addCmdItemBool(QStringLiteral("segmentMerging"), m_segmentMerging, true, QStringLiteral("segment-merging")); addCmdItemBool(QStringLiteral("showConflSeg"), m_showConflSeg, true, QStringLiteral("show-confl-seg")); addCmdItemBool(QStringLiteral("showStackUsage"), m_showStackUsage, false, QStringLiteral("show-stack-usage")); addCmdItemBool(QStringLiteral("ignoreThreadCreation"), m_ignoreThreadCreation, false, QStringLiteral("ignore-thread-creation")); addCmdItemBool(QStringLiteral("traceAlloc"), m_traceAlloc, false, QStringLiteral("trace-alloc")); addCmdItemBool(QStringLiteral("traceBarrier"), m_traceBarrier, false, QStringLiteral("trace-barrier")); addCmdItemBool(QStringLiteral("traceCond"), m_traceCond, false, QStringLiteral("trace-cond")); addCmdItemBool(QStringLiteral("traceForkJoin"), m_traceForkJoin, false, QStringLiteral("trace-fork-join")); addCmdItemBool(QStringLiteral("traceHb"), m_traceHb, false, QStringLiteral("trace-hb")); addCmdItemBool(QStringLiteral("traceMutex"), m_traceMutex, false, QStringLiteral("trace-mutex")); addCmdItemBool(QStringLiteral("traceRwlock"), m_traceRwlock, false, QStringLiteral("trace-rwlock")); addCmdItemBool(QStringLiteral("traceSemaphore"), m_traceSemaphore, false, QStringLiteral("trace-semaphore")); - addCmdItemInt(QStringLiteral("joinListVol"), m_joinListVol, 10, QStringLiteral("join-list-vol")); - addCmdItemInt(QStringLiteral("segmentMergingInterval"), m_segmentMergingInterval, 10, QStringLiteral("segment-merging-interval")); + auto itemInt = addCmdItemInt(QStringLiteral("joinListVol"), m_joinListVol, 10, QStringLiteral("join-list-vol")); + itemInt->setMinValue(1); + itemInt->setMaxValue(1000); + + itemInt = addCmdItemInt(QStringLiteral("segmentMergingInterval"), m_segmentMergingInterval, 10, QStringLiteral("segment-merging-interval")); + itemInt->setMinValue(1); + itemInt->setMaxValue(1000); } } diff --git a/tools/drd/drd_configpage.ui b/tools/drd/drd_configpage.ui index 62d37f2..ad9234b 100644 --- a/tools/drd/drd_configpage.ui +++ b/tools/drd/drd_configpage.ui @@ -1,350 +1,332 @@ Valgrind::DrdConfigPage 0 0 676 558 - - - Joined threads memory access list volume: kcfg_joinListVol <html><head/><body><p>Data races that occur between a statement at the end of one thread and another thread can be missed if memory access information is discarded immediately after a thread has been joined. This option allows to specify for how many joined threads memory access information should be retained.</p></body></html> - - 1 - - - 1000 - - - 10 - Segment merging interval: <html><head/><body><p>Perform segment merging only after the specified number of new segments have been created. This is an advanced configuration option that allows to choose whether to minimize DRD's memory usage by choosing a low value or to let DRD run faster by choosing a slightly higher value. The optimal value for this parameter depends on the program being analyzed. The default value works well for most programs.</p></body></html> - - 1000000 - - - 10 - Extra parameters: kcfg_extraArgs true 0 Common options <html><head/><body><p>Controls whether DRD detects data races on stack variables. Verifying stack variables is disabled by default because most programs do not share stack variables over threads.</p></body></html> Detect data races on stack variables <html><head/><body><p>Whether to report only the first data race that has been detected on a memory location or all data races that have been detected on a memory location.</p></body></html> Report only the first data race true <html><head/><body><p>Whether to report races between accessing memory and freeing memory. Enabling this option may cause DRD to run slightly slower. Notes:</p><p>Don't enable this option when using custom memory allocators that use the <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">VG_USERREQ__MALLOCLIKE_BLOCK</span> and <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">VG_USERREQ__FREELIKE_BLOCK</span> because that would result in false positives. </p><p>Don't enable this option when using reference-counted objects because that will result in false positives, even when that code has been annotated properly with <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">ANNOTATE_HAPPENS_BEFORE</span> and <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">ANNOTATE_HAPPENS_AFTER</span>. See e.g. the output of the following command for an example: <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">valgrind --tool=drd --free-is-write=yes drd/tests/annotate_smart_pointer</span>.</p></body></html> Report races between accessing and freeing memory <html><head/><body><p>Whether to report calls to <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">pthread_cond_signal</span> and <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">pthread_cond_broadcast</span> where the mutex associated with the signal through <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">pthread_cond_wait</span> or <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">pthread_cond_timed_wait</span> is not locked at the time the signal is sent. Sending a signal without holding a lock on the associated mutex is a common programming error which can cause subtle race conditions and unpredictable behavior. There exist some uncommon synchronization patterns however where it is safe to send a signal without holding a lock on the associated mutex.</p></body></html> Report calls to unlocked signals <html><head/><body><p>Controls segment merging. Segment merging is an algorithm to limit memory usage of the data race detection algorithm. Disabling segment merging may improve the accuracy of the so-called 'other segments' displayed in race reports but can also trigger an out of memory error.</p></body></html> Segment merging <html><head/><body><p>Show conflicting segments in race reports. Since this information can help to find the cause of a data race, this option is enabled by default. Disabling this option makes the output of DRD more compact.</p></body></html> Show conflicting segments <html><head/><body><p>Print stack usage at thread exit time. When a program creates a large number of threads it becomes important to limit the amount of virtual memory allocated for thread stacks. This option makes it possible to observe how much stack memory has been used by each thread of the client program.</p><p>Note: the DRD tool itself allocates some temporary data on the client thread stack. The space necessary for this temporary data must be allocated by the client program when it allocates stack memory, but is not included in stack usage reported by DRD.</p></body></html> Show stack usage <html><head/><body><p>Controls whether all activities during thread creation should be ignored. By default enabled only on Solaris. Solaris provides higher throughput, parallelism and scalability than other operating systems, at the cost of more fine-grained locking activity. This means for example that when a thread is created under glibc, just one big lock is used for all thread setup. Solaris libc uses several fine-grained locks and the creator thread resumes its activities as soon as possible, leaving for example stack and TLS setup sequence to the created thread. This situation confuses DRD as it assumes there is some false ordering in place between creator and created thread; and therefore many types of race conditions in the application would not be reported. To prevent such false ordering, this command line option is set to <span style=" font-family:'Monospace';">yes</span> by default on Solaris. All activity (loads, stores, client requests) is therefore ignored during:</p><p>* pthread_create() call in the creator thread </p><p>* thread creation phase (stack and TLS setup) in the created thread</p></body></html> Ignore thread creation Qt::Horizontal Show stack frame instruction pointer value Qt::Vertical 20 0 Trace options <html><head/><body><p>Trace all memory allocations and deallocations. May produce a huge amount of output.</p></body></html> Trace memory allocations/deallocations <html><head/><body><p>Trace all barrier activity.</p></body></html> Trace barrier activity <html><head/><body><p>Trace all condition variable activity.</p></body></html> Trace condition variable activity <html><head/><body><p>Trace all thread creation and all thread termination events.</p></body></html> Trace thread creation/termination events <html><head/><body><p>Trace execution of the <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">ANNOTATE_HAPPENS_BEFORE()</span>, <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">ANNOTATE_HAPPENS_AFTER()</span> and <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">ANNOTATE_HAPPENS_DONE()</span> client requests.</p></body></html> Trace execution of "ANNOTATE_HAPPENS" requests <html><head/><body><p>Trace all mutex activity.</p></body></html> Trace mutex activity <html><head/><body><p>Trace all reader-writer lock activity.</p></body></html> Trace reader-writer lock activity <html><head/><body><p>Trace all semaphore activity.</p></body></html> Trace semaphore activity Qt::Vertical 20 0 Qt::Vertical 20 52 kcfg_joinListVol kcfg_segmentMergingInterval kcfg_extraArgs tabWidget kcfg_checkStackVar kcfg_firstRaceOnly kcfg_freeIsWrite kcfg_reportSignalUnlocked kcfg_segmentMerging kcfg_showConflSeg kcfg_showStackUsage kcfg_ignoreThreadCreation kcfg_showInstructionPointer kcfg_traceAlloc kcfg_traceBarrier kcfg_traceCond kcfg_traceForkJoin kcfg_traceHb kcfg_traceMutex kcfg_traceRwlock kcfg_traceSemaphore diff --git a/tools/helgrind/helgrind_config.cpp b/tools/helgrind/helgrind_config.cpp index d8a0162..f6a8222 100644 --- a/tools/helgrind/helgrind_config.cpp +++ b/tools/helgrind/helgrind_config.cpp @@ -1,40 +1,42 @@ /* This file is part of KDevelop Copyright 2017 Anton Anikin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "helgrind_config.h" #include "helgrind_tool.h" namespace Valgrind { HelgrindConfig::HelgrindConfig() : XmlConfig(HelgrindTool::self()->id()) { addCmdItemString(QStringLiteral("historyLevel"), m_historyLevel, QStringLiteral("full"), QStringLiteral("history-level")); - addCmdItemInt(QStringLiteral("conflictCacheSize"), m_conflictCacheSize, 1000000, QStringLiteral("conflict-cache-size")); + auto itemInt = addCmdItemInt(QStringLiteral("conflictCacheSize"), m_conflictCacheSize, 1000000, QStringLiteral("conflict-cache-size")); + itemInt->setMinValue(10000); + itemInt->setMaxValue(30000000); addCmdItemBool(QStringLiteral("trackLockorders"), m_trackLockorders, true, QStringLiteral("track-lockorders")); addCmdItemBool(QStringLiteral("checkStackRefs"), m_checkStackRefs, true, QStringLiteral("check-stack-refs")); addCmdItemBool(QStringLiteral("ignoreThreadCreation"), m_ignoreThreadCreation, false, QStringLiteral("ignore-thread-creation")); addCmdItemBool(QStringLiteral("freeIsWrite"), m_freeIsWrite, false, QStringLiteral("free-is-write")); } } diff --git a/tools/helgrind/helgrind_configpage.ui b/tools/helgrind/helgrind_configpage.ui index ea64793..895f682 100644 --- a/tools/helgrind/helgrind_configpage.ui +++ b/tools/helgrind/helgrind_configpage.ui @@ -1,183 +1,173 @@ Valgrind::HelgrindConfigPage 0 0 469 380 - - - History level: Conflict cache size: kcfg_conflictCacheSize <html><head/><body><p>This flag only has any effect at <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">--history-level=full</span>.</p><p>Information about &quot;old&quot; conflicting accesses is stored in a cache of limited size, with LRU-style management. This is necessary because it isn't practical to store a stack trace for every single memory access made by the program. Historical information on not recently accessed locations is periodically discarded, to free up space in the cache.</p><p>This option controls the size of the cache, in terms of the number of different memory addresses for which conflicting access information is stored. If you find that Helgrind is showing race errors with only one stack instead of the expected two stacks, try increasing this value.</p><p>The minimum value is 10,000 and the maximum is 30,000,000 (thirty times the default value). Increasing the value by 1 increases Helgrind's memory requirement by very roughly 100 bytes, so the maximum value will easily eat up three extra gigabytes or so of memory.</p></body></html> - - 10000 - - - 30000000 - - - 1000000 - Extra parameters: kcfg_extraArgs true Qt::Horizontal true <html><head/><body><p>When enabled (the default), Helgrind performs lock order consistency checking. For some buggy programs, the large number of lock order errors reported can become annoying, particularly if you're only interested in race errors. You may therefore find it helpful to disable lock order checking.</p></body></html> Track lock orders <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:14pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">By default Helgrind checks all data memory accesses made by your program. This flag enables you to skip checking for accesses to thread stacks (local variables). This can improve performance, but comes at the cost of missing races on stack-allocated data.</p></body></html> Check stack refs <html><head/><body><p>Controls whether all activities during thread creation should be ignored. By default enabled only on Solaris. Solaris provides higher throughput, parallelism and scalability than other operating systems, at the cost of more fine-grained locking activity. This means for example that when a thread is created under glibc, just one big lock is used for all thread setup. Solaris libc uses several fine-grained locks and the creator thread resumes its activities as soon as possible, leaving for example stack and TLS setup sequence to the created thread. This situation confuses Helgrind as it assumes there is some false ordering in place between creator and created thread; and therefore many types of race conditions in the application would not be reported. To prevent such false ordering, this command line option is set to yes by default on Solaris. All activity (loads, stores, client requests) is therefore ignored during:</p><p>* pthread_create() call in the creator thread</p><p>* thread creation phase (stack and TLS setup) in the created thread</p><p>Also new memory allocated during thread creation is untracked, that is race reporting is suppressed there. DRD does the same thing implicitly. This is necessary because Solaris libc caches many objects and reuses them for different threads and that confuses Helgrind.</p></body></html> Ignore thread creation true <html><head/><body><p>When enabled (not the default), Helgrind treats freeing of heap memory as if the memory was written immediately before the free. This exposes races where memory is referenced by one thread, and freed by another, but there is no observable synchronization event to ensure that the reference happens before the free.</p><p>This functionality is new in Valgrind 3.7.0, and is regarded as experimental. It is not enabled by default because its interaction with custom memory allocators is not well understood at present. User feedback is welcomed.</p></body></html> Free is write (experimental) Qt::Horizontal Show stack frame instruction pointer value Qt::Vertical 20 71 Valgrind::ComboBox QComboBox
core/widgets/combobox.h
+ kcfg_historyLevel kcfg_conflictCacheSize kcfg_extraArgs kcfg_trackLockorders kcfg_checkStackRefs kcfg_ignoreThreadCreation kcfg_freeIsWrite + kcfg_showInstructionPointer
diff --git a/tools/massif/massif_config.cpp b/tools/massif/massif_config.cpp index 5f3a92d..2c07aea 100644 --- a/tools/massif/massif_config.cpp +++ b/tools/massif/massif_config.cpp @@ -1,51 +1,65 @@ /* This file is part of KDevelop Copyright 2017 Anton Anikin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "massif_config.h" #include "globalsettings.h" #include "massif_tool.h" namespace Valgrind { MassifConfig::MassifConfig() : Config(MassifTool::self()->id()) { - addCmdItemInt(QStringLiteral("snapshotTreeDepth"), m_snapshotTreeDepth, 30, QStringLiteral("depth")); - addCmdItemInt(QStringLiteral("threshold"), m_threshold, 1, QStringLiteral("threshold")); - addCmdItemInt(QStringLiteral("peakInaccuracy"), m_peakInaccuracy, 1, QStringLiteral("peak-inaccuracy")); - addCmdItemInt(QStringLiteral("maximumSnapshots"), m_maximumSnapshots, 100, QStringLiteral("max-snapshots")); - addCmdItemInt(QStringLiteral("detailedSnapshotsFrequency"), m_detailedSnapshotsFrequency, 10, QStringLiteral("detailed-freq")); + auto itemInt = addCmdItemInt(QStringLiteral("snapshotTreeDepth"), m_snapshotTreeDepth, 30, QStringLiteral("depth")); + itemInt->setMinValue(1); + itemInt->setMaxValue(3000); + + auto itemDouble = addCmdItemDouble(QStringLiteral("threshold"), m_threshold, 1.0, QStringLiteral("threshold")); + itemDouble->setMinValue(1.0); + itemDouble->setMaxValue(100.0); + + itemDouble = addCmdItemDouble(QStringLiteral("peakInaccuracy"), m_peakInaccuracy, 1.0, QStringLiteral("peak-inaccuracy")); + itemDouble->setMinValue(0.0); + itemDouble->setMaxValue(100.0); + + itemInt = addCmdItemInt(QStringLiteral("maximumSnapshots"), m_maximumSnapshots, 100, QStringLiteral("max-snapshots")); + itemInt->setMinValue(1); + itemInt->setMaxValue(10000); + + itemInt = addCmdItemInt(QStringLiteral("detailedSnapshotsFrequency"), m_detailedSnapshotsFrequency, 10, QStringLiteral("detailed-freq")); + itemInt->setMinValue(1); + itemInt->setMaxValue(10000); addCmdItemString(QStringLiteral("timeUnit"), m_timeUnit, QStringLiteral("i"), QStringLiteral("time-unit")); addCmdItemBool(QStringLiteral("profileHeap"), m_profileHeap, true, QStringLiteral("heap")); addCmdItemBool(QStringLiteral("profileStack"), m_profileStack, false, QStringLiteral("stacks")); addCmdItemBool(QStringLiteral("pagesAsHeap"), m_pagesAsHeap, false, QStringLiteral("pages-as-heap")); addItemBool(QStringLiteral("launchVisualizer"), m_launchVisualizer, false); } QString MassifConfig::visualizerExecutablePath() { return KDevelop::Path(GlobalSettings::massifVisualizerExecutablePath()).toLocalFile(); } } diff --git a/tools/massif/massif_config.h b/tools/massif/massif_config.h index 80ebfd8..ec5d17f 100644 --- a/tools/massif/massif_config.h +++ b/tools/massif/massif_config.h @@ -1,56 +1,57 @@ /* This file is part of KDevelop Copyright 2017 Anton Anikin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #pragma once #include "config.h" namespace Valgrind { class MassifConfig : public Config { public: MassifConfig(); ~MassifConfig() override = default; static QString visualizerExecutablePath(); bool launchVisualizer() const { return m_launchVisualizer; } private: int m_snapshotTreeDepth; - int m_threshold; - int m_peakInaccuracy; int m_maximumSnapshots; int m_detailedSnapshotsFrequency; + double m_threshold; + double m_peakInaccuracy; + QString m_timeUnit; bool m_profileHeap; bool m_profileStack; bool m_pagesAsHeap; bool m_launchVisualizer; }; } diff --git a/tools/massif/massif_configpage.ui b/tools/massif/massif_configpage.ui index 2dd814f..09322a1 100644 --- a/tools/massif/massif_configpage.ui +++ b/tools/massif/massif_configpage.ui @@ -1,283 +1,263 @@ Valgrind::MassifConfigPage 0 0 465 582 Time unit: Snapshot tree depth: kcfg_snapshotTreeDepth <html><head/><body><p>Maximum depth of the allocation trees recorded for detailed snapshots. Increasing it will make Massif run somewhat more slowly, use more memory, and produce bigger output files.</p></body></html> - - 2000000000 - - - 30 - Threshold: kcfg_threshold - - - - <html><head/><body><p>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. Note that this should be specified in tandem with ms_print's option of the same name.</p></body></html> - - - % - - - 1 - - - Peak inaccuracy: kcfg_peakInaccuracy - - - - <html><head/><body><p>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%. This is because there can be many local allocation peaks along the way, and doing a detailed snapshot for every one would be expensive and wasteful, as all but one of them will be later discarded. This inaccuracy can be changed (even to 0.0%) via this option, but Massif will run drastically slower as the number approaches zero.</p></body></html> - - - % - - - 100 - - - 1 - - - Maximum snapshots: kcfg_maximumSnapshots <html><head/><body><p>The maximum number of snapshots recorded. If set to N, for all programs except very short-running ones, the final number of snapshots will be between N/2 and N.</p></body></html> - - 2000000000 - - - 100 - Detailed snapshot frequency: kcfg_detailedSnapshotsFrequency <html><head/><body><p>Frequency of detailed snapshots. With <span style=" font-family:'Monospace'; font-weight:600; font-style:italic;">--detailed-freq=1</span>, every snapshot is detailed.</p></body></html> - - 2000000000 - - - 10 - E&xtra parameters: kcfg_extraArgs true + + + + <html><head/><body><p>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. Note that this should be specified in tandem with ms_print's option of the same name.</p></body></html> + + + % + + + 1 + + + + + + + <html><head/><body><p>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%. This is because there can be many local allocation peaks along the way, and doing a detailed snapshot for every one would be expensive and wasteful, as all but one of them will be later discarded. This inaccuracy can be changed (even to 0.0%) via this option, but Massif will run drastically slower as the number approaches zero.</p></body></html> + + + % + + + 1 + + + Qt::Horizontal <html><head/><body><p>Specifies whether heap profiling should be done.</p></body></html> Profile heap true <html><head/><body><p>Specifies whether stack profiling should be done. This option slows Massif down greatly, and so is off by default. Note that Massif assumes that the main stack has size zero at start-up. This is not true, but doing otherwise accurately is difficult. Furthermore, starting at zero better indicates the size of the part of the main stack that a user program actually has control over.</p></body></html> Profile stack (slows profiling down greatly) <html><head/><body><p>Tells Massif to profile memory at the page level rather than at the malloc'd block level.</p></body></html> Pages as heap <html><head/><body><p>&quot;Pages as heap&quot; cannot be used together with &quot;Profile stack&quot;.</p></body></html> true false KMessageWidget::Error Qt::Horizontal Launch Massif Visualizer after analysis finish Qt::Vertical 20 40 KMessageWidget QFrame
kmessagewidget.h
Valgrind::ComboBox QComboBox
core/widgets/combobox.h
+ kcfg_timeUnit kcfg_snapshotTreeDepth kcfg_threshold kcfg_peakInaccuracy kcfg_maximumSnapshots kcfg_detailedSnapshotsFrequency kcfg_extraArgs kcfg_profileHeap kcfg_profileStack kcfg_pagesAsHeap kcfg_launchVisualizer
diff --git a/tools/memcheck/memcheck_config.cpp b/tools/memcheck/memcheck_config.cpp index 0d4f98d..002cfd9 100644 --- a/tools/memcheck/memcheck_config.cpp +++ b/tools/memcheck/memcheck_config.cpp @@ -1,50 +1,50 @@ /* This file is part of KDevelop Copyright 2017 Anton Anikin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "memcheck_config.h" #include "memcheck_tool.h" namespace Valgrind { MemcheckConfig::MemcheckConfig() : XmlConfig(MemcheckTool::self()->id()) { addCmdItemString(QStringLiteral("leakResolution"), m_leakResolution, QStringLiteral("high"), QStringLiteral("leak-resolution")); addCmdItemString(QStringLiteral("showLeakKinds"), m_showLeakKinds, QStringLiteral("definite,possible"), QStringLiteral("show-leak-kinds")); addCmdItemString(QStringLiteral("leakCheckHeuristics"), m_leakCheckHeuristics, QStringLiteral("all"), QStringLiteral("leak-check-heuristics")); addCmdItemString(QStringLiteral("keepStacktraces"), m_keepStacktraces, QStringLiteral("alloc-and-free"), QStringLiteral("keep-stacktraces")); auto itemInt = addCmdItemInt(QStringLiteral("freelistVol"), m_freelistVol, 20000000, QStringLiteral("freelist-vol")); itemInt->setMinValue(1); itemInt->setMaxValue(200000000); itemInt = addCmdItemInt(QStringLiteral("freelistBigBlocks"), m_freelistBigBlocks, 1000000, QStringLiteral("freelist-big-blocks")); - itemInt->setMinValue(1); + itemInt->setMinValue(0); itemInt->setMaxValue(10000000); addCmdItemBool(QStringLiteral("undefValueErrors"), m_undefValueErrors, true, QStringLiteral("undef-value-errors")); addCmdItemBool(QStringLiteral("showMismatchedFrees"), m_showMismatchedFrees, true, QStringLiteral("show-mismatched-frees")); addCmdItemBool(QStringLiteral("partialLoadsOk"), m_partialLoadsOk, true, QStringLiteral("partial-loads-ok")); addCmdItemBool(QStringLiteral("trackOrigins"), m_trackOrigins, false, QStringLiteral("track-origins")); addCmdItemBool(QStringLiteral("expensiveDefinednessChecks"), m_expensiveDefinednessChecks, false, QStringLiteral("expensive-definedness-checks")); } }