aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Funk <[email protected]>2011-05-11 16:26:34 +0200
committerhjk <[email protected]>2011-05-11 16:26:34 +0200
commitbf1f5c2b02bd57cffc127f15fe05099c862102e3 (patch)
tree10748c8300dac8a2925e4231d7cf72d96923abc8
parentf5601d7b1b01ad3b1a39353bb8ef942f1f92cad6 (diff)
Fixes for valgrind-callgrind feedback by Nokia
Most changes include style fixes and UI changes for better usability. Merge-request: 324 Reviewed-by: hjk <[email protected]>
-rw-r--r--src/libs/valgrind/callgrind/callgrindcallmodel.cpp12
-rw-r--r--src/libs/valgrind/callgrind/callgrindcontroller.cpp6
-rw-r--r--src/libs/valgrind/callgrind/callgrindcontroller.h4
-rw-r--r--src/libs/valgrind/callgrind/callgrindcycledetection.cpp8
-rw-r--r--src/libs/valgrind/callgrind/callgrinddatamodel.cpp34
-rw-r--r--src/libs/valgrind/callgrind/callgrinddatamodel.h3
-rw-r--r--src/libs/valgrind/callgrind/callgrindfunction.cpp16
-rw-r--r--src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp8
-rw-r--r--src/libs/valgrind/callgrind/callgrindparsedata.cpp4
-rw-r--r--src/libs/valgrind/callgrind/callgrindparser.cpp12
-rw-r--r--src/libs/valgrind/callgrind/callgrindproxymodel.cpp2
-rw-r--r--src/libs/valgrind/callgrind/callgrindrunner.cpp2
-rw-r--r--src/libs/valgrind/memcheck/memcheckrunner.cpp6
-rw-r--r--src/libs/valgrind/valgrindprocess.cpp17
-rw-r--r--src/libs/valgrind/valgrindprocess.h1
-rw-r--r--src/libs/valgrind/xmlprotocol/error.cpp4
-rw-r--r--src/libs/valgrind/xmlprotocol/errorlistmodel.cpp2
-rw-r--r--src/libs/valgrind/xmlprotocol/stackmodel.cpp2
-rw-r--r--src/libs/valgrind/xmlprotocol/suppression.cpp2
-rw-r--r--src/plugins/analyzerbase/analyzermanager.cpp11
-rw-r--r--src/plugins/analyzerbase/analyzerrunconfigwidget.cpp4
-rw-r--r--src/plugins/analyzerbase/analyzersettings.cpp8
-rw-r--r--src/plugins/callgrind/callgrindconfigwidget.cpp18
-rw-r--r--src/plugins/callgrind/callgrindconfigwidget.ui150
-rw-r--r--src/plugins/callgrind/callgrindcostdelegate.cpp2
-rw-r--r--src/plugins/callgrind/callgrindengine.cpp12
-rw-r--r--src/plugins/callgrind/callgrindengine.h3
-rw-r--r--src/plugins/callgrind/callgrindsettings.cpp59
-rw-r--r--src/plugins/callgrind/callgrindsettings.h23
-rw-r--r--src/plugins/callgrind/callgrindtool.cpp20
-rw-r--r--src/plugins/callgrind/callgrindvisualisation.cpp74
-rw-r--r--src/plugins/callgrind/callgrindvisualisation.h2
-rw-r--r--src/plugins/callgrind/callgrindwidgethandler.cpp29
-rw-r--r--src/plugins/callgrind/callgrindwidgethandler.h8
-rw-r--r--src/plugins/memcheck/memcheckconfigwidget.cpp18
-rw-r--r--src/plugins/memcheck/memcheckengine.cpp2
-rw-r--r--src/plugins/memcheck/memcheckerrorview.cpp8
-rw-r--r--src/plugins/memcheck/memchecksettings.cpp2
-rw-r--r--src/plugins/memcheck/memchecktool.cpp14
-rw-r--r--src/plugins/memcheck/suppressiondialog.cpp10
-rw-r--r--src/plugins/valgrindtoolbase/valgrindengine.cpp25
-rw-r--r--src/plugins/valgrindtoolbase/valgrindengine.h4
-rw-r--r--tests/valgrind/callgrind/callgrindparsertests.cpp2
-rw-r--r--tests/valgrind/callgrind/modeltest.cpp6
44 files changed, 427 insertions, 232 deletions
diff --git a/src/libs/valgrind/callgrind/callgrindcallmodel.cpp b/src/libs/valgrind/callgrind/callgrindcallmodel.cpp
index 987a60371fe..7e75ce7985b 100644
--- a/src/libs/valgrind/callgrind/callgrindcallmodel.cpp
+++ b/src/libs/valgrind/callgrind/callgrindcallmodel.cpp
@@ -208,11 +208,21 @@ QVariant CallModel::data(const QModelIndex &index, int role) const
QVariant CallModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- if (orientation == Qt::Vertical || role != Qt::DisplayRole)
+ if (orientation == Qt::Vertical || (role != Qt::DisplayRole && role != Qt::ToolTipRole))
return QVariant();
QTC_ASSERT(section >= 0 && section < columnCount(), return QVariant());
+ if (role == Qt::ToolTipRole) {
+ if (section == CostColumn) {
+ if (!d->m_data)
+ return QVariant();
+
+ return ParseData::prettyStringForEvent(d->m_data->events().at(d->m_event));
+ }
+ return QVariant();
+ }
+
if (section == CalleeColumn)
return tr("Callee");
else if (section == CallerColumn)
diff --git a/src/libs/valgrind/callgrind/callgrindcontroller.cpp b/src/libs/valgrind/callgrind/callgrindcontroller.cpp
index ffcb4e85226..481d5dd2ccf 100644
--- a/src/libs/valgrind/callgrind/callgrindcontroller.cpp
+++ b/src/libs/valgrind/callgrind/callgrindcontroller.cpp
@@ -80,7 +80,7 @@ QString toOptionString(CallgrindController::Option option)
-w=<dir> Specify the startup directory of an active Callgrind run
*/
- switch(option) {
+ switch (option) {
case CallgrindController::Dump:
return "--dump";
case CallgrindController::ResetEventCounters:
@@ -118,7 +118,7 @@ void CallgrindController::run(Option option)
const QString optionString = toOptionString(option);
- switch(option) {
+ switch (option) {
case CallgrindController::Dump:
emit statusMessage(tr("Dumping profile data..."));
break;
@@ -167,7 +167,7 @@ void CallgrindController::processFinished(int rc, QProcess::ExitStatus status)
}
// this call went fine, we might run another task after this
- switch(m_lastOption) {
+ switch (m_lastOption) {
case ResetEventCounters:
// lets dump the new reset profiling info
run(Dump);
diff --git a/src/libs/valgrind/callgrind/callgrindcontroller.h b/src/libs/valgrind/callgrind/callgrindcontroller.h
index adefdfb4d33..c739e11c2df 100644
--- a/src/libs/valgrind/callgrind/callgrindcontroller.h
+++ b/src/libs/valgrind/callgrind/callgrindcontroller.h
@@ -36,7 +36,6 @@
#include <QObject>
#include <qprocess.h>
-#include <qmetatype.h>
#include <utils/ssh/sshconnection.h>
#include <utils/ssh/sshremoteprocess.h>
@@ -69,6 +68,7 @@ public:
void run(Valgrind::Callgrind::CallgrindController::Option option);
void setValgrindProcess(ValgrindProcess *process);
+ inline ValgrindProcess *valgrindProcess() { return m_valgrindProc; }
/**
* Make data file available locally, triggers @c localParseDataAvailable.
@@ -96,7 +96,7 @@ private Q_SLOTS:
private:
void cleanupTempFile();
- // callgrind_controll process
+ // callgrind_control process
Valgrind::ValgrindProcess *m_process;
// valgrind process
Valgrind::ValgrindProcess *m_valgrindProc;
diff --git a/src/libs/valgrind/callgrind/callgrindcycledetection.cpp b/src/libs/valgrind/callgrind/callgrindcycledetection.cpp
index db4c7cd95a0..2922747fc9b 100644
--- a/src/libs/valgrind/callgrind/callgrindcycledetection.cpp
+++ b/src/libs/valgrind/callgrind/callgrindcycledetection.cpp
@@ -55,14 +55,14 @@ CycleDetection::CycleDetection(ParseData *data)
QVector<const Function *> CycleDetection::run(const QVector<const Function *> &input)
{
- foreach(const Function *function, input) {
+ foreach (const Function *function, input) {
Node *node = new Node;
node->function = function;
node->dfs = -1;
node->lowlink = -1;
m_nodes.insert(function, node);
}
- foreach(Node *node, m_nodes) {
+ foreach (Node *node, m_nodes) {
if (node->dfs == -1)
tarjan(node);
}
@@ -79,7 +79,7 @@ void CycleDetection::tarjan(Node *node)
m_depth++;
m_stack.push(node);
- foreach(const FunctionCall *call, node->function->outgoingCalls())
+ foreach (const FunctionCall *call, node->function->outgoingCalls())
tarjanForChildNode(node, m_nodes.value(call->callee()));
if (node->dfs == node->lowlink) {
@@ -88,7 +88,7 @@ void CycleDetection::tarjan(Node *node)
do {
n = m_stack.pop();
functions << n->function;
- } while(n != node);
+ } while (n != node);
if (functions.size() == 1) {
// not a real cycle
diff --git a/src/libs/valgrind/callgrind/callgrinddatamodel.cpp b/src/libs/valgrind/callgrind/callgrinddatamodel.cpp
index f146b10e8a6..0cd2587a7ab 100644
--- a/src/libs/valgrind/callgrind/callgrinddatamodel.cpp
+++ b/src/libs/valgrind/callgrind/callgrinddatamodel.cpp
@@ -65,6 +65,7 @@ public:
Private()
: m_data(0)
, m_event(0)
+ , m_verboseToolTips(true)
, m_cycleDetection(false)
{
}
@@ -77,6 +78,7 @@ public:
const ParseData *m_data;
int m_event;
+ bool m_verboseToolTips;
bool m_cycleDetection;
QVector<const Function *> m_functions;
};
@@ -128,6 +130,16 @@ void DataModel::setParseData(const ParseData *data)
endResetModel();
}
+void DataModel::setVerboseToolTipsEnabled(bool enabled)
+{
+ d->m_verboseToolTips = enabled;
+}
+
+bool DataModel::verboseToolTipsEnabled() const
+{
+ return d->m_verboseToolTips;
+}
+
const ParseData *DataModel::parseData() const
{
return d->m_data;
@@ -254,6 +266,9 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
else if (index.column() == InclusiveCostColumn)
return inclusiveCost;
} else if (role == Qt::ToolTipRole) {
+ if (!d->m_verboseToolTips)
+ return data(index, Qt::DisplayRole);
+
QString ret = "<html><head><style>\
dt { font-weight: bold; }\
dd { font-family: monospace; }\
@@ -269,7 +284,7 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
ret += "<dt>" + tr("File:") + "</dt><dd>" + func->file() + "</dd>\n";
if (!func->costItems().isEmpty()) {
const CostItem *firstItem = func->costItems().first();
- for(int i = 0; i < d->m_data->positions().size(); ++i) {
+ for (int i = 0; i < d->m_data->positions().size(); ++i) {
ret += "<dt>" + ParseData::prettyStringForPosition(d->m_data->positions().at(i)) + "</dt>";
ret += "<dd>" + QString::number(firstItem->position(i)) + "</dd>\n";
}
@@ -285,7 +300,7 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
ret += "<td class='group'>" + tr("Incl. costs") + "</td><td>" + tr("(%)") + "</td>";
ret += "</tr></thead>";
ret += "<tbody>";
- for(int i = 0; i < d->m_data->events().size(); ++i) {
+ for (int i = 0; i < d->m_data->events().size(); ++i) {
quint64 selfCost = func->selfCost(i);
quint64 inclCost = func->inclusiveCost(i);
quint64 totalCost = d->m_data->totalCost(i);
@@ -311,11 +326,24 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
QVariant DataModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- if (orientation == Qt::Vertical || role != Qt::DisplayRole)
+ if (orientation == Qt::Vertical || (role != Qt::DisplayRole && role != Qt::ToolTipRole))
return QVariant();
QTC_ASSERT(section >= 0 && section < columnCount(), return QVariant());
+ if (role == Qt::ToolTipRole) {
+ if (!d->m_data)
+ return QVariant();
+
+ const QString prettyCostStr = ParseData::prettyStringForEvent(d->m_data->events().at(d->m_event));
+ if (section == SelfCostColumn) {
+ return tr("%1 cost spent in a given function excluding costs from called functions.").arg(prettyCostStr);
+ } else if (section == InclusiveCostColumn) {
+ return tr("%1 cost spent in a given function including costs from called functions.").arg(prettyCostStr);
+ }
+ return QVariant();
+ }
+
if (section == NameColumn)
return tr("Function");
else if (section == LocationColumn)
diff --git a/src/libs/valgrind/callgrind/callgrinddatamodel.h b/src/libs/valgrind/callgrind/callgrinddatamodel.h
index 707bc4aedd0..486539bb20f 100644
--- a/src/libs/valgrind/callgrind/callgrinddatamodel.h
+++ b/src/libs/valgrind/callgrind/callgrinddatamodel.h
@@ -56,6 +56,9 @@ public:
virtual void setParseData(const ParseData *data);
virtual const ParseData *parseData() const;
+ void setVerboseToolTipsEnabled(bool enabled);
+ bool verboseToolTipsEnabled() const;
+
/// Only one cost event column will be shown, this decides which one it is.
/// By default it is the first event in the @c ParseData, i.e. 0.
virtual int costEvent() const;
diff --git a/src/libs/valgrind/callgrind/callgrindfunction.cpp b/src/libs/valgrind/callgrind/callgrindfunction.cpp
index 771e5f57b5e..bb56e070d5a 100644
--- a/src/libs/valgrind/callgrind/callgrindfunction.cpp
+++ b/src/libs/valgrind/callgrind/callgrindfunction.cpp
@@ -77,7 +77,7 @@ void Function::Private::accumulateCost(QVector<quint64> &base, const QVector<qui
} else {
///TODO: see whether .data() is noticably faster (less detaching)
int i = 0;
- foreach(quint64 cost, add)
+ foreach (quint64 cost, add)
base[i++] += cost;
}
}
@@ -187,11 +187,11 @@ void Function::setObject(qint64 id)
QString Function::location() const
{
QString pos;
- foreach(const CostItem *costItem, d->m_costItems) {
+ foreach (const CostItem *costItem, d->m_costItems) {
if (costItem->differingFileId() != -1) {
QTextStream stream(&pos);
stream << '(';
- for(int i = 0, c = costItem->positions().count(); i < c; ++i) {
+ for (int i = 0, c = costItem->positions().count(); i < c; ++i) {
///TODO: remember what was hex formatted
stream << costItem->position(i);
if (i != c - 1)
@@ -227,7 +227,7 @@ int Function::lineNumber() const
if (lineIdx == -1)
return -1;
- foreach(const CostItem *costItem, d->m_costItems) {
+ foreach (const CostItem *costItem, d->m_costItems) {
if (costItem->differingFileId() == -1)
return costItem->position(lineIdx);
}
@@ -301,7 +301,7 @@ void Function::addCostItem(const CostItem *item)
void Function::finalize()
{
bool recursive = false;
- foreach(const FunctionCall *call, d->m_incomingCalls) {
+ foreach (const FunctionCall *call, d->m_incomingCalls) {
if (call->caller() == this) {
recursive = true;
break;
@@ -314,16 +314,16 @@ void Function::finalize()
// e.g.: A -> B -> B ..., C -> B -> B ...
// cost of B = cost of call to B in A + cost of call to B in C + ...
d->m_inclusiveCost.fill(0);
- foreach(const FunctionCall *call, d->m_incomingCalls) {
+ foreach (const FunctionCall *call, d->m_incomingCalls) {
if (call->caller() != this) {
- foreach(const CostItem *costItem, call->caller()->costItems()) {
+ foreach (const CostItem *costItem, call->caller()->costItems()) {
if (costItem->call() && costItem->call()->callee() == this)
d->accumulateCost(d->m_inclusiveCost, costItem->costs());
}
}
}
// now subtract self cost (see @c inclusiveCost() implementation)
- for(int i = 0, c = d->m_inclusiveCost.size(); i < c; ++i) {
+ for (int i = 0, c = d->m_inclusiveCost.size(); i < c; ++i) {
if (d->m_inclusiveCost.at(i) < d->m_selfCost.at(i))
d->m_inclusiveCost[i] = 0;
else
diff --git a/src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp b/src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp
index a12ea5546ad..8f241316272 100644
--- a/src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp
+++ b/src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp
@@ -82,16 +82,16 @@ void FunctionCycle::setFunctions(const QVector<const Function *> functions)
d->m_selfCost.fill(0, d->m_data->events().size());
d->m_inclusiveCost.fill(0, d->m_data->events().size());
- foreach(const Function *func, functions) {
+ foreach (const Function *func, functions) {
// just add up self cost
d->accumulateCost(d->m_selfCost, func->selfCosts());
// add outgoing calls to functions that are not part of the cycle
- foreach(const FunctionCall *call, func->outgoingCalls()) {
+ foreach (const FunctionCall *call, func->outgoingCalls()) {
if (!functions.contains(call->callee()))
d->accumulateCall(call, Function::Private::Outgoing);
}
// add incoming calls from functions that are not part of the cycle
- foreach(const FunctionCall *call, func->incomingCalls()) {
+ foreach (const FunctionCall *call, func->incomingCalls()) {
if (!functions.contains(call->caller())) {
d->accumulateCall(call, Function::Private::Incoming);
d->m_called += call->calls();
@@ -101,7 +101,7 @@ void FunctionCycle::setFunctions(const QVector<const Function *> functions)
}
// now subtract self from incl. cost (see implementation of inclusiveCost())
// now subtract self cost (see @c inclusiveCost() implementation)
- for(int i = 0, c = d->m_inclusiveCost.size(); i < c; ++i) {
+ for (int i = 0, c = d->m_inclusiveCost.size(); i < c; ++i) {
if (d->m_inclusiveCost.at(i) < d->m_selfCost.at(i))
d->m_inclusiveCost[i] = 0;
else
diff --git a/src/libs/valgrind/callgrind/callgrindparsedata.cpp b/src/libs/valgrind/callgrind/callgrindparsedata.cpp
index 38ef6f4a46d..a578c6a9fd3 100644
--- a/src/libs/valgrind/callgrind/callgrindparsedata.cpp
+++ b/src/libs/valgrind/callgrind/callgrindparsedata.cpp
@@ -100,7 +100,7 @@ ParseData::Private::~Private()
void ParseData::Private::cleanupFunctionCycles()
{
m_cycleCacheValid = false;
- foreach(const Function *func, m_cycleCache) {
+ foreach (const Function *func, m_cycleCache) {
if (dynamic_cast<const FunctionCycle *>(func))
delete func;
}
@@ -244,7 +244,7 @@ void ParseData::setPositions(const QStringList &positions)
{
d->m_positions = positions;
d->m_lineNumberPositionIndex = -1;
- for(int i = 0; i < positions.size(); ++i) {
+ for (int i = 0; i < positions.size(); ++i) {
if (positions.at(i) == "line") {
d->m_lineNumberPositionIndex = i;
break;
diff --git a/src/libs/valgrind/callgrind/callgrindparser.cpp b/src/libs/valgrind/callgrind/callgrindparser.cpp
index e540b64fafb..d93f7143c7d 100644
--- a/src/libs/valgrind/callgrind/callgrindparser.cpp
+++ b/src/libs/valgrind/callgrind/callgrindparser.cpp
@@ -237,17 +237,17 @@ void Parser::Private::parse(QIODevice *device)
// build fast lookup of functions by their nameId
QHash<qint64, QList<const Function *> > functionLookup;
- foreach(const Function *function, data->functions()) {
+ foreach (const Function *function, data->functions()) {
functionLookup[function->nameId()].append(function);
}
// functions that need to accumulate their calees
QSet<Function *> pendingFunctions;
- foreach(const CallData &callData, pendingCallees) {
+ foreach (const CallData &callData, pendingCallees) {
Function *calledFunction = 0;
QTC_ASSERT(callData.call, continue);
QTC_ASSERT(callData.call->caller(), continue);
- foreach(const Function *function, functionLookup.value(callData.calledFunction)) {
+ foreach (const Function *function, functionLookup.value(callData.calledFunction)) {
QTC_ASSERT(function->nameId() == callData.calledFunction, continue);
if (function->objectId() == callData.calledObject
&& function->fileId() == callData.calledFile)
@@ -263,7 +263,7 @@ void Parser::Private::parse(QIODevice *device)
qDebug() << "caller is:" << callData.call->caller()->name() << callData.call->caller()->nameId();
qDebug() << "called file:" << callData.calledFile << "object:" << callData.calledObject;
qDebug() << data->stringForFileCompression(callData.calledFile) << data->stringForObjectCompression(callData.calledObject);
- foreach(const Function *function, functionLookup.value(callData.calledFunction)) {
+ foreach (const Function *function, functionLookup.value(callData.calledFunction)) {
qDebug() << "available function file:" << function->fileId() << function->file() << "object:" << function->objectId() << function->object();
}
}
@@ -281,7 +281,7 @@ void Parser::Private::parse(QIODevice *device)
// lookup done
// now accumulate callees
- foreach(Function *func, pendingFunctions)
+ foreach (Function *func, pendingFunctions)
func->finalize();
q->parserDataReady(); // emit
@@ -610,7 +610,7 @@ void Parser::Private::parseCalls(const char *begin, const char *end)
skipSpace(&current, end);
callDestinations.fill(0, addressValuesCount);
- for(int i = 0; i < addressValuesCount; ++i) {
+ for (int i = 0; i < addressValuesCount; ++i) {
callDestinations[i] = parseAddr(&current, end, &ok);
if (!ok)
break; // TODO error handling?
diff --git a/src/libs/valgrind/callgrind/callgrindproxymodel.cpp b/src/libs/valgrind/callgrind/callgrindproxymodel.cpp
index 9b924f50c15..ce042c979ec 100644
--- a/src/libs/valgrind/callgrind/callgrindproxymodel.cpp
+++ b/src/libs/valgrind/callgrind/callgrindproxymodel.cpp
@@ -137,7 +137,7 @@ bool DataProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_
// check if the function from this index is a child of (called by) the filter function
if (func && m_function) {
bool isValid = false;
- foreach(const FunctionCall *call, func->incomingCalls()) {
+ foreach (const FunctionCall *call, func->incomingCalls()) {
if (call->caller() == m_function) {
isValid = true;
break;
diff --git a/src/libs/valgrind/callgrind/callgrindrunner.cpp b/src/libs/valgrind/callgrind/callgrindrunner.cpp
index ce741d52661..029c165c6a5 100644
--- a/src/libs/valgrind/callgrind/callgrindrunner.cpp
+++ b/src/libs/valgrind/callgrind/callgrindrunner.cpp
@@ -116,7 +116,7 @@ void CallgrindRunner::localParseDataAvailable(const QString &file)
void CallgrindRunner::controllerFinished(CallgrindController::Option option)
{
- switch(option)
+ switch (option)
{
case CallgrindController::Pause:
m_paused = true;
diff --git a/src/libs/valgrind/memcheck/memcheckrunner.cpp b/src/libs/valgrind/memcheck/memcheckrunner.cpp
index 890b2e66c86..9322419f8d9 100644
--- a/src/libs/valgrind/memcheck/memcheckrunner.cpp
+++ b/src/libs/valgrind/memcheck/memcheckrunner.cpp
@@ -128,8 +128,8 @@ void MemcheckRunner::startRemotely(const Utils::SshConnectionParameters &sshPara
QList<QHostAddress> possibleHostAddresses;
//NOTE: ::allAddresses does not seem to work for usb interfaces...
- foreach(const QNetworkInterface &iface, QNetworkInterface::allInterfaces()) {
- foreach(const QNetworkAddressEntry &entry, iface.addressEntries()) {
+ foreach (const QNetworkInterface &iface, QNetworkInterface::allInterfaces()) {
+ foreach (const QNetworkAddressEntry &entry, iface.addressEntries()) {
const QHostAddress addr = entry.ip();
if (addr.toString() != "127.0.0.1"
&& addr.toString() != "0:0:0:0:0:0:0:1")
@@ -155,7 +155,7 @@ void MemcheckRunner::startRemotely(const Utils::SshConnectionParameters &sshPara
description->setText(tr("More than one network interface was found on your machine. Please select which one you want to use for remote analyzation."));
layout->addWidget(description);
QListWidget *list = new QListWidget;
- foreach(const QHostAddress &address, possibleHostAddresses)
+ foreach (const QHostAddress &address, possibleHostAddresses)
list->addItem(address.toString());
list->setSelectionMode(QAbstractItemView::SingleSelection);
diff --git a/src/libs/valgrind/valgrindprocess.cpp b/src/libs/valgrind/valgrindprocess.cpp
index ef36886c1ee..35c30fe58f0 100644
--- a/src/libs/valgrind/valgrindprocess.cpp
+++ b/src/libs/valgrind/valgrindprocess.cpp
@@ -38,6 +38,8 @@
#include <QtCore/QEventLoop>
#include <QtCore/QFileInfo>
+#include <utils/qtcassert.h>
+
namespace Valgrind {
ValgrindProcess::ValgrindProcess(QObject *parent)
@@ -204,6 +206,8 @@ void RemoteValgrindProcess::run(const QString &valgrindExecutable, const QString
void RemoteValgrindProcess::connected()
{
+ QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
+
// connected, run command
QString cmd;
@@ -235,6 +239,8 @@ Utils::SshConnection::Ptr RemoteValgrindProcess::connection() const
void RemoteValgrindProcess::processStarted()
{
+ QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
+
// find out what PID our process has
// NOTE: valgrind cloaks its name,
@@ -279,7 +285,7 @@ void RemoteValgrindProcess::findPIDOutputReceived(const QByteArray &output)
void RemoteValgrindProcess::error(Utils::SshError error)
{
- switch(error) {
+ switch (error) {
case Utils::SshTimeoutError:
m_error = QProcess::Timedout;
break;
@@ -293,9 +299,8 @@ void RemoteValgrindProcess::error(Utils::SshError error)
void RemoteValgrindProcess::close()
{
+ QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
if (m_process) {
- m_process->closeChannel();
-
if (m_pid) {
const QString killTemplate = QString("kill -%2 %1" // kill
).arg(m_pid);
@@ -304,14 +309,16 @@ void RemoteValgrindProcess::close()
const QString brutalKill = killTemplate.arg("SIGKILL");
const QString remoteCall = niceKill + QLatin1String("; sleep 1; ") + brutalKill;
- m_cleanup = m_connection->createRemoteProcess(remoteCall.toUtf8());
- m_cleanup->start();
+ Utils::SshRemoteProcess::Ptr cleanup = m_connection->createRemoteProcess(remoteCall.toUtf8());
+ cleanup->start();
}
}
}
void RemoteValgrindProcess::closed(int status)
{
+ QTC_ASSERT(m_process, return);
+
m_errorString = m_process->errorString();
if (status == Utils::SshRemoteProcess::FailedToStart) {
m_error = QProcess::FailedToStart;
diff --git a/src/libs/valgrind/valgrindprocess.h b/src/libs/valgrind/valgrindprocess.h
index a585a56d36f..e6cb4a37f52 100644
--- a/src/libs/valgrind/valgrindprocess.h
+++ b/src/libs/valgrind/valgrindprocess.h
@@ -156,7 +156,6 @@ private:
Utils::SshConnectionParameters m_params;
Utils::SshConnection::Ptr m_connection;
Utils::SshRemoteProcess::Ptr m_process;
- Utils::SshRemoteProcess::Ptr m_cleanup;
QString m_workingDir;
QString m_valgrindExe;
QStringList m_valgrindArgs;
diff --git a/src/libs/valgrind/xmlprotocol/error.cpp b/src/libs/valgrind/xmlprotocol/error.cpp
index 60f984192e3..f9aabca648d 100644
--- a/src/libs/valgrind/xmlprotocol/error.cpp
+++ b/src/libs/valgrind/xmlprotocol/error.cpp
@@ -226,13 +226,13 @@ QString Error::toXml() const
stream << " <what>" << d->what << "</what>\n";
}
- foreach(const Stack &stack, d->stacks) {
+ foreach (const Stack &stack, d->stacks) {
if (!stack.auxWhat().isEmpty()) {
stream << " <auxwhat>" << stack.auxWhat() << "</auxwhat>\n";
}
stream << " <stack>\n";
- foreach(const Frame &frame, stack.frames()) {
+ foreach (const Frame &frame, stack.frames()) {
stream << " <frame>\n";
stream << " <ip>0x" << QString::number(frame.instructionPointer(), 16) << "</ip>\n";
if (!frame.object().isEmpty()) {
diff --git a/src/libs/valgrind/xmlprotocol/errorlistmodel.cpp b/src/libs/valgrind/xmlprotocol/errorlistmodel.cpp
index bd7c2f3c71b..42fe7721e00 100644
--- a/src/libs/valgrind/xmlprotocol/errorlistmodel.cpp
+++ b/src/libs/valgrind/xmlprotocol/errorlistmodel.cpp
@@ -149,7 +149,7 @@ QVariant ErrorListModel::Private::errorData(int row, int column, int role) const
const Stack stack = !stacks.isEmpty() ? stacks.first() : Stack();
if (error.stacks().count())
- switch(role) {
+ switch (role) {
case Qt::DisplayRole:
{
switch (column) {
diff --git a/src/libs/valgrind/xmlprotocol/stackmodel.cpp b/src/libs/valgrind/xmlprotocol/stackmodel.cpp
index ed498ac6c22..6fcfbe134ba 100644
--- a/src/libs/valgrind/xmlprotocol/stackmodel.cpp
+++ b/src/libs/valgrind/xmlprotocol/stackmodel.cpp
@@ -112,7 +112,7 @@ QVariant StackModel::data(const QModelIndex &index, int role) const
if (fidx < 0 || fidx >= frames.size())
return QVariant();
const Frame &frame = frames[fidx];
- switch(role) {
+ switch (role) {
case Qt::DisplayRole:
{
switch (index.column()) {
diff --git a/src/libs/valgrind/xmlprotocol/suppression.cpp b/src/libs/valgrind/xmlprotocol/suppression.cpp
index 75a1b8fa0be..dd66c92d084 100644
--- a/src/libs/valgrind/xmlprotocol/suppression.cpp
+++ b/src/libs/valgrind/xmlprotocol/suppression.cpp
@@ -236,7 +236,7 @@ QString Suppression::toString() const
stream << "{\n";
stream << indent << d->name << '\n';
stream << indent << d->kind << '\n';
- foreach(const SuppressionFrame &frame, d->frames) {
+ foreach (const SuppressionFrame &frame, d->frames) {
stream << indent << frame.toString() << '\n';
}
stream << "}\n";
diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp
index 8ea59189e16..85ea8714006 100644
--- a/src/plugins/analyzerbase/analyzermanager.cpp
+++ b/src/plugins/analyzerbase/analyzermanager.cpp
@@ -210,6 +210,7 @@ public:
AnalyzerRunControlFactory *m_runControlFactory;
ProjectExplorer::RunControl *m_currentRunControl;
Utils::FancyMainWindow *m_mainWindow;
+ IAnalyzerTool *m_currentTool;
QList<IAnalyzerTool *> m_tools;
QActionGroup *m_toolGroup;
QAction *m_startAction;
@@ -232,7 +233,6 @@ public:
bool m_restartOnStop;
bool m_initialized;
- IAnalyzerTool *m_currentTool;
};
AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
@@ -242,6 +242,7 @@ AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager
m_runControlFactory(0),
m_currentRunControl(0),
m_mainWindow(0),
+ m_currentTool(0),
m_toolGroup(0),
m_startAction(0),
m_startRemoteAction(0),
@@ -253,8 +254,7 @@ AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager
m_statusLabel(new Utils::StatusLabel),
m_resizeEventFilter(new DockWidgetEventFilter(qq)),
m_restartOnStop(false),
- m_initialized(false),
- m_currentTool(0)
+ m_initialized(false)
{
m_toolBox->setObjectName(QLatin1String("AnalyzerManagerToolBox"));
m_runControlFactory = new AnalyzerRunControlFactory();
@@ -271,7 +271,7 @@ AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
{
// as we have to setParent(0) on dock widget that are not selected,
// we keep track of all and make sure we don't leak any
- foreach(const DockPtr &ptr, m_dockWidgets) {
+ foreach (const DockPtr &ptr, m_dockWidgets) {
if (ptr)
delete ptr.data();
}
@@ -541,7 +541,7 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool()
const QString msg = tr("<html><head/><body><center><i>%1</i> is still running. You have to quit the Analyzer before being able to run another instance.<center/>"
"<center>Force it to quit?</center></body></html>").arg(m_currentRunControl->displayName());
bool stopRequested = showPromptDialog(tr("Analyzer Still Running"), msg,
- tr("Stop active run"), tr("Keep Running"));
+ tr("Stop Active Run"), tr("Keep Running"));
if (!stopRequested)
return; // no restart, keep it running, do nothing
@@ -657,7 +657,6 @@ void AnalyzerManager::toolSelected(int idx)
return;
selectingTool = true;
-
if (oldTool != 0) {
saveToolSettings(oldTool);
diff --git a/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp b/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
index 72569395e4b..471ebd48687 100644
--- a/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
+++ b/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
@@ -71,14 +71,14 @@ void AnalyzerRunConfigWidget::setRunConfiguration(ProjectExplorer::RunConfigurat
// update summary text
QStringList tools;
- foreach(AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
+ foreach (AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
tools << QString("<strong>%1</strong>").arg(config->displayName());
}
m_detailsWidget->setSummaryText(tr("Available settings: %1").arg(tools.join(", ")));
// add group boxes for each sub config
QLayout *layout = m_detailsWidget->widget()->layout();
- foreach(AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
+ foreach (AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
QGroupBox *box = new QGroupBox(config->displayName());
Q_UNUSED(box)
QWidget *widget = config->createConfigWidget(this);
diff --git a/src/plugins/analyzerbase/analyzersettings.cpp b/src/plugins/analyzerbase/analyzersettings.cpp
index 2b9a11a924d..4049082eb3e 100644
--- a/src/plugins/analyzerbase/analyzersettings.cpp
+++ b/src/plugins/analyzerbase/analyzersettings.cpp
@@ -74,7 +74,7 @@ AnalyzerSettings::~AnalyzerSettings()
bool AnalyzerSettings::fromMap(const QVariantMap &map)
{
bool ret = true;
- foreach(AbstractAnalyzerSubConfig *config, subConfigs()) {
+ foreach (AbstractAnalyzerSubConfig *config, subConfigs()) {
ret = ret && config->fromMap(map);
}
return ret;
@@ -83,7 +83,7 @@ bool AnalyzerSettings::fromMap(const QVariantMap &map)
QVariantMap AnalyzerSettings::defaults() const
{
QVariantMap map;
- foreach(AbstractAnalyzerSubConfig *config, subConfigs()) {
+ foreach (AbstractAnalyzerSubConfig *config, subConfigs()) {
map.unite(config->defaults());
}
return map;
@@ -92,7 +92,7 @@ QVariantMap AnalyzerSettings::defaults() const
QVariantMap AnalyzerSettings::toMap() const
{
QVariantMap map;
- foreach(AbstractAnalyzerSubConfig *config, subConfigs()) {
+ foreach (AbstractAnalyzerSubConfig *config, subConfigs()) {
map.unite(config->toMap());
}
return map;
@@ -166,7 +166,7 @@ AnalyzerProjectSettings::AnalyzerProjectSettings(QObject *parent)
: AnalyzerSettings(parent)
{
// add sub configs
- foreach(AbstractAnalyzerSubConfigFactory *factory, AnalyzerGlobalSettings::instance()->subConfigFactories()) {
+ foreach (AbstractAnalyzerSubConfigFactory *factory, AnalyzerGlobalSettings::instance()->subConfigFactories()) {
addSubConfig(factory->createProjectSubConfig(parent));
}
diff --git a/src/plugins/callgrind/callgrindconfigwidget.cpp b/src/plugins/callgrind/callgrindconfigwidget.cpp
index d3b6199be70..36235e626c0 100644
--- a/src/plugins/callgrind/callgrindconfigwidget.cpp
+++ b/src/plugins/callgrind/callgrindconfigwidget.cpp
@@ -68,6 +68,24 @@ CallgrindConfigWidget::CallgrindConfigWidget(AbstractCallgrindSettings *settings
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()
diff --git a/src/plugins/callgrind/callgrindconfigwidget.ui b/src/plugins/callgrind/callgrindconfigwidget.ui
index 8147c03ff7c..85008142ed9 100644
--- a/src/plugins/callgrind/callgrindconfigwidget.ui
+++ b/src/plugins/callgrind/callgrindconfigwidget.ui
@@ -10,8 +10,8 @@
<height>565</height>
</rect>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
+ <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">
@@ -22,24 +22,49 @@
<property name="title">
<string>Profiling Options</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="4" column="0" colspan="2">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="minimumInclusiveCostRatioLabel">
+ <property name="toolTip">
+ <string>This option limits the amount of results the profiler will give 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="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
+ <property name="buddy">
+ <cstring>minimumInclusiveCostRatio</cstring>
</property>
- </spacer>
+ </widget>
</item>
- <item row="0" column="0" colspan="2">
- <widget class="QCheckBox" name="enableCacheSim">
- <property name="toolTip">
- <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+ <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;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
@@ -55,16 +80,16 @@ With cache simulation, further event counters are enabled:
&lt;/p&gt;
For more information, see ???.&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;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+ </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;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
@@ -74,35 +99,74 @@ p, li { white-space: pre-wrap; }
&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>
+ </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>This specifies whether information for system call times should be collected.</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>This specifies whether the number of global bus events executed should be collected. 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="2" column="0">
- <widget class="QCheckBox" name="collectSystime">
- <property name="toolTip">
- <string>This specifies whether information for system call times should be collected.</string>
- </property>
+ <item row="1" column="0">
+ <widget class="QLabel" name="visualisationMinimumInclusiveCostRatioLabel">
<property name="text">
- <string>Collect system call time</string>
+ <string>Visualisation: Show events with inclusive costs higher than:</string>
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QCheckBox" name="collectBusEvents">
- <property name="toolTip">
- <string>This specifies whether the number of global bus events executed should be collected. The event type &quot;Ge&quot; is used for these events.</string>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="visualisationMinimumInclusiveCostRatio">
+ <property name="prefix">
+ <string/>
</property>
- <property name="text">
- <string>Collect global bus events</string>
+ <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/>
diff --git a/src/plugins/callgrind/callgrindcostdelegate.cpp b/src/plugins/callgrind/callgrindcostdelegate.cpp
index af001fb5ed5..ad48d4a350d 100644
--- a/src/plugins/callgrind/callgrindcostdelegate.cpp
+++ b/src/plugins/callgrind/callgrindcostdelegate.cpp
@@ -70,7 +70,7 @@ CostDelegate::Private::Private()
int CostDelegate::Private::toNativeRole(CostDelegate::CostFormat format)
{
- switch(format)
+ switch (format)
{
case FormatAbsolute:
case FormatRelative:
diff --git a/src/plugins/callgrind/callgrindengine.cpp b/src/plugins/callgrind/callgrindengine.cpp
index bff6ef5e9de..7d01c287b68 100644
--- a/src/plugins/callgrind/callgrindengine.cpp
+++ b/src/plugins/callgrind/callgrindengine.cpp
@@ -126,11 +126,13 @@ void CallgrindEngine::setPaused(bool paused)
m_markAsPaused = paused;
- // call controller
- if (paused)
- pause();
- else
- unpause();
+ // call controller only if it is attached to a valgrind process
+ if (m_runner.controller()->valgrindProcess()) {
+ if (paused)
+ pause();
+ else
+ unpause();
+ }
}
void CallgrindEngine::setToggleCollectFunction(const QString &toggleCollectFunction)
diff --git a/src/plugins/callgrind/callgrindengine.h b/src/plugins/callgrind/callgrindengine.h
index 2ea82434f70..37fc69c0f74 100644
--- a/src/plugins/callgrind/callgrindengine.h
+++ b/src/plugins/callgrind/callgrindengine.h
@@ -60,7 +60,10 @@ public slots:
void pause();
void unpause();
+ /// marks the callgrind process as paused
+ /// calls pause() and unpause() if there's an active run
void setPaused(bool paused);
+
void setToggleCollectFunction(const QString &toggleCollectFunction);
protected:
diff --git a/src/plugins/callgrind/callgrindsettings.cpp b/src/plugins/callgrind/callgrindsettings.cpp
index af4d4bb02e3..1dae3c713ce 100644
--- a/src/plugins/callgrind/callgrindsettings.cpp
+++ b/src/plugins/callgrind/callgrindsettings.cpp
@@ -44,10 +44,12 @@ static const char callgrindEnableCacheSimC[] = "Analyzer.Valgrind.Callgrind.Enab
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";
-static const char callgrindMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.MinimumCostRatio";
AbstractCallgrindSettings::AbstractCallgrindSettings(QObject *parent)
: AbstractAnalyzerSubConfig(parent)
@@ -96,6 +98,35 @@ void AbstractCallgrindSettings::setCollectBusEvents(bool 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;
@@ -103,6 +134,9 @@ QVariantMap AbstractCallgrindSettings::defaults() const
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;
}
@@ -112,6 +146,10 @@ bool AbstractCallgrindSettings::fromMap(const QVariantMap &map)
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;
}
@@ -122,7 +160,10 @@ QVariantMap AbstractCallgrindSettings::toMap() const
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;
}
@@ -158,7 +199,6 @@ QVariantMap CallgrindGlobalSettings::defaults() const
QVariantMap map = AbstractCallgrindSettings::defaults();
map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
map.insert(QLatin1String(callgrindCycleDetectionC), true);
- map.insert(QLatin1String(callgrindMinimumCostRatioC), 0.0001);
return map;
}
@@ -170,7 +210,6 @@ bool CallgrindGlobalSettings::fromMap(const QVariantMap &map)
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(QLatin1String(callgrindCostFormatC)).toInt());
}
setIfPresent(map, QLatin1String(callgrindCycleDetectionC), &m_detectCycles);
- setIfPresent(map, QLatin1String(callgrindMinimumCostRatioC), &m_minimumInclusiveCostRatio);
return true;
}
@@ -179,7 +218,6 @@ QVariantMap CallgrindGlobalSettings::toMap() const
QVariantMap map = AbstractCallgrindSettings::toMap();
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles);
- map.insert(QLatin1String(callgrindMinimumCostRatioC), m_minimumInclusiveCostRatio);
return map;
}
@@ -205,17 +243,6 @@ void CallgrindGlobalSettings::setDetectCycles(bool detect)
AnalyzerGlobalSettings::instance()->writeSettings();
}
-double CallgrindGlobalSettings::minimumInclusiveCostRatio() const
-{
- return m_minimumInclusiveCostRatio;
-}
-
-void CallgrindGlobalSettings::setMinimumInclusiveCostRatio(double minimumInclusiveCost)
-{
- m_minimumInclusiveCostRatio = minimumInclusiveCost;
- AnalyzerGlobalSettings::instance()->writeSettings();
-}
-
CallgrindProjectSettings::CallgrindProjectSettings(QObject *parent)
: AbstractCallgrindSettings(parent)
{
diff --git a/src/plugins/callgrind/callgrindsettings.h b/src/plugins/callgrind/callgrindsettings.h
index e83ef94990f..a0303587b78 100644
--- a/src/plugins/callgrind/callgrindsettings.h
+++ b/src/plugins/callgrind/callgrindsettings.h
@@ -56,6 +56,13 @@ public:
inline bool enableBranchSim() const { return m_enableBranchSim; }
inline bool collectSystime() const { return m_collectSystime; }
inline bool collectBusEvents() const { return m_collectBusEvents; }
+ inline bool enableEventToolTips() const { return m_enableEventToolTips; }
+
+ /// \return Minimum cost ratio, range [0.0..100.0]
+ inline double minimumInclusiveCostRatio() const { return m_minimumInclusiveCostRatio; }
+
+ /// \return Minimum cost ratio, range [0.0..100.0]
+ inline double visualisationMinimumInclusiveCostRatio() const { return m_visualisationMinimumInclusiveCostRatio; }
// abstract virtual methods from base class
virtual bool fromMap(const QVariantMap &map);
@@ -71,12 +78,22 @@ public Q_SLOTS:
void setEnableBranchSim(bool enable);
void setCollectSystime(bool collect);
void setCollectBusEvents(bool collect);
+ void setEnableEventToolTips(bool enable);
+
+ /// \param minimumInclusiveCostRatio Minimum inclusive cost ratio, valid values are [0.0..100.0]
+ void setMinimumInclusiveCostRatio(double minimumInclusiveCostRatio);
+
+ /// \param minimumInclusiveCostRatio Minimum inclusive cost ratio, valid values are [0.0..100.0]
+ void setVisualisationMinimumInclusiveCostRatio(double minimumInclusiveCostRatio);
Q_SIGNALS:
void enableCacheSimChanged(bool);
void enableBranchSimChanged(bool);
void collectSystimeChanged(bool);
void collectBusEventsChanged(bool);
+ void enableEventToolTipsChanged(bool);
+ void minimumInclusiveCostRatioChanged(double);
+ void visualisationMinimumInclusiveCostRatioChanged(double);
protected:
virtual QVariantMap toMap() const;
@@ -86,6 +103,9 @@ private:
bool m_collectSystime;
bool m_collectBusEvents;
bool m_enableBranchSim;
+ bool m_enableEventToolTips;
+ double m_minimumInclusiveCostRatio;
+ double m_visualisationMinimumInclusiveCostRatio;
};
/**
@@ -104,12 +124,10 @@ public:
CostDelegate::CostFormat costFormat() const;
bool detectCycles() const;
- double minimumInclusiveCostRatio() const;
public slots:
void setCostFormat(Callgrind::Internal::CostDelegate::CostFormat format);
void setDetectCycles(bool detect);
- void setMinimumInclusiveCostRatio(double minimumInclusiveCost);
protected:
virtual QVariantMap toMap() const;
@@ -117,7 +135,6 @@ protected:
private:
CostDelegate::CostFormat m_costFormat;
bool m_detectCycles;
- double m_minimumInclusiveCostRatio;
};
/**
diff --git a/src/plugins/callgrind/callgrindtool.cpp b/src/plugins/callgrind/callgrindtool.cpp
index dbfb98fbb3b..bd60118dd53 100644
--- a/src/plugins/callgrind/callgrindtool.cpp
+++ b/src/plugins/callgrind/callgrindtool.cpp
@@ -208,7 +208,7 @@ void CallgrindTool::extensionsInitialized()
analyzerContext);
editorContextMenu->addAction(cmd);
- action = new QAction(tr("Profile costs of this function and its callees"), this);
+ action = new QAction(tr("Profile Costs of this Function and its Callees"), this);
action->setIcon(QIcon(Analyzer::Constants::ANALYZER_CONTROL_START_ICON));
connect(action, SIGNAL(triggered()), SLOT(handleShowCostsOfFunction()));
cmd = actionManager->registerAction(action, Callgrind::Constants::A_SHOWCOSTSOFFUNCTION,
@@ -245,6 +245,15 @@ IAnalyzerEngine *CallgrindTool::createEngine(const AnalyzerStartParameters &sp,
AnalyzerManager::instance()->showStatusMessage(AnalyzerManager::msgToolStarted(displayName()));
+ // apply project settings
+ AnalyzerProjectSettings *analyzerSettings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
+ CallgrindProjectSettings *settings = analyzerSettings->subConfig<CallgrindProjectSettings>();
+ QTC_ASSERT(settings, return engine)
+
+ m_callgrindWidgetHandler->visualisation()->setMinimumInclusiveCostRatio(settings->visualisationMinimumInclusiveCostRatio() / 100.0);
+ m_callgrindWidgetHandler->proxyModel()->setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio() / 100.0);
+ m_callgrindWidgetHandler->dataModel()->setVerboseToolTipsEnabled(settings->enableEventToolTips());
+
return engine;
}
@@ -313,9 +322,6 @@ QWidget *CallgrindTool::createPaneToolBarWidget()
connect(m_callgrindWidgetHandler, SIGNAL(cycleDetectionEnabled(bool)),
settings, SLOT(setDetectCycles(bool)));
- // performance: add a minimum cost index so that we are not flooded by the results
- m_callgrindWidgetHandler->proxyModel()->setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio());
-
return toolbarWidget;
}
@@ -387,7 +393,7 @@ void CallgrindTool::requestContextMenu(TextEditor::ITextEditor *editor, int line
{
// find callgrind text mark that corresponds to this editor's file and line number
const Function *func = 0;
- foreach(CallgrindTextMark *textMark, m_textMarks) {
+ foreach (CallgrindTextMark *textMark, m_textMarks) {
if (textMark->fileName() == editor->file()->fileName() && textMark->lineNumber() == line) {
func = textMark->function();
break;
@@ -397,7 +403,7 @@ void CallgrindTool::requestContextMenu(TextEditor::ITextEditor *editor, int line
return; // no callgrind text mark under cursor, return
// add our action to the context menu
- QAction *action = new QAction(tr("Select this function in the analyzer output"), menu);
+ QAction *action = new QAction(tr("Select this Function in the Analyzer Output"), menu);
connect(action, SIGNAL(triggered()), this, SLOT(handleShowCostsAction()));
action->setData(QVariant::fromValue<const Function *>(func));
menu->addAction(action);
@@ -435,7 +441,7 @@ void CallgrindTool::handleShowCostsOfFunction()
void CallgrindTool::slotRequestDump()
{
- m_callgrindWidgetHandler->visualisation()->setText(tr("Populating..."));
+ m_callgrindWidgetHandler->slotRequestDump();
emit dumpRequested();
}
diff --git a/src/plugins/callgrind/callgrindvisualisation.cpp b/src/plugins/callgrind/callgrindvisualisation.cpp
index d8a1b2ca907..fbc14930bab 100644
--- a/src/plugins/callgrind/callgrindvisualisation.cpp
+++ b/src/plugins/callgrind/callgrindvisualisation.cpp
@@ -73,13 +73,9 @@ public:
const QStyleOptionGraphicsItem *option, QWidget *widget);
virtual QRectF boundingRect() const;
- void setRotateText(bool rotate);
-
private:
QString m_text;
QStaticText m_staticText;
- bool m_rotateText;
- QColor m_textColor;
qreal m_previousViewportDimension;
};
@@ -105,7 +101,6 @@ FunctionGraphicsTextItem::FunctionGraphicsTextItem(const QString &text,
QGraphicsItem *parent)
: QAbstractGraphicsShapeItem(parent)
, m_text(text)
- , m_rotateText(true)
, m_previousViewportDimension(0)
{
setFlag(QGraphicsItem::ItemIgnoresTransformations);
@@ -113,11 +108,6 @@ FunctionGraphicsTextItem::FunctionGraphicsTextItem(const QString &text,
setToolTip(text);
}
-void FunctionGraphicsTextItem::setRotateText(bool rotate)
-{
- m_rotateText = rotate;
-}
-
void FunctionGraphicsTextItem::paint(QPainter *painter,
const QStyleOptionGraphicsItem *,
QWidget *widget)
@@ -135,30 +125,17 @@ void FunctionGraphicsTextItem::paint(QPainter *painter,
* parentItem()->boundingRect().height()
/ scene()->sceneRect().height();
- qreal textMaxHeight;
- qreal textMaxWidth;
- qreal viewportDim;
- if (m_rotateText) {
- viewportDim = viewportRect.height();
- textMaxHeight = maxWidth;
- textMaxWidth = maxHeight;
- } else {
- viewportDim = viewportRect.width();
- textMaxHeight = maxHeight;
- textMaxWidth = maxWidth;
- }
-
- if (textHeight > textMaxHeight)
+ if (textHeight > maxHeight)
return;
- if (viewportDim != m_previousViewportDimension) {
+ if (viewportRect.width() != m_previousViewportDimension) {
const QString &elidedText =
painter->fontMetrics().elidedText(m_text, Qt::ElideRight,
- textMaxWidth);
+ maxWidth);
m_staticText.setText(elidedText);
m_staticText.prepare();
- m_previousViewportDimension = viewportDim;
+ m_previousViewportDimension = viewportRect.width();
}
#if VISUALISATION_DEBUG
@@ -169,16 +146,9 @@ void FunctionGraphicsTextItem::paint(QPainter *painter,
painter->save();
int textLeft = 0;
int textTop = 0;
- if (m_rotateText) {
- painter->rotate(90);
- textLeft = 2;
- textTop = -textHeight/2;
- }
- else {
- const int textWidth = painter->fontMetrics().width(m_staticText.text());
- textLeft = -textWidth/2;
- textTop = (maxHeight - textHeight)/2;
- }
+ const int textWidth = painter->fontMetrics().width(m_staticText.text());
+ textLeft = -textWidth/2;
+ textTop = (maxHeight - textHeight)/2;
painter->drawStaticText(textLeft, textTop, m_staticText);
painter->restore();
@@ -218,9 +188,10 @@ void FunctionGraphicsItem::paint(QPainter *painter,
QRectF rect = this->rect();
const QColor &color = brush().color();
if (option->state & QStyle::State_Selected) {
- QLinearGradient gradient(0, 0, rect.width(), rect.height());
- gradient.setColorAt(0, color.lighter(250));
- gradient.setColorAt(1, color.darker());
+ QLinearGradient gradient(0, 0, rect.width(), 0);
+ gradient.setColorAt(0, color.darker(100));
+ gradient.setColorAt(0.5, color.lighter(200));
+ gradient.setColorAt(1, color.darker(100));
painter->setBrush(gradient);
}
else {
@@ -256,13 +227,11 @@ public:
Visualisation *q;
DataProxyModel *m_model;
QGraphicsScene m_scene;
- int m_modelColumn;
};
Visualisation::Private::Private(Visualisation *qq)
: q(qq)
, m_model(new DataProxyModel(qq))
- , m_modelColumn(-1)
{
// setup scene
m_scene.setObjectName("Visualisation Scene");
@@ -286,7 +255,7 @@ void Visualisation::Private::handleMousePressEvent(QMouseEvent *event,
{
// find the first item that accepts mouse presses under the cursor position
QGraphicsItem *itemAtPos = 0;
- foreach(QGraphicsItem *item, q->items(event->pos())) {
+ foreach (QGraphicsItem *item, q->items(event->pos())) {
if (!(item->acceptedMouseButtons() & event->button()))
continue;
@@ -342,7 +311,7 @@ const Function *Visualisation::functionForItem(QGraphicsItem *item) const
QGraphicsItem *Visualisation::itemForFunction(const Function *function) const
{
- foreach(QGraphicsItem *item, items()) {
+ foreach (QGraphicsItem *item, items()) {
if (functionForItem(item) == function)
return item;
}
@@ -359,6 +328,11 @@ const Function *Visualisation::function() const
return d->m_model->filterFunction();
}
+void Visualisation::setMinimumInclusiveCostRatio(double ratio)
+{
+ d->m_model->setMinimumInclusiveCostRatio(ratio);
+}
+
void Visualisation::setModel(DataModel *model)
{
QTC_ASSERT(!d->m_model->sourceModel() && model, return); // only set once!
@@ -450,28 +424,26 @@ void Visualisation::populateScene()
const QColor background = CallgrindHelper::colorForString(text);
item->setBrush(background);
item->setData(FunctionGraphicsItem::FunctionCallKey, QVariant::fromValue(d->m_model->filterFunction()));
- item->textItem()->setRotateText(false);
// NOTE: workaround wrong tooltip being show, no idea why...
item->setZValue(-1);
d->m_scene.addItem(item);
}
// add the canvas elements to the scene
- qreal used = 0;
- foreach(const Pair &cost, costs)
+ qreal used = sceneHeight * 0.1;
+ foreach (const Pair &cost, costs)
{
const QModelIndex &index = cost.first;
const QString text = index.data().toString();
- const qreal width = (sceneWidth * cost.second) / total;
- const qreal height = sceneHeight * 0.9;
+ const qreal height = (sceneHeight * 0.9 * cost.second) / total;
- FunctionGraphicsItem *item = new FunctionGraphicsItem(text, used, sceneHeight - height, width, height);
+ FunctionGraphicsItem *item = new FunctionGraphicsItem(text, 0, used, sceneWidth, height);
const QColor background = CallgrindHelper::colorForString(text);
item->setBrush(background);
item->setData(FunctionGraphicsItem::FunctionCallKey, index.data(DataModel::FunctionRole));
d->m_scene.addItem(item);
- used += width;
+ used += height;
}
}
diff --git a/src/plugins/callgrind/callgrindvisualisation.h b/src/plugins/callgrind/callgrindvisualisation.h
index eb6d65a1015..f687311619c 100644
--- a/src/plugins/callgrind/callgrindvisualisation.h
+++ b/src/plugins/callgrind/callgrindvisualisation.h
@@ -66,6 +66,8 @@ public:
void setFunction(const Valgrind::Callgrind::Function *function);
const Valgrind::Callgrind::Function *function() const;
+ void setMinimumInclusiveCostRatio(double ratio);
+
public slots:
void setText(const QString &message);
diff --git a/src/plugins/callgrind/callgrindwidgethandler.cpp b/src/plugins/callgrind/callgrindwidgethandler.cpp
index f19003cc421..8110b074c74 100644
--- a/src/plugins/callgrind/callgrindwidgethandler.cpp
+++ b/src/plugins/callgrind/callgrindwidgethandler.cpp
@@ -36,10 +36,6 @@
#include "callgrindengine.h"
#include "callgrindvisualisation.h"
-#ifndef DISABLE_CALLGRIND_WORKAROUNDS
-#include "workarounds.h"
-#endif
-
#include <analyzerbase/analyzerconstants.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
@@ -129,6 +125,7 @@ void CallgrindWidgetHandler::ensureDockWidgets()
return;
QWidget *parenWidget = qobject_cast<QWidget *>(parent());
m_visualisation = new Visualisation(parenWidget);
+ m_visualisation->setFrameStyle(QFrame::NoFrame);
m_visualisation->setObjectName("Valgrind.CallgrindWidgetHandler.Visualisation");
m_visualisation->setModel(m_dataModel);
connect(m_visualisation, SIGNAL(functionActivated(const Valgrind::Callgrind::Function*)),
@@ -137,6 +134,7 @@ void CallgrindWidgetHandler::ensureDockWidgets()
m_callersView = new CostView(parenWidget);
m_callersView->sortByColumn(CallModel::CostColumn);
m_callersView->setObjectName("Valgrind.CallgrindWidgetHandler.CallersView");
+ m_callersView->setFrameStyle(QFrame::NoFrame);
// enable sorting
QSortFilterProxyModel *callerProxy = new QSortFilterProxyModel(m_callersModel);
callerProxy->setSourceModel(m_callersModel);
@@ -148,6 +146,7 @@ void CallgrindWidgetHandler::ensureDockWidgets()
m_calleesView = new CostView(parenWidget);
m_calleesView->sortByColumn(CallModel::CostColumn);
m_calleesView->setObjectName("Valgrind.CallgrindWidgetHandler.CalleesView");
+ m_calleesView->setFrameStyle(QFrame::NoFrame);
// enable sorting
QSortFilterProxyModel *calleeProxy = new QSortFilterProxyModel(m_calleesModel);
calleeProxy->setSourceModel(m_calleesModel);
@@ -247,7 +246,7 @@ void CallgrindWidgetHandler::populateActions(QLayout *layout)
menu->addAction(m_costRelative);
// show costs relative to parent
- m_costRelativeToParent = new QAction(tr("Relative Costs To Parent"), this);
+ m_costRelativeToParent = new QAction(tr("Relative Costs to Parent"), this);
///FIXME: icon
m_costRelativeToParent->setToolTip(tr("Show costs relative to parent functions inclusive cost."));
m_costRelativeToParent->setCheckable(true);
@@ -333,8 +332,19 @@ void CallgrindWidgetHandler::doClear(bool clearParseData)
void CallgrindWidgetHandler::slotRequestDump()
{
+ setBusy(true);
+
m_visualisation->setText(tr("Populating..."));
- emit dumpRequested();
+}
+
+void CallgrindWidgetHandler::setBusy(bool busy)
+{
+ QCursor cursor(busy ? Qt::BusyCursor : Qt::ArrowCursor);
+ QList<QWidget *> widgets;
+ widgets << m_flatView << m_calleesView << m_callersView << m_visualisation;
+ foreach(QWidget *widget, widgets) {
+ widget->setCursor(cursor);
+ }
}
void CallgrindWidgetHandler::selectFunction(const Function *func)
@@ -386,7 +396,7 @@ void CallgrindWidgetHandler::updateFilterString()
void CallgrindWidgetHandler::setCostFormat(CostDelegate::CostFormat format)
{
- switch(format) {
+ switch (format) {
case CostDelegate::FormatAbsolute:
m_costAbsolute->setChecked(true);
break;
@@ -510,6 +520,9 @@ void CallgrindWidgetHandler::setParseData(ParseData *data)
// clear history for new data
m_stackBrowser->clear();
+
+ // unset busy state
+ setBusy(false);
}
void CallgrindWidgetHandler::updateEventCombo()
@@ -525,7 +538,7 @@ void CallgrindWidgetHandler::updateEventCombo()
}
m_eventCombo->show();
- foreach(const QString &event, data->events())
+ foreach (const QString &event, data->events())
m_eventCombo->addItem(ParseData::prettyStringForEvent(event));
}
diff --git a/src/plugins/callgrind/callgrindwidgethandler.h b/src/plugins/callgrind/callgrindwidgethandler.h
index a378e91b602..aa02bff108a 100644
--- a/src/plugins/callgrind/callgrindwidgethandler.h
+++ b/src/plugins/callgrind/callgrindwidgethandler.h
@@ -94,10 +94,6 @@ public:
Callgrind::Internal::CostDelegate::CostFormat costFormat() const;
signals:
- void dumpRequested();
- void resetRequested();
- void pauseToggled(bool checked);
-
void functionSelected(const Valgrind::Callgrind::Function *);
void costFormatChanged(Callgrind::Internal::CostDelegate::CostFormat format);
@@ -121,6 +117,9 @@ private slots:
void slotGoToOverview();
void stackBrowserChanged();
+ /// If \param busy is true, all widgets get a busy cursor when hovered
+ void setBusy(bool busy);
+
void dataFunctionSelected(const QModelIndex &index);
void calleeFunctionSelected(const QModelIndex &index);
void callerFunctionSelected(const QModelIndex &index);
@@ -138,6 +137,7 @@ private:
Valgrind::Callgrind::CallModel *m_callersModel;
Valgrind::Callgrind::CallModel *m_calleesModel;
+ // callgrind widgets
CostView *m_flatView;
CostView *m_callersView;
CostView *m_calleesView;
diff --git a/src/plugins/memcheck/memcheckconfigwidget.cpp b/src/plugins/memcheck/memcheckconfigwidget.cpp
index eca10b09612..dc5c1334ca9 100644
--- a/src/plugins/memcheck/memcheckconfigwidget.cpp
+++ b/src/plugins/memcheck/memcheckconfigwidget.cpp
@@ -76,7 +76,7 @@ MemcheckConfigWidget::MemcheckConfigWidget(AbstractMemcheckSettings *settings, Q
this, SLOT(slotSuppressionsAdded(QStringList)));
m_model->clear();
- foreach(const QString &file, m_settings->suppressionFiles())
+ foreach (const QString &file, m_settings->suppressionFiles())
m_model->appendRow(new QStandardItem(file));
connect(m_ui->suppressionList->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
@@ -101,7 +101,7 @@ void MemcheckConfigWidget::slotAddSuppression()
dialog.setHistory(conf->lastSuppressionDialogHistory());
if (dialog.exec() == QDialog::Accepted) {
- foreach(const QString &file, dialog.selectedFiles())
+ foreach (const QString &file, dialog.selectedFiles())
m_model->appendRow(new QStandardItem(file));
m_settings->addSuppressionFiles(dialog.selectedFiles());
@@ -114,10 +114,10 @@ void MemcheckConfigWidget::slotAddSuppression()
void MemcheckConfigWidget::slotSuppressionsAdded(const QStringList &files)
{
QStringList filesToAdd = files;
- for(int i = 0, c = m_model->rowCount(); i < c; ++i)
+ for (int i = 0, c = m_model->rowCount(); i < c; ++i)
filesToAdd.removeAll(m_model->item(i)->text());
- foreach(const QString &file, filesToAdd)
+ foreach (const QString &file, filesToAdd)
m_model->appendRow(new QStandardItem(file));
}
@@ -132,14 +132,14 @@ void MemcheckConfigWidget::slotRemoveSuppression()
QList<int> rows;
QStringList removed;
- foreach(const QModelIndex &index, m_ui->suppressionList->selectionModel()->selectedIndexes()) {
+ foreach (const QModelIndex &index, m_ui->suppressionList->selectionModel()->selectedIndexes()) {
rows << index.row();
removed << index.data().toString();
}
qSort(rows.begin(), rows.end(), sortReverse);
- foreach(int row, rows)
+ foreach (int row, rows)
m_model->removeRow(row);
m_settings->removeSuppressionFiles(removed);
@@ -147,7 +147,7 @@ void MemcheckConfigWidget::slotRemoveSuppression()
void MemcheckConfigWidget::slotSuppressionsRemoved(const QStringList &files)
{
- for(int i = 0; i < m_model->rowCount(); ++i) {
+ for (int i = 0; i < m_model->rowCount(); ++i) {
if (files.contains(m_model->item(i)->text())) {
m_model->removeRow(i);
--i;
@@ -158,7 +158,7 @@ void MemcheckConfigWidget::slotSuppressionsRemoved(const QStringList &files)
void MemcheckConfigWidget::setSuppressions(const QStringList &files)
{
m_model->clear();
- foreach(const QString &file, files)
+ foreach (const QString &file, files)
m_model->appendRow(new QStandardItem(file));
}
@@ -166,7 +166,7 @@ QStringList MemcheckConfigWidget::suppressions() const
{
QStringList ret;
- for(int i = 0; i < m_model->rowCount(); ++i)
+ for (int i = 0; i < m_model->rowCount(); ++i)
ret << m_model->item(i)->text();
return ret;
diff --git a/src/plugins/memcheck/memcheckengine.cpp b/src/plugins/memcheck/memcheckengine.cpp
index 0cb7b531808..f60ae31e7a8 100644
--- a/src/plugins/memcheck/memcheckengine.cpp
+++ b/src/plugins/memcheck/memcheckengine.cpp
@@ -101,7 +101,7 @@ QStringList MemcheckEngine::toolArguments() const
if (memcheckSettings->trackOrigins())
arguments << QLatin1String("--track-origins=yes");
- foreach(const QString &file, memcheckSettings->suppressionFiles())
+ foreach (const QString &file, memcheckSettings->suppressionFiles())
arguments << QString("--suppressions=%1").arg(file);
arguments << QString("--num-callers=%1").arg(memcheckSettings->numCallers());
diff --git a/src/plugins/memcheck/memcheckerrorview.cpp b/src/plugins/memcheck/memcheckerrorview.cpp
index ce8b6b0db2c..ecdd6140414 100644
--- a/src/plugins/memcheck/memcheckerrorview.cpp
+++ b/src/plugins/memcheck/memcheckerrorview.cpp
@@ -176,7 +176,7 @@ QString errorLocation(const QModelIndex &index, const Error &error,
{
const ErrorListModel *model = 0;
const QAbstractProxyModel *proxy = qobject_cast<const QAbstractProxyModel *>(index.model());
- while(!model && proxy) {
+ while (!model && proxy) {
model = qobject_cast<const ErrorListModel *>(proxy->sourceModel());
proxy = qobject_cast<const QAbstractProxyModel *>(proxy->sourceModel());
};
@@ -393,12 +393,12 @@ void MemcheckErrorDelegate::copy()
const QString relativeTo = relativeToPath();
- foreach(const Stack &stack, error.stacks()) {
+ foreach (const Stack &stack, error.stacks()) {
if (!stack.auxWhat().isEmpty()) {
stream << stack.auxWhat();
}
int i = 1;
- foreach(const Frame &frame, stack.frames()) {
+ foreach (const Frame &frame, stack.frames()) {
stream << " " << i++ << ": " << makeFrameName(frame, relativeTo) << "\n";
}
}
@@ -488,7 +488,7 @@ void MemcheckErrorView::contextMenuEvent(QContextMenuEvent *e)
QList<Error> errors;
- foreach(const QModelIndex &index, indizes) {
+ foreach (const QModelIndex &index, indizes) {
Error error = model()->data(index, ErrorListModel::ErrorRole).value<Error>();
if (!error.suppression().isNull())
errors << error;
diff --git a/src/plugins/memcheck/memchecksettings.cpp b/src/plugins/memcheck/memchecksettings.cpp
index bb7486a18d6..ce03630a0ca 100644
--- a/src/plugins/memcheck/memchecksettings.cpp
+++ b/src/plugins/memcheck/memchecksettings.cpp
@@ -73,7 +73,7 @@ QVariantMap AbstractMemcheckSettings::defaults() const
map.insert(QLatin1String(filterExternalIssuesC), true);
QVariantList defaultErrorKinds;
- for(int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
+ for (int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
defaultErrorKinds << i;
map.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds);
diff --git a/src/plugins/memcheck/memchecktool.cpp b/src/plugins/memcheck/memchecktool.cpp
index 37be4a7f82c..ea8ae6fcbe5 100644
--- a/src/plugins/memcheck/memchecktool.cpp
+++ b/src/plugins/memcheck/memchecktool.cpp
@@ -164,10 +164,10 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel
ProjectExplorer::SessionManager *session
= ProjectExplorer::ProjectExplorerPlugin::instance()->session();
QSet<QString> validFolders;
- foreach(ProjectExplorer::Project *project, session->projects()) {
+ foreach (ProjectExplorer::Project *project, session->projects()) {
validFolders << project->projectDirectory();
- foreach(ProjectExplorer::Target *target, project->targets()) {
- foreach(ProjectExplorer::BuildConfiguration *config, target->buildConfigurations()) {
+ foreach (ProjectExplorer::Target *target, project->targets()) {
+ foreach (ProjectExplorer::BuildConfiguration *config, target->buildConfigurations()) {
validFolders << config->buildDirectory();
}
}
@@ -180,7 +180,7 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel
bool inProject = false;
for ( int i = 0; i < framesToLookAt; ++i ) {
const Frame &frame = frames.at(i);
- foreach(const QString &folder, validFolders) {
+ foreach (const QString &folder, validFolders) {
if (frame.object().startsWith(folder)) {
inProject = true;
break;
@@ -333,7 +333,7 @@ public:
//find the first frame belonging to the project
if (!m_projectFiles.isEmpty()) {
- foreach(const Frame &frame, frames) {
+ foreach (const Frame &frame, frames) {
if (frame.directory().isEmpty() || frame.file().isEmpty())
continue;
@@ -345,7 +345,7 @@ public:
}
//if no frame belonging to the project was found, return the first one that is not malloc/new
- foreach(const Frame &frame, frames) {
+ foreach (const Frame &frame, frames) {
if (!frame.functionName().isEmpty() && frame.functionName() != QLatin1String("malloc")
&& !frame.functionName().startsWith("operator new(") )
{
@@ -455,7 +455,7 @@ void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
QMenu *menu = filterMenu();
QTC_ASSERT(menu, return);
- foreach(const QString &file, mEngine->suppressionFiles()) {
+ foreach (const QString &file, mEngine->suppressionFiles()) {
QAction *action = menu->addAction(QFileInfo(file).fileName());
action->setToolTip(file);
action->setData(file);
diff --git a/src/plugins/memcheck/suppressiondialog.cpp b/src/plugins/memcheck/suppressiondialog.cpp
index 9f8cf31c720..abf9261cd35 100644
--- a/src/plugins/memcheck/suppressiondialog.cpp
+++ b/src/plugins/memcheck/suppressiondialog.cpp
@@ -163,13 +163,13 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, QWidget *parent, Q
// can happen when using arrow keys to navigate and shortcut to trigger suppression
indizes << m_view->selectionModel()->currentIndex();
}
- foreach(const QModelIndex &index, indizes) {
+ foreach (const QModelIndex &index, indizes) {
Error error = m_view->model()->data(index, ErrorListModel::ErrorRole).value<Error>();
if (!error.suppression().isNull())
m_errors << error;
}
- foreach(const Error &error, m_errors)
+ foreach (const Error &error, m_errors)
suppressions += suppressionText(error);
m_ui->suppressionEdit->setPlainText(suppressions);
@@ -198,7 +198,7 @@ void SuppressionDialog::accept()
// add file to project (if there is a project that contains this file on the file system)
ProjectExplorer::SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
if (!session->projectForFile(path)) {
- foreach(ProjectExplorer::Project *p, session->projects()) {
+ foreach (ProjectExplorer::Project *p, session->projects()) {
if (path.startsWith(p->projectDirectory())) {
p->rootProjectNode()->addFiles(ProjectExplorer::UnknownFileType, QStringList() << path);
break;
@@ -210,7 +210,7 @@ void SuppressionDialog::accept()
QModelIndexList indizes = m_view->selectionModel()->selectedRows();
qSort(indizes.begin(), indizes.end(), sortIndizesReverse);
- foreach(const QModelIndex &index, indizes) {
+ foreach (const QModelIndex &index, indizes) {
bool removed = m_view->model()->removeRow(index.row());
QTC_ASSERT(removed, qt_noop());
Q_UNUSED(removed);
@@ -221,7 +221,7 @@ void SuppressionDialog::accept()
const Error rowError = m_view->model()->data(
m_view->model()->index(row, 0), ErrorListModel::ErrorRole).value<Error>();
- foreach(const Error &error, m_errors) {
+ foreach (const Error &error, m_errors) {
if (equalSuppression(rowError, error)) {
bool removed = m_view->model()->removeRow(row);
QTC_ASSERT(removed, qt_noop());
diff --git a/src/plugins/valgrindtoolbase/valgrindengine.cpp b/src/plugins/valgrindtoolbase/valgrindengine.cpp
index 04166871d3f..78991b94469 100644
--- a/src/plugins/valgrindtoolbase/valgrindengine.cpp
+++ b/src/plugins/valgrindtoolbase/valgrindengine.cpp
@@ -41,6 +41,10 @@
#include <coreplugin/progressmanager/futureprogress.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/applicationrunconfiguration.h>
+#include <analyzerbase/analyzermanager.h>
+
+#include <QtGui/QApplication>
+#include <QtGui/QMainWindow>
#define VALGRIND_DEBUG_OUTPUT 0
@@ -52,7 +56,8 @@ ValgrindEngine::ValgrindEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
: IAnalyzerEngine(sp, runConfiguration),
m_settings(0),
- m_progress(new QFutureInterface<void>()) ,
+ m_progress(new QFutureInterface<void>()),
+ m_progressWatcher(new QFutureWatcher<void>()),
m_isStopping(false)
{
if (runConfiguration)
@@ -60,6 +65,11 @@ ValgrindEngine::ValgrindEngine(const AnalyzerStartParameters &sp,
if (!m_settings)
m_settings = AnalyzerGlobalSettings::instance();
+
+ connect(m_progressWatcher, SIGNAL(canceled()),
+ this, SLOT(handleProgressCanceled()));
+ connect(m_progressWatcher, SIGNAL(finished()),
+ this, SLOT(handleProgressFinished()));
}
ValgrindEngine::~ValgrindEngine()
@@ -75,6 +85,7 @@ void ValgrindEngine::start()
progressTitle(), "valgrind");
fp->setKeepOnFinish(Core::FutureProgress::DontKeepOnFinish);
m_progress->reportStarted();
+ m_progressWatcher->setFuture(m_progress->future());
#if VALGRIND_DEBUG_OUTPUT
emit standardOutputReceived(tr("Valgrind options: %1").arg(toolArguments().join(" ")));
@@ -119,6 +130,16 @@ QString ValgrindEngine::executable() const
return startParameters().debuggee;
}
+void ValgrindEngine::handleProgressCanceled()
+{
+ AnalyzerManager::instance()->stopTool();
+}
+
+void ValgrindEngine::handleProgressFinished()
+{
+ QApplication::alert(Core::ICore::instance()->mainWindow(), 3000);
+}
+
void ValgrindEngine::runnerFinished()
{
emit standardOutputReceived(tr("** Analyzing finished **"));
@@ -167,7 +188,7 @@ void ValgrindEngine::receiveProcessError(const QString &error, QProcess::Process
///FIXME: get a better API for this into Qt Creator
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
QList< Core::IOutputPane *> panes = pm->getObjects<Core::IOutputPane>();
- foreach(Core::IOutputPane *pane, panes) {
+ foreach (Core::IOutputPane *pane, panes) {
if (pane->displayName() == tr("Application Output")) {
pane->popup(false);
break;
diff --git a/src/plugins/valgrindtoolbase/valgrindengine.h b/src/plugins/valgrindtoolbase/valgrindengine.h
index 454e3745a9b..371fe461451 100644
--- a/src/plugins/valgrindtoolbase/valgrindengine.h
+++ b/src/plugins/valgrindtoolbase/valgrindengine.h
@@ -48,6 +48,7 @@
#include <QtCore/QString>
#include <QtCore/QByteArray>
#include <QtCore/QFutureInterface>
+#include <QtCore/QFutureWatcher>
namespace Analyzer {
class AnalyzerSettings;
@@ -76,8 +77,11 @@ protected:
Analyzer::AnalyzerSettings *m_settings;
QFutureInterface<void> *m_progress;
+ QFutureWatcher<void> *m_progressWatcher;
private slots:
+ void handleProgressCanceled();
+ void handleProgressFinished();
void runnerFinished();
void receiveStandardOutput(const QByteArray &);
diff --git a/tests/valgrind/callgrind/callgrindparsertests.cpp b/tests/valgrind/callgrind/callgrindparsertests.cpp
index c75492d2945..73a6c8bd4d1 100644
--- a/tests/valgrind/callgrind/callgrindparsertests.cpp
+++ b/tests/valgrind/callgrind/callgrindparsertests.cpp
@@ -368,7 +368,7 @@ void CallgrindParserTests::testMultiPosAndCost()
const Function *findFunction(const QString &needle, const QVector<const Function *> &haystack)
{
- foreach(const Function *function, haystack) {
+ foreach (const Function *function, haystack) {
if (function->name() == needle) {
return function;
}
diff --git a/tests/valgrind/callgrind/modeltest.cpp b/tests/valgrind/callgrind/modeltest.cpp
index c98c6cc1efa..53030f8c6b3 100644
--- a/tests/valgrind/callgrind/modeltest.cpp
+++ b/tests/valgrind/callgrind/modeltest.cpp
@@ -162,9 +162,9 @@ void ModelTestWidget::showViewContextMenu(const QPoint &pos)
QVector<quint64> totalCosts;
totalCosts.fill(0, data->events().size());
- for(int row = 0; row < rows; ++row) {
+ for (int row = 0; row < rows; ++row) {
const CostItem *item = func->costItems().at(row);
- for(int column = 0; column < columns; ++column) {
+ for (int column = 0; column < columns; ++column) {
QVariant value;
if (column < lastEventColumn) {
value = item->cost(column);
@@ -181,7 +181,7 @@ void ModelTestWidget::showViewContextMenu(const QPoint &pos)
}
}
QStringList totalCostsStrings;
- for(int i = 0; i < totalCosts.size(); ++i) {
+ for (int i = 0; i < totalCosts.size(); ++i) {
totalCostsStrings << QString("%1: %2").arg(totalCosts.at(i)).arg(data->events().at(i));
}
view->setWindowTitle(totalCostsStrings.join(QLatin1String(", ")));