Commit 3cce72dc authored by hjk's avatar hjk Committed by Eike Ziller
Browse files

analyzer: merge valgrind related settings

This mainly reduces the number of tabs in the settings dialog.

Change-Id: I62ba5c74585648c8f495602cd4d676d0628de9b5
Reviewed-on: http://codereview.qt.nokia.com/1575

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 01cc659f
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "callgrindconfigwidget.h"
#include "ui_callgrindconfigwidget.h"
#include "callgrindsettings.h"
using namespace Valgrind::Internal;
CallgrindConfigWidget::CallgrindConfigWidget(AbstractCallgrindSettings *settings, QWidget *parent)
: QWidget(parent)
, m_ui(new Ui::CallgrindConfigWidget)
, m_settings(settings)
{
m_ui->setupUi(this);
m_ui->enableCacheSim->setChecked(m_settings->enableCacheSim());
connect(m_ui->enableCacheSim, SIGNAL(toggled(bool)),
m_settings, SLOT(setEnableCacheSim(bool)));
connect(m_settings, SIGNAL(enableCacheSimChanged(bool)),
m_ui->enableCacheSim, SLOT(setChecked(bool)));
m_ui->enableBranchSim->setChecked(m_settings->enableBranchSim());
connect(m_ui->enableBranchSim, SIGNAL(toggled(bool)),
m_settings, SLOT(setEnableBranchSim(bool)));
connect(m_settings, SIGNAL(enableBranchSimChanged(bool)),
m_ui->enableBranchSim, SLOT(setChecked(bool)));
m_ui->collectSystime->setChecked(m_settings->collectSystime());
connect(m_ui->collectSystime, SIGNAL(toggled(bool)),
m_settings, SLOT(setCollectSystime(bool)));
connect(m_settings, SIGNAL(collectSystimeChanged(bool)),
m_ui->collectSystime, SLOT(setChecked(bool)));
m_ui->collectBusEvents->setChecked(m_settings->collectBusEvents());
connect(m_ui->collectBusEvents, SIGNAL(toggled(bool)),
m_settings, SLOT(setCollectBusEvents(bool)));
connect(m_settings, SIGNAL(collectBusEventsChanged(bool)),
m_ui->collectBusEvents, SLOT(setChecked(bool)));
m_ui->enableEventToolTips->setChecked(m_settings->enableEventToolTips());
connect(m_ui->enableEventToolTips, SIGNAL(toggled(bool)),
m_settings, SLOT(setEnableEventToolTips(bool)));
connect(m_settings, SIGNAL(enableEventToolTipsChanged(bool)),
m_ui->enableEventToolTips, SLOT(setChecked(bool)));
m_ui->minimumInclusiveCostRatio->setValue(m_settings->minimumInclusiveCostRatio());
connect(m_ui->minimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
m_settings, SLOT(setMinimumInclusiveCostRatio(double)));
connect(m_settings, SIGNAL(minimumInclusiveCostRatioChanged(double)),
m_ui->minimumInclusiveCostRatio, SLOT(setValue(double)));
m_ui->visualisationMinimumInclusiveCostRatio->setValue(m_settings->visualisationMinimumInclusiveCostRatio());
connect(m_ui->visualisationMinimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
m_settings, SLOT(setVisualisationMinimumInclusiveCostRatio(double)));
connect(m_settings, SIGNAL(visualisationMinimumInclusiveCostRatioChanged(double)),
m_ui->visualisationMinimumInclusiveCostRatio, SLOT(setValue(double)));
}
CallgrindConfigWidget::~CallgrindConfigWidget()
{
delete m_ui;
}
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef ANALYZER_INTERNAL_CALLGRINDCONFIGWIDGET_H
#define ANALYZER_INTERNAL_CALLGRINDCONFIGWIDGET_H
#include <QtGui/QWidget>
namespace Valgrind {
namespace Internal {
namespace Ui {
class CallgrindConfigWidget;
}
class AbstractCallgrindSettings;
class CallgrindConfigWidget : public QWidget
{
public:
CallgrindConfigWidget(AbstractCallgrindSettings *settings, QWidget *parent);
virtual ~CallgrindConfigWidget();
private:
Ui::CallgrindConfigWidget *m_ui;
AbstractCallgrindSettings *m_settings;
};
} // namespace Internal
} // namespace Valgrind
#endif // ANALYZER_INTERNAL_CALLGRINDCONFIGWIDGET_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Valgrind::Internal::CallgrindConfigWidget</class>
<widget class="QWidget" name="Valgrind::Internal::CallgrindConfigWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>494</width>
<height>565</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="memcheckOptions">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Profiling Options</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="minimumInclusiveCostRatioLabel">
<property name="toolTip">
<string>Limits the amount of results the profiler gives you. A lower limit will likely increase performance.</string>
</property>
<property name="text">
<string>Result view: Show events with inclusive costs higher than:</string>
</property>
<property name="buddy">
<cstring>minimumInclusiveCostRatio</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="minimumInclusiveCostRatio">
<property name="suffix">
<string>%</string>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="enableEventToolTips">
<property name="title">
<string>Show additional information for events in tooltips</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="enableCacheSim">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;
&lt;p&gt;Does full cache simulation.&lt;/p&gt;
&lt;p&gt;By default, only instruction read accesses will be counted (&quot;Ir&quot;).&lt;/p&gt;
&lt;p&gt;
With cache simulation, further event counters are enabled:
&lt;ul&gt;&lt;li&gt;Cache misses on instruction reads (&quot;I1mr&quot;/&quot;I2mr&quot;)&lt;/li&gt;
&lt;li&gt;Data read accesses (&quot;Dr&quot;) and related cache misses (&quot;D1mr&quot;/&quot;D2mr&quot;)&lt;/li&gt;
&lt;li&gt;Data write accesses (&quot;Dw&quot;) and related cache misses (&quot;D1mw&quot;/&quot;D2mw&quot;)&lt;/li&gt;&lt;/ul&gt;
&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable cache simulation</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="enableBranchSim">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;
&lt;p&gt;Do branch prediction simulation.&lt;/p&gt;
&lt;p&gt;Further event counters are enabled: &lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Number of executed conditional branches and related predictor misses (
&quot;Bc&quot;/&quot;Bcm&quot;)&lt;/li&gt;
&lt;li&gt;Executed indirect jumps and related misses of the jump address predictor (
&quot;Bi&quot;/&quot;Bim&quot;)&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable branch prediction simulation</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="collectSystime">
<property name="toolTip">
<string>Collect information for system call times.</string>
</property>
<property name="text">
<string>Collect system call time</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="collectBusEvents">
<property name="toolTip">
<string>Collect the number of global bus events that are executed. The event type &quot;Ge&quot; is used for these events.</string>
</property>
<property name="text">
<string>Collect global bus events</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="visualisationMinimumInclusiveCostRatioLabel">
<property name="text">
<string>Visualisation: Show events with inclusive costs higher than:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="visualisationMinimumInclusiveCostRatio">
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>50.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -32,7 +32,7 @@
#include "callgrindengine.h"
#include "callgrindsettings.h"
#include "valgrindsettings.h"
#include <valgrind/callgrind/callgrindcontroller.h>
#include <valgrind/callgrind/callgrindparser.h>
......@@ -67,7 +67,7 @@ QStringList CallgrindEngine::toolArguments() const
{
QStringList arguments;
AbstractCallgrindSettings *callgrindSettings = m_settings->subConfig<AbstractCallgrindSettings>();
ValgrindBaseSettings *callgrindSettings = m_settings->subConfig<ValgrindBaseSettings>();
QTC_ASSERT(callgrindSettings, return arguments);
if (callgrindSettings->enableCacheSim())
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "callgrindsettings.h"
#include "callgrindconfigwidget.h"
#include <QtCore/QDebug>
using namespace Analyzer;
static const char callgrindEnableCacheSimC[] = "Analyzer.Valgrind.Callgrind.EnableCacheSim";
static const char callgrindEnableBranchSimC[] = "Analyzer.Valgrind.Callgrind.EnableBranchSim";
static const char callgrindCollectSystimeC[] = "Analyzer.Valgrind.Callgrind.CollectSystime";
static const char callgrindCollectBusEventsC[] = "Analyzer.Valgrind.Callgrind.CollectBusEvents";
static const char callgrindEnableEventToolTipsC[] = "Analyzer.Valgrind.Callgrind.EnableEventToolTips";
static const char callgrindMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.MinimumCostRatio";
static const char callgrindVisualisationMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio";
static const char callgrindCycleDetectionC[] = "Analyzer.Valgrind.Callgrind.CycleDetection";
static const char callgrindCostFormatC[] = "Analyzer.Valgrind.Callgrind.CostFormat";
namespace Valgrind {
namespace Internal {
void AbstractCallgrindSettings::setEnableCacheSim(bool enable)
{
if (m_enableCacheSim == enable)
return;
m_enableCacheSim = enable;
emit enableCacheSimChanged(enable);
}
void AbstractCallgrindSettings::setEnableBranchSim(bool enable)
{
if (m_enableBranchSim == enable)
return;
m_enableBranchSim = enable;
emit enableBranchSimChanged(enable);
}
void AbstractCallgrindSettings::setCollectSystime(bool collect)
{
if (m_collectSystime == collect)
return;
m_collectSystime = collect;
emit collectSystimeChanged(collect);
}
void AbstractCallgrindSettings::setCollectBusEvents(bool collect)
{
if (m_collectBusEvents == collect)
return;
m_collectBusEvents = collect;
emit collectBusEventsChanged(collect);
}
void AbstractCallgrindSettings::setEnableEventToolTips(bool enable)
{
if (m_enableEventToolTips == enable)
return;
m_enableEventToolTips = enable;
emit enableEventToolTipsChanged(enable);
}
void AbstractCallgrindSettings::setMinimumInclusiveCostRatio(
double minimumInclusiveCostRatio)
{
if (m_minimumInclusiveCostRatio == minimumInclusiveCostRatio)
return;
m_minimumInclusiveCostRatio = qBound(0.0, minimumInclusiveCostRatio, 100.0);
emit minimumInclusiveCostRatioChanged(minimumInclusiveCostRatio);
}
void AbstractCallgrindSettings::setVisualisationMinimumInclusiveCostRatio(
double minimumInclusiveCostRatio)
{
if (m_visualisationMinimumInclusiveCostRatio == minimumInclusiveCostRatio)
return;
m_visualisationMinimumInclusiveCostRatio = qBound(0.0, minimumInclusiveCostRatio, 100.0);
emit visualisationMinimumInclusiveCostRatioChanged(minimumInclusiveCostRatio);
}
QVariantMap AbstractCallgrindSettings::defaults() const
{
QVariantMap map;
map.insert(QLatin1String(callgrindEnableCacheSimC), false);
map.insert(QLatin1String(callgrindEnableBranchSimC), false);
map.insert(QLatin1String(callgrindCollectSystimeC), false);
map.insert(QLatin1String(callgrindCollectBusEventsC), false);
map.insert(QLatin1String(callgrindEnableEventToolTipsC), true);
map.insert(QLatin1String(callgrindMinimumCostRatioC), 0.01);
map.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC), 10.0);
return map;
}
bool AbstractCallgrindSettings::fromMap(const QVariantMap &map)
{
setIfPresent(map, QLatin1String(callgrindEnableCacheSimC), &m_enableCacheSim);
setIfPresent(map, QLatin1String(callgrindEnableBranchSimC), &m_enableBranchSim);
setIfPresent(map, QLatin1String(callgrindCollectSystimeC), &m_collectSystime);
setIfPresent(map, QLatin1String(callgrindCollectBusEventsC), &m_collectBusEvents);
setIfPresent(map, QLatin1String(callgrindEnableEventToolTipsC), &m_enableEventToolTips);
setIfPresent(map, QLatin1String(callgrindMinimumCostRatioC), &m_minimumInclusiveCostRatio);
setIfPresent(map, QLatin1String(callgrindVisualisationMinimumCostRatioC),
&m_visualisationMinimumInclusiveCostRatio);
return true;
}
QVariantMap AbstractCallgrindSettings::toMap() const
{
QVariantMap map;
map.insert(QLatin1String(callgrindEnableCacheSimC), m_enableCacheSim);
map.insert(QLatin1String(callgrindEnableBranchSimC), m_enableBranchSim);
map.insert(QLatin1String(callgrindCollectSystimeC), m_collectSystime);
map.insert(QLatin1String(callgrindCollectBusEventsC), m_collectBusEvents);
map.insert(QLatin1String(callgrindEnableEventToolTipsC), m_enableEventToolTips);
map.insert(QLatin1String(callgrindMinimumCostRatioC), m_minimumInclusiveCostRatio);
map.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC),
m_visualisationMinimumInclusiveCostRatio);
return map;
}
QString AbstractCallgrindSettings::id() const
{
return QLatin1String("Analyzer.Valgrind.Settings.Callgrind");
}
QString AbstractCallgrindSettings::displayName() const
{
return tr("Profiling");
}
QWidget *AbstractCallgrindSettings::createConfigWidget(QWidget *parent)
{
return new CallgrindConfigWidget(this, parent);
}
QVariantMap CallgrindGlobalSettings::defaults() const
{
QVariantMap map = AbstractCallgrindSettings::defaults();
map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
map.insert(QLatin1String(callgrindCycleDetectionC), true);
return map;
}
bool CallgrindGlobalSettings::fromMap(const QVariantMap &map)
{
AbstractCallgrindSettings::fromMap(map);
// special code as the default one does not cope with the enum properly
if (map.contains(QLatin1String(callgrindCostFormatC))) {
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(QLatin1String(callgrindCostFormatC)).toInt());
}
setIfPresent(map, QLatin1String(callgrindCycleDetectionC), &m_detectCycles);
return true;
}
QVariantMap CallgrindGlobalSettings::toMap() const
{
QVariantMap map = AbstractCallgrindSettings::toMap();
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles);
return map;
}
CostDelegate::CostFormat CallgrindGlobalSettings::costFormat() const
{
return m_costFormat;
}
void CallgrindGlobalSettings::setCostFormat(CostDelegate::CostFormat format)
{
m_costFormat = format;
AnalyzerGlobalSettings::instance()->writeSettings();
}
bool CallgrindGlobalSettings::detectCycles() const
{
return m_detectCycles;
}
void CallgrindGlobalSettings::setDetectCycles(bool detect)
{
m_detectCycles = detect;
AnalyzerGlobalSettings::instance()->writeSettings();
}
} // namespace Internal
} // namespace Valgrind
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.