forked from qt-creator/qt-creator
Fixes for valgrind-callgrind feedback by Nokia
Most changes include style fixes and UI changes for better usability. Merge-request: 324 Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
@@ -208,11 +208,21 @@ QVariant CallModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
QVariant CallModel::headerData(int section, Qt::Orientation orientation, 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();
|
return QVariant();
|
||||||
|
|
||||||
QTC_ASSERT(section >= 0 && section < columnCount(), 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)
|
if (section == CalleeColumn)
|
||||||
return tr("Callee");
|
return tr("Callee");
|
||||||
else if (section == CallerColumn)
|
else if (section == CallerColumn)
|
||||||
|
@@ -80,7 +80,7 @@ QString toOptionString(CallgrindController::Option option)
|
|||||||
-w=<dir> Specify the startup directory of an active Callgrind run
|
-w=<dir> Specify the startup directory of an active Callgrind run
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch(option) {
|
switch (option) {
|
||||||
case CallgrindController::Dump:
|
case CallgrindController::Dump:
|
||||||
return "--dump";
|
return "--dump";
|
||||||
case CallgrindController::ResetEventCounters:
|
case CallgrindController::ResetEventCounters:
|
||||||
@@ -118,7 +118,7 @@ void CallgrindController::run(Option option)
|
|||||||
|
|
||||||
const QString optionString = toOptionString(option);
|
const QString optionString = toOptionString(option);
|
||||||
|
|
||||||
switch(option) {
|
switch (option) {
|
||||||
case CallgrindController::Dump:
|
case CallgrindController::Dump:
|
||||||
emit statusMessage(tr("Dumping profile data..."));
|
emit statusMessage(tr("Dumping profile data..."));
|
||||||
break;
|
break;
|
||||||
@@ -167,7 +167,7 @@ void CallgrindController::processFinished(int rc, QProcess::ExitStatus status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this call went fine, we might run another task after this
|
// this call went fine, we might run another task after this
|
||||||
switch(m_lastOption) {
|
switch (m_lastOption) {
|
||||||
case ResetEventCounters:
|
case ResetEventCounters:
|
||||||
// lets dump the new reset profiling info
|
// lets dump the new reset profiling info
|
||||||
run(Dump);
|
run(Dump);
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include <qprocess.h>
|
#include <qprocess.h>
|
||||||
#include <qmetatype.h>
|
|
||||||
|
|
||||||
#include <utils/ssh/sshconnection.h>
|
#include <utils/ssh/sshconnection.h>
|
||||||
#include <utils/ssh/sshremoteprocess.h>
|
#include <utils/ssh/sshremoteprocess.h>
|
||||||
@@ -69,6 +68,7 @@ public:
|
|||||||
void run(Valgrind::Callgrind::CallgrindController::Option option);
|
void run(Valgrind::Callgrind::CallgrindController::Option option);
|
||||||
|
|
||||||
void setValgrindProcess(ValgrindProcess *process);
|
void setValgrindProcess(ValgrindProcess *process);
|
||||||
|
inline ValgrindProcess *valgrindProcess() { return m_valgrindProc; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make data file available locally, triggers @c localParseDataAvailable.
|
* Make data file available locally, triggers @c localParseDataAvailable.
|
||||||
@@ -96,7 +96,7 @@ private Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
void cleanupTempFile();
|
void cleanupTempFile();
|
||||||
|
|
||||||
// callgrind_controll process
|
// callgrind_control process
|
||||||
Valgrind::ValgrindProcess *m_process;
|
Valgrind::ValgrindProcess *m_process;
|
||||||
// valgrind process
|
// valgrind process
|
||||||
Valgrind::ValgrindProcess *m_valgrindProc;
|
Valgrind::ValgrindProcess *m_valgrindProc;
|
||||||
|
@@ -55,14 +55,14 @@ CycleDetection::CycleDetection(ParseData *data)
|
|||||||
|
|
||||||
QVector<const Function *> CycleDetection::run(const QVector<const Function *> &input)
|
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 *node = new Node;
|
||||||
node->function = function;
|
node->function = function;
|
||||||
node->dfs = -1;
|
node->dfs = -1;
|
||||||
node->lowlink = -1;
|
node->lowlink = -1;
|
||||||
m_nodes.insert(function, node);
|
m_nodes.insert(function, node);
|
||||||
}
|
}
|
||||||
foreach(Node *node, m_nodes) {
|
foreach (Node *node, m_nodes) {
|
||||||
if (node->dfs == -1)
|
if (node->dfs == -1)
|
||||||
tarjan(node);
|
tarjan(node);
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ void CycleDetection::tarjan(Node *node)
|
|||||||
m_depth++;
|
m_depth++;
|
||||||
m_stack.push(node);
|
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()));
|
tarjanForChildNode(node, m_nodes.value(call->callee()));
|
||||||
|
|
||||||
if (node->dfs == node->lowlink) {
|
if (node->dfs == node->lowlink) {
|
||||||
@@ -88,7 +88,7 @@ void CycleDetection::tarjan(Node *node)
|
|||||||
do {
|
do {
|
||||||
n = m_stack.pop();
|
n = m_stack.pop();
|
||||||
functions << n->function;
|
functions << n->function;
|
||||||
} while(n != node);
|
} while (n != node);
|
||||||
|
|
||||||
if (functions.size() == 1) {
|
if (functions.size() == 1) {
|
||||||
// not a real cycle
|
// not a real cycle
|
||||||
|
@@ -65,6 +65,7 @@ public:
|
|||||||
Private()
|
Private()
|
||||||
: m_data(0)
|
: m_data(0)
|
||||||
, m_event(0)
|
, m_event(0)
|
||||||
|
, m_verboseToolTips(true)
|
||||||
, m_cycleDetection(false)
|
, m_cycleDetection(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -77,6 +78,7 @@ public:
|
|||||||
|
|
||||||
const ParseData *m_data;
|
const ParseData *m_data;
|
||||||
int m_event;
|
int m_event;
|
||||||
|
bool m_verboseToolTips;
|
||||||
bool m_cycleDetection;
|
bool m_cycleDetection;
|
||||||
QVector<const Function *> m_functions;
|
QVector<const Function *> m_functions;
|
||||||
};
|
};
|
||||||
@@ -128,6 +130,16 @@ void DataModel::setParseData(const ParseData *data)
|
|||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataModel::setVerboseToolTipsEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
d->m_verboseToolTips = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DataModel::verboseToolTipsEnabled() const
|
||||||
|
{
|
||||||
|
return d->m_verboseToolTips;
|
||||||
|
}
|
||||||
|
|
||||||
const ParseData *DataModel::parseData() const
|
const ParseData *DataModel::parseData() const
|
||||||
{
|
{
|
||||||
return d->m_data;
|
return d->m_data;
|
||||||
@@ -254,6 +266,9 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
|
|||||||
else if (index.column() == InclusiveCostColumn)
|
else if (index.column() == InclusiveCostColumn)
|
||||||
return inclusiveCost;
|
return inclusiveCost;
|
||||||
} else if (role == Qt::ToolTipRole) {
|
} else if (role == Qt::ToolTipRole) {
|
||||||
|
if (!d->m_verboseToolTips)
|
||||||
|
return data(index, Qt::DisplayRole);
|
||||||
|
|
||||||
QString ret = "<html><head><style>\
|
QString ret = "<html><head><style>\
|
||||||
dt { font-weight: bold; }\
|
dt { font-weight: bold; }\
|
||||||
dd { font-family: monospace; }\
|
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";
|
ret += "<dt>" + tr("File:") + "</dt><dd>" + func->file() + "</dd>\n";
|
||||||
if (!func->costItems().isEmpty()) {
|
if (!func->costItems().isEmpty()) {
|
||||||
const CostItem *firstItem = func->costItems().first();
|
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 += "<dt>" + ParseData::prettyStringForPosition(d->m_data->positions().at(i)) + "</dt>";
|
||||||
ret += "<dd>" + QString::number(firstItem->position(i)) + "</dd>\n";
|
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 += "<td class='group'>" + tr("Incl. costs") + "</td><td>" + tr("(%)") + "</td>";
|
||||||
ret += "</tr></thead>";
|
ret += "</tr></thead>";
|
||||||
ret += "<tbody>";
|
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 selfCost = func->selfCost(i);
|
||||||
quint64 inclCost = func->inclusiveCost(i);
|
quint64 inclCost = func->inclusiveCost(i);
|
||||||
quint64 totalCost = d->m_data->totalCost(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
|
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();
|
return QVariant();
|
||||||
|
|
||||||
QTC_ASSERT(section >= 0 && section < columnCount(), 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)
|
if (section == NameColumn)
|
||||||
return tr("Function");
|
return tr("Function");
|
||||||
else if (section == LocationColumn)
|
else if (section == LocationColumn)
|
||||||
|
@@ -56,6 +56,9 @@ public:
|
|||||||
virtual void setParseData(const ParseData *data);
|
virtual void setParseData(const ParseData *data);
|
||||||
virtual const ParseData *parseData() const;
|
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.
|
/// 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.
|
/// By default it is the first event in the @c ParseData, i.e. 0.
|
||||||
virtual int costEvent() const;
|
virtual int costEvent() const;
|
||||||
|
@@ -77,7 +77,7 @@ void Function::Private::accumulateCost(QVector<quint64> &base, const QVector<qui
|
|||||||
} else {
|
} else {
|
||||||
///TODO: see whether .data() is noticably faster (less detaching)
|
///TODO: see whether .data() is noticably faster (less detaching)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach(quint64 cost, add)
|
foreach (quint64 cost, add)
|
||||||
base[i++] += cost;
|
base[i++] += cost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,11 +187,11 @@ void Function::setObject(qint64 id)
|
|||||||
QString Function::location() const
|
QString Function::location() const
|
||||||
{
|
{
|
||||||
QString pos;
|
QString pos;
|
||||||
foreach(const CostItem *costItem, d->m_costItems) {
|
foreach (const CostItem *costItem, d->m_costItems) {
|
||||||
if (costItem->differingFileId() != -1) {
|
if (costItem->differingFileId() != -1) {
|
||||||
QTextStream stream(&pos);
|
QTextStream stream(&pos);
|
||||||
stream << '(';
|
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
|
///TODO: remember what was hex formatted
|
||||||
stream << costItem->position(i);
|
stream << costItem->position(i);
|
||||||
if (i != c - 1)
|
if (i != c - 1)
|
||||||
@@ -227,7 +227,7 @@ int Function::lineNumber() const
|
|||||||
if (lineIdx == -1)
|
if (lineIdx == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
foreach(const CostItem *costItem, d->m_costItems) {
|
foreach (const CostItem *costItem, d->m_costItems) {
|
||||||
if (costItem->differingFileId() == -1)
|
if (costItem->differingFileId() == -1)
|
||||||
return costItem->position(lineIdx);
|
return costItem->position(lineIdx);
|
||||||
}
|
}
|
||||||
@@ -301,7 +301,7 @@ void Function::addCostItem(const CostItem *item)
|
|||||||
void Function::finalize()
|
void Function::finalize()
|
||||||
{
|
{
|
||||||
bool recursive = false;
|
bool recursive = false;
|
||||||
foreach(const FunctionCall *call, d->m_incomingCalls) {
|
foreach (const FunctionCall *call, d->m_incomingCalls) {
|
||||||
if (call->caller() == this) {
|
if (call->caller() == this) {
|
||||||
recursive = true;
|
recursive = true;
|
||||||
break;
|
break;
|
||||||
@@ -314,16 +314,16 @@ void Function::finalize()
|
|||||||
// e.g.: A -> B -> B ..., C -> B -> B ...
|
// 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 + ...
|
// cost of B = cost of call to B in A + cost of call to B in C + ...
|
||||||
d->m_inclusiveCost.fill(0);
|
d->m_inclusiveCost.fill(0);
|
||||||
foreach(const FunctionCall *call, d->m_incomingCalls) {
|
foreach (const FunctionCall *call, d->m_incomingCalls) {
|
||||||
if (call->caller() != this) {
|
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)
|
if (costItem->call() && costItem->call()->callee() == this)
|
||||||
d->accumulateCost(d->m_inclusiveCost, costItem->costs());
|
d->accumulateCost(d->m_inclusiveCost, costItem->costs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// now subtract self cost (see @c inclusiveCost() implementation)
|
// 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))
|
if (d->m_inclusiveCost.at(i) < d->m_selfCost.at(i))
|
||||||
d->m_inclusiveCost[i] = 0;
|
d->m_inclusiveCost[i] = 0;
|
||||||
else
|
else
|
||||||
|
@@ -82,16 +82,16 @@ void FunctionCycle::setFunctions(const QVector<const Function *> functions)
|
|||||||
d->m_selfCost.fill(0, d->m_data->events().size());
|
d->m_selfCost.fill(0, d->m_data->events().size());
|
||||||
d->m_inclusiveCost.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
|
// just add up self cost
|
||||||
d->accumulateCost(d->m_selfCost, func->selfCosts());
|
d->accumulateCost(d->m_selfCost, func->selfCosts());
|
||||||
// add outgoing calls to functions that are not part of the cycle
|
// 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()))
|
if (!functions.contains(call->callee()))
|
||||||
d->accumulateCall(call, Function::Private::Outgoing);
|
d->accumulateCall(call, Function::Private::Outgoing);
|
||||||
}
|
}
|
||||||
// add incoming calls from functions that are not part of the cycle
|
// 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())) {
|
if (!functions.contains(call->caller())) {
|
||||||
d->accumulateCall(call, Function::Private::Incoming);
|
d->accumulateCall(call, Function::Private::Incoming);
|
||||||
d->m_called += call->calls();
|
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 from incl. cost (see implementation of inclusiveCost())
|
||||||
// now subtract self cost (see @c inclusiveCost() implementation)
|
// 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))
|
if (d->m_inclusiveCost.at(i) < d->m_selfCost.at(i))
|
||||||
d->m_inclusiveCost[i] = 0;
|
d->m_inclusiveCost[i] = 0;
|
||||||
else
|
else
|
||||||
|
@@ -100,7 +100,7 @@ ParseData::Private::~Private()
|
|||||||
void ParseData::Private::cleanupFunctionCycles()
|
void ParseData::Private::cleanupFunctionCycles()
|
||||||
{
|
{
|
||||||
m_cycleCacheValid = false;
|
m_cycleCacheValid = false;
|
||||||
foreach(const Function *func, m_cycleCache) {
|
foreach (const Function *func, m_cycleCache) {
|
||||||
if (dynamic_cast<const FunctionCycle *>(func))
|
if (dynamic_cast<const FunctionCycle *>(func))
|
||||||
delete func;
|
delete func;
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ void ParseData::setPositions(const QStringList &positions)
|
|||||||
{
|
{
|
||||||
d->m_positions = positions;
|
d->m_positions = positions;
|
||||||
d->m_lineNumberPositionIndex = -1;
|
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") {
|
if (positions.at(i) == "line") {
|
||||||
d->m_lineNumberPositionIndex = i;
|
d->m_lineNumberPositionIndex = i;
|
||||||
break;
|
break;
|
||||||
|
@@ -237,17 +237,17 @@ void Parser::Private::parse(QIODevice *device)
|
|||||||
|
|
||||||
// build fast lookup of functions by their nameId
|
// build fast lookup of functions by their nameId
|
||||||
QHash<qint64, QList<const Function *> > functionLookup;
|
QHash<qint64, QList<const Function *> > functionLookup;
|
||||||
foreach(const Function *function, data->functions()) {
|
foreach (const Function *function, data->functions()) {
|
||||||
functionLookup[function->nameId()].append(function);
|
functionLookup[function->nameId()].append(function);
|
||||||
}
|
}
|
||||||
|
|
||||||
// functions that need to accumulate their calees
|
// functions that need to accumulate their calees
|
||||||
QSet<Function *> pendingFunctions;
|
QSet<Function *> pendingFunctions;
|
||||||
foreach(const CallData &callData, pendingCallees) {
|
foreach (const CallData &callData, pendingCallees) {
|
||||||
Function *calledFunction = 0;
|
Function *calledFunction = 0;
|
||||||
QTC_ASSERT(callData.call, continue);
|
QTC_ASSERT(callData.call, continue);
|
||||||
QTC_ASSERT(callData.call->caller(), 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);
|
QTC_ASSERT(function->nameId() == callData.calledFunction, continue);
|
||||||
if (function->objectId() == callData.calledObject
|
if (function->objectId() == callData.calledObject
|
||||||
&& function->fileId() == callData.calledFile)
|
&& 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() << "caller is:" << callData.call->caller()->name() << callData.call->caller()->nameId();
|
||||||
qDebug() << "called file:" << callData.calledFile << "object:" << callData.calledObject;
|
qDebug() << "called file:" << callData.calledFile << "object:" << callData.calledObject;
|
||||||
qDebug() << data->stringForFileCompression(callData.calledFile) << data->stringForObjectCompression(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();
|
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
|
// lookup done
|
||||||
|
|
||||||
// now accumulate callees
|
// now accumulate callees
|
||||||
foreach(Function *func, pendingFunctions)
|
foreach (Function *func, pendingFunctions)
|
||||||
func->finalize();
|
func->finalize();
|
||||||
|
|
||||||
q->parserDataReady(); // emit
|
q->parserDataReady(); // emit
|
||||||
@@ -610,7 +610,7 @@ void Parser::Private::parseCalls(const char *begin, const char *end)
|
|||||||
skipSpace(¤t, end);
|
skipSpace(¤t, end);
|
||||||
|
|
||||||
callDestinations.fill(0, addressValuesCount);
|
callDestinations.fill(0, addressValuesCount);
|
||||||
for(int i = 0; i < addressValuesCount; ++i) {
|
for (int i = 0; i < addressValuesCount; ++i) {
|
||||||
callDestinations[i] = parseAddr(¤t, end, &ok);
|
callDestinations[i] = parseAddr(¤t, end, &ok);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
break; // TODO error handling?
|
break; // TODO error handling?
|
||||||
|
@@ -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
|
// check if the function from this index is a child of (called by) the filter function
|
||||||
if (func && m_function) {
|
if (func && m_function) {
|
||||||
bool isValid = false;
|
bool isValid = false;
|
||||||
foreach(const FunctionCall *call, func->incomingCalls()) {
|
foreach (const FunctionCall *call, func->incomingCalls()) {
|
||||||
if (call->caller() == m_function) {
|
if (call->caller() == m_function) {
|
||||||
isValid = true;
|
isValid = true;
|
||||||
break;
|
break;
|
||||||
|
@@ -116,7 +116,7 @@ void CallgrindRunner::localParseDataAvailable(const QString &file)
|
|||||||
|
|
||||||
void CallgrindRunner::controllerFinished(CallgrindController::Option option)
|
void CallgrindRunner::controllerFinished(CallgrindController::Option option)
|
||||||
{
|
{
|
||||||
switch(option)
|
switch (option)
|
||||||
{
|
{
|
||||||
case CallgrindController::Pause:
|
case CallgrindController::Pause:
|
||||||
m_paused = true;
|
m_paused = true;
|
||||||
|
@@ -128,8 +128,8 @@ void MemcheckRunner::startRemotely(const Utils::SshConnectionParameters &sshPara
|
|||||||
|
|
||||||
QList<QHostAddress> possibleHostAddresses;
|
QList<QHostAddress> possibleHostAddresses;
|
||||||
//NOTE: ::allAddresses does not seem to work for usb interfaces...
|
//NOTE: ::allAddresses does not seem to work for usb interfaces...
|
||||||
foreach(const QNetworkInterface &iface, QNetworkInterface::allInterfaces()) {
|
foreach (const QNetworkInterface &iface, QNetworkInterface::allInterfaces()) {
|
||||||
foreach(const QNetworkAddressEntry &entry, iface.addressEntries()) {
|
foreach (const QNetworkAddressEntry &entry, iface.addressEntries()) {
|
||||||
const QHostAddress addr = entry.ip();
|
const QHostAddress addr = entry.ip();
|
||||||
if (addr.toString() != "127.0.0.1"
|
if (addr.toString() != "127.0.0.1"
|
||||||
&& addr.toString() != "0:0:0:0:0: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."));
|
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);
|
layout->addWidget(description);
|
||||||
QListWidget *list = new QListWidget;
|
QListWidget *list = new QListWidget;
|
||||||
foreach(const QHostAddress &address, possibleHostAddresses)
|
foreach (const QHostAddress &address, possibleHostAddresses)
|
||||||
list->addItem(address.toString());
|
list->addItem(address.toString());
|
||||||
|
|
||||||
list->setSelectionMode(QAbstractItemView::SingleSelection);
|
list->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
@@ -38,6 +38,8 @@
|
|||||||
#include <QtCore/QEventLoop>
|
#include <QtCore/QEventLoop>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
|
|
||||||
ValgrindProcess::ValgrindProcess(QObject *parent)
|
ValgrindProcess::ValgrindProcess(QObject *parent)
|
||||||
@@ -204,6 +206,8 @@ void RemoteValgrindProcess::run(const QString &valgrindExecutable, const QString
|
|||||||
|
|
||||||
void RemoteValgrindProcess::connected()
|
void RemoteValgrindProcess::connected()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
|
||||||
|
|
||||||
// connected, run command
|
// connected, run command
|
||||||
QString cmd;
|
QString cmd;
|
||||||
|
|
||||||
@@ -235,6 +239,8 @@ Utils::SshConnection::Ptr RemoteValgrindProcess::connection() const
|
|||||||
|
|
||||||
void RemoteValgrindProcess::processStarted()
|
void RemoteValgrindProcess::processStarted()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
|
||||||
|
|
||||||
// find out what PID our process has
|
// find out what PID our process has
|
||||||
|
|
||||||
// NOTE: valgrind cloaks its name,
|
// NOTE: valgrind cloaks its name,
|
||||||
@@ -279,7 +285,7 @@ void RemoteValgrindProcess::findPIDOutputReceived(const QByteArray &output)
|
|||||||
|
|
||||||
void RemoteValgrindProcess::error(Utils::SshError error)
|
void RemoteValgrindProcess::error(Utils::SshError error)
|
||||||
{
|
{
|
||||||
switch(error) {
|
switch (error) {
|
||||||
case Utils::SshTimeoutError:
|
case Utils::SshTimeoutError:
|
||||||
m_error = QProcess::Timedout;
|
m_error = QProcess::Timedout;
|
||||||
break;
|
break;
|
||||||
@@ -293,9 +299,8 @@ void RemoteValgrindProcess::error(Utils::SshError error)
|
|||||||
|
|
||||||
void RemoteValgrindProcess::close()
|
void RemoteValgrindProcess::close()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
|
||||||
if (m_process) {
|
if (m_process) {
|
||||||
m_process->closeChannel();
|
|
||||||
|
|
||||||
if (m_pid) {
|
if (m_pid) {
|
||||||
const QString killTemplate = QString("kill -%2 %1" // kill
|
const QString killTemplate = QString("kill -%2 %1" // kill
|
||||||
).arg(m_pid);
|
).arg(m_pid);
|
||||||
@@ -304,14 +309,16 @@ void RemoteValgrindProcess::close()
|
|||||||
const QString brutalKill = killTemplate.arg("SIGKILL");
|
const QString brutalKill = killTemplate.arg("SIGKILL");
|
||||||
const QString remoteCall = niceKill + QLatin1String("; sleep 1; ") + brutalKill;
|
const QString remoteCall = niceKill + QLatin1String("; sleep 1; ") + brutalKill;
|
||||||
|
|
||||||
m_cleanup = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
Utils::SshRemoteProcess::Ptr cleanup = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
||||||
m_cleanup->start();
|
cleanup->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteValgrindProcess::closed(int status)
|
void RemoteValgrindProcess::closed(int status)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_process, return);
|
||||||
|
|
||||||
m_errorString = m_process->errorString();
|
m_errorString = m_process->errorString();
|
||||||
if (status == Utils::SshRemoteProcess::FailedToStart) {
|
if (status == Utils::SshRemoteProcess::FailedToStart) {
|
||||||
m_error = QProcess::FailedToStart;
|
m_error = QProcess::FailedToStart;
|
||||||
|
@@ -156,7 +156,6 @@ private:
|
|||||||
Utils::SshConnectionParameters m_params;
|
Utils::SshConnectionParameters m_params;
|
||||||
Utils::SshConnection::Ptr m_connection;
|
Utils::SshConnection::Ptr m_connection;
|
||||||
Utils::SshRemoteProcess::Ptr m_process;
|
Utils::SshRemoteProcess::Ptr m_process;
|
||||||
Utils::SshRemoteProcess::Ptr m_cleanup;
|
|
||||||
QString m_workingDir;
|
QString m_workingDir;
|
||||||
QString m_valgrindExe;
|
QString m_valgrindExe;
|
||||||
QStringList m_valgrindArgs;
|
QStringList m_valgrindArgs;
|
||||||
|
@@ -226,13 +226,13 @@ QString Error::toXml() const
|
|||||||
stream << " <what>" << d->what << "</what>\n";
|
stream << " <what>" << d->what << "</what>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(const Stack &stack, d->stacks) {
|
foreach (const Stack &stack, d->stacks) {
|
||||||
if (!stack.auxWhat().isEmpty()) {
|
if (!stack.auxWhat().isEmpty()) {
|
||||||
stream << " <auxwhat>" << stack.auxWhat() << "</auxwhat>\n";
|
stream << " <auxwhat>" << stack.auxWhat() << "</auxwhat>\n";
|
||||||
}
|
}
|
||||||
stream << " <stack>\n";
|
stream << " <stack>\n";
|
||||||
|
|
||||||
foreach(const Frame &frame, stack.frames()) {
|
foreach (const Frame &frame, stack.frames()) {
|
||||||
stream << " <frame>\n";
|
stream << " <frame>\n";
|
||||||
stream << " <ip>0x" << QString::number(frame.instructionPointer(), 16) << "</ip>\n";
|
stream << " <ip>0x" << QString::number(frame.instructionPointer(), 16) << "</ip>\n";
|
||||||
if (!frame.object().isEmpty()) {
|
if (!frame.object().isEmpty()) {
|
||||||
|
@@ -149,7 +149,7 @@ QVariant ErrorListModel::Private::errorData(int row, int column, int role) const
|
|||||||
const Stack stack = !stacks.isEmpty() ? stacks.first() : Stack();
|
const Stack stack = !stacks.isEmpty() ? stacks.first() : Stack();
|
||||||
|
|
||||||
if (error.stacks().count())
|
if (error.stacks().count())
|
||||||
switch(role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
{
|
{
|
||||||
switch (column) {
|
switch (column) {
|
||||||
|
@@ -112,7 +112,7 @@ QVariant StackModel::data(const QModelIndex &index, int role) const
|
|||||||
if (fidx < 0 || fidx >= frames.size())
|
if (fidx < 0 || fidx >= frames.size())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
const Frame &frame = frames[fidx];
|
const Frame &frame = frames[fidx];
|
||||||
switch(role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
{
|
{
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
|
@@ -236,7 +236,7 @@ QString Suppression::toString() const
|
|||||||
stream << "{\n";
|
stream << "{\n";
|
||||||
stream << indent << d->name << '\n';
|
stream << indent << d->name << '\n';
|
||||||
stream << indent << d->kind << '\n';
|
stream << indent << d->kind << '\n';
|
||||||
foreach(const SuppressionFrame &frame, d->frames) {
|
foreach (const SuppressionFrame &frame, d->frames) {
|
||||||
stream << indent << frame.toString() << '\n';
|
stream << indent << frame.toString() << '\n';
|
||||||
}
|
}
|
||||||
stream << "}\n";
|
stream << "}\n";
|
||||||
|
@@ -210,6 +210,7 @@ public:
|
|||||||
AnalyzerRunControlFactory *m_runControlFactory;
|
AnalyzerRunControlFactory *m_runControlFactory;
|
||||||
ProjectExplorer::RunControl *m_currentRunControl;
|
ProjectExplorer::RunControl *m_currentRunControl;
|
||||||
Utils::FancyMainWindow *m_mainWindow;
|
Utils::FancyMainWindow *m_mainWindow;
|
||||||
|
IAnalyzerTool *m_currentTool;
|
||||||
QList<IAnalyzerTool *> m_tools;
|
QList<IAnalyzerTool *> m_tools;
|
||||||
QActionGroup *m_toolGroup;
|
QActionGroup *m_toolGroup;
|
||||||
QAction *m_startAction;
|
QAction *m_startAction;
|
||||||
@@ -232,7 +233,6 @@ public:
|
|||||||
|
|
||||||
bool m_restartOnStop;
|
bool m_restartOnStop;
|
||||||
bool m_initialized;
|
bool m_initialized;
|
||||||
IAnalyzerTool *m_currentTool;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
|
AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
|
||||||
@@ -242,6 +242,7 @@ AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager
|
|||||||
m_runControlFactory(0),
|
m_runControlFactory(0),
|
||||||
m_currentRunControl(0),
|
m_currentRunControl(0),
|
||||||
m_mainWindow(0),
|
m_mainWindow(0),
|
||||||
|
m_currentTool(0),
|
||||||
m_toolGroup(0),
|
m_toolGroup(0),
|
||||||
m_startAction(0),
|
m_startAction(0),
|
||||||
m_startRemoteAction(0),
|
m_startRemoteAction(0),
|
||||||
@@ -253,8 +254,7 @@ AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager
|
|||||||
m_statusLabel(new Utils::StatusLabel),
|
m_statusLabel(new Utils::StatusLabel),
|
||||||
m_resizeEventFilter(new DockWidgetEventFilter(qq)),
|
m_resizeEventFilter(new DockWidgetEventFilter(qq)),
|
||||||
m_restartOnStop(false),
|
m_restartOnStop(false),
|
||||||
m_initialized(false),
|
m_initialized(false)
|
||||||
m_currentTool(0)
|
|
||||||
{
|
{
|
||||||
m_toolBox->setObjectName(QLatin1String("AnalyzerManagerToolBox"));
|
m_toolBox->setObjectName(QLatin1String("AnalyzerManagerToolBox"));
|
||||||
m_runControlFactory = new AnalyzerRunControlFactory();
|
m_runControlFactory = new AnalyzerRunControlFactory();
|
||||||
@@ -271,7 +271,7 @@ AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
|
|||||||
{
|
{
|
||||||
// as we have to setParent(0) on dock widget that are not selected,
|
// 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
|
// 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)
|
if (ptr)
|
||||||
delete ptr.data();
|
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/>"
|
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());
|
"<center>Force it to quit?</center></body></html>").arg(m_currentRunControl->displayName());
|
||||||
bool stopRequested = showPromptDialog(tr("Analyzer Still Running"), msg,
|
bool stopRequested = showPromptDialog(tr("Analyzer Still Running"), msg,
|
||||||
tr("Stop active run"), tr("Keep Running"));
|
tr("Stop Active Run"), tr("Keep Running"));
|
||||||
if (!stopRequested)
|
if (!stopRequested)
|
||||||
return; // no restart, keep it running, do nothing
|
return; // no restart, keep it running, do nothing
|
||||||
|
|
||||||
@@ -657,7 +657,6 @@ void AnalyzerManager::toolSelected(int idx)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
selectingTool = true;
|
selectingTool = true;
|
||||||
|
|
||||||
if (oldTool != 0) {
|
if (oldTool != 0) {
|
||||||
saveToolSettings(oldTool);
|
saveToolSettings(oldTool);
|
||||||
|
|
||||||
|
@@ -71,14 +71,14 @@ void AnalyzerRunConfigWidget::setRunConfiguration(ProjectExplorer::RunConfigurat
|
|||||||
|
|
||||||
// update summary text
|
// update summary text
|
||||||
QStringList tools;
|
QStringList tools;
|
||||||
foreach(AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
|
foreach (AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
|
||||||
tools << QString("<strong>%1</strong>").arg(config->displayName());
|
tools << QString("<strong>%1</strong>").arg(config->displayName());
|
||||||
}
|
}
|
||||||
m_detailsWidget->setSummaryText(tr("Available settings: %1").arg(tools.join(", ")));
|
m_detailsWidget->setSummaryText(tr("Available settings: %1").arg(tools.join(", ")));
|
||||||
|
|
||||||
// add group boxes for each sub config
|
// add group boxes for each sub config
|
||||||
QLayout *layout = m_detailsWidget->widget()->layout();
|
QLayout *layout = m_detailsWidget->widget()->layout();
|
||||||
foreach(AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
|
foreach (AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
|
||||||
QGroupBox *box = new QGroupBox(config->displayName());
|
QGroupBox *box = new QGroupBox(config->displayName());
|
||||||
Q_UNUSED(box)
|
Q_UNUSED(box)
|
||||||
QWidget *widget = config->createConfigWidget(this);
|
QWidget *widget = config->createConfigWidget(this);
|
||||||
|
@@ -74,7 +74,7 @@ AnalyzerSettings::~AnalyzerSettings()
|
|||||||
bool AnalyzerSettings::fromMap(const QVariantMap &map)
|
bool AnalyzerSettings::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
foreach(AbstractAnalyzerSubConfig *config, subConfigs()) {
|
foreach (AbstractAnalyzerSubConfig *config, subConfigs()) {
|
||||||
ret = ret && config->fromMap(map);
|
ret = ret && config->fromMap(map);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@@ -83,7 +83,7 @@ bool AnalyzerSettings::fromMap(const QVariantMap &map)
|
|||||||
QVariantMap AnalyzerSettings::defaults() const
|
QVariantMap AnalyzerSettings::defaults() const
|
||||||
{
|
{
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
foreach(AbstractAnalyzerSubConfig *config, subConfigs()) {
|
foreach (AbstractAnalyzerSubConfig *config, subConfigs()) {
|
||||||
map.unite(config->defaults());
|
map.unite(config->defaults());
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
@@ -92,7 +92,7 @@ QVariantMap AnalyzerSettings::defaults() const
|
|||||||
QVariantMap AnalyzerSettings::toMap() const
|
QVariantMap AnalyzerSettings::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
foreach(AbstractAnalyzerSubConfig *config, subConfigs()) {
|
foreach (AbstractAnalyzerSubConfig *config, subConfigs()) {
|
||||||
map.unite(config->toMap());
|
map.unite(config->toMap());
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
@@ -166,7 +166,7 @@ AnalyzerProjectSettings::AnalyzerProjectSettings(QObject *parent)
|
|||||||
: AnalyzerSettings(parent)
|
: AnalyzerSettings(parent)
|
||||||
{
|
{
|
||||||
// add sub configs
|
// add sub configs
|
||||||
foreach(AbstractAnalyzerSubConfigFactory *factory, AnalyzerGlobalSettings::instance()->subConfigFactories()) {
|
foreach (AbstractAnalyzerSubConfigFactory *factory, AnalyzerGlobalSettings::instance()->subConfigFactories()) {
|
||||||
addSubConfig(factory->createProjectSubConfig(parent));
|
addSubConfig(factory->createProjectSubConfig(parent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,6 +68,24 @@ CallgrindConfigWidget::CallgrindConfigWidget(AbstractCallgrindSettings *settings
|
|||||||
m_settings, SLOT(setCollectBusEvents(bool)));
|
m_settings, SLOT(setCollectBusEvents(bool)));
|
||||||
connect(m_settings, SIGNAL(collectBusEventsChanged(bool)),
|
connect(m_settings, SIGNAL(collectBusEventsChanged(bool)),
|
||||||
m_ui->collectBusEvents, SLOT(setChecked(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()
|
CallgrindConfigWidget::~CallgrindConfigWidget()
|
||||||
|
@@ -10,8 +10,8 @@
|
|||||||
<height>565</height>
|
<height>565</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item>
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QGroupBox" name="memcheckOptions">
|
<widget class="QGroupBox" name="memcheckOptions">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
@@ -22,24 +22,49 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Profiling Options</string>
|
<string>Profiling Options</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="0" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<widget class="QLabel" name="minimumInclusiveCostRatioLabel">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="enableCacheSim">
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<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="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><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||||
@@ -55,16 +80,16 @@ With cache simulation, further event counters are enabled:
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
For more information, see ???.</p></body></html></string>
|
For more information, see ???.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable cache simulation</string>
|
<string>Enable cache simulation</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="enableBranchSim">
|
<widget class="QCheckBox" name="enableBranchSim">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||||
@@ -74,35 +99,74 @@ p, li { white-space: pre-wrap; }
|
|||||||
"Bc"/"Bcm")</li>
|
"Bc"/"Bcm")</li>
|
||||||
<li>Executed indirect jumps and related misses of the jump address predictor (
|
<li>Executed indirect jumps and related misses of the jump address predictor (
|
||||||
"Bi"/"Bim")</li></ul></body></html></string>
|
"Bi"/"Bim")</li></ul></body></html></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 "Ge" 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">
|
<property name="text">
|
||||||
<string>Enable branch prediction simulation</string>
|
<string>Visualisation: Show events with inclusive costs higher than:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QCheckBox" name="collectSystime">
|
<widget class="QDoubleSpinBox" name="visualisationMinimumInclusiveCostRatio">
|
||||||
<property name="toolTip">
|
<property name="prefix">
|
||||||
<string>This specifies whether information for system call times should be collected.</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="suffix">
|
||||||
<string>Collect system call time</string>
|
<string>%</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="minimum">
|
||||||
</item>
|
<double>0.000000000000000</double>
|
||||||
<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 "Ge" is used for these events.</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="maximum">
|
||||||
<string>Collect global bus events</string>
|
<double>50.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@@ -70,7 +70,7 @@ CostDelegate::Private::Private()
|
|||||||
|
|
||||||
int CostDelegate::Private::toNativeRole(CostDelegate::CostFormat format)
|
int CostDelegate::Private::toNativeRole(CostDelegate::CostFormat format)
|
||||||
{
|
{
|
||||||
switch(format)
|
switch (format)
|
||||||
{
|
{
|
||||||
case FormatAbsolute:
|
case FormatAbsolute:
|
||||||
case FormatRelative:
|
case FormatRelative:
|
||||||
|
@@ -126,11 +126,13 @@ void CallgrindEngine::setPaused(bool paused)
|
|||||||
|
|
||||||
m_markAsPaused = paused;
|
m_markAsPaused = paused;
|
||||||
|
|
||||||
// call controller
|
// call controller only if it is attached to a valgrind process
|
||||||
if (paused)
|
if (m_runner.controller()->valgrindProcess()) {
|
||||||
pause();
|
if (paused)
|
||||||
else
|
pause();
|
||||||
unpause();
|
else
|
||||||
|
unpause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindEngine::setToggleCollectFunction(const QString &toggleCollectFunction)
|
void CallgrindEngine::setToggleCollectFunction(const QString &toggleCollectFunction)
|
||||||
|
@@ -60,7 +60,10 @@ public slots:
|
|||||||
void pause();
|
void pause();
|
||||||
void unpause();
|
void unpause();
|
||||||
|
|
||||||
|
/// marks the callgrind process as paused
|
||||||
|
/// calls pause() and unpause() if there's an active run
|
||||||
void setPaused(bool paused);
|
void setPaused(bool paused);
|
||||||
|
|
||||||
void setToggleCollectFunction(const QString &toggleCollectFunction);
|
void setToggleCollectFunction(const QString &toggleCollectFunction);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -44,10 +44,12 @@ static const char callgrindEnableCacheSimC[] = "Analyzer.Valgrind.Callgrind.Enab
|
|||||||
static const char callgrindEnableBranchSimC[] = "Analyzer.Valgrind.Callgrind.EnableBranchSim";
|
static const char callgrindEnableBranchSimC[] = "Analyzer.Valgrind.Callgrind.EnableBranchSim";
|
||||||
static const char callgrindCollectSystimeC[] = "Analyzer.Valgrind.Callgrind.CollectSystime";
|
static const char callgrindCollectSystimeC[] = "Analyzer.Valgrind.Callgrind.CollectSystime";
|
||||||
static const char callgrindCollectBusEventsC[] = "Analyzer.Valgrind.Callgrind.CollectBusEvents";
|
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 callgrindCycleDetectionC[] = "Analyzer.Valgrind.Callgrind.CycleDetection";
|
||||||
static const char callgrindCostFormatC[] = "Analyzer.Valgrind.Callgrind.CostFormat";
|
static const char callgrindCostFormatC[] = "Analyzer.Valgrind.Callgrind.CostFormat";
|
||||||
static const char callgrindMinimumCostRatioC[] = "Analyzer.Valgrind.Callgrind.MinimumCostRatio";
|
|
||||||
|
|
||||||
AbstractCallgrindSettings::AbstractCallgrindSettings(QObject *parent)
|
AbstractCallgrindSettings::AbstractCallgrindSettings(QObject *parent)
|
||||||
: AbstractAnalyzerSubConfig(parent)
|
: AbstractAnalyzerSubConfig(parent)
|
||||||
@@ -96,6 +98,35 @@ void AbstractCallgrindSettings::setCollectBusEvents(bool collect)
|
|||||||
emit collectBusEventsChanged(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 AbstractCallgrindSettings::defaults() const
|
||||||
{
|
{
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
@@ -103,6 +134,9 @@ QVariantMap AbstractCallgrindSettings::defaults() const
|
|||||||
map.insert(QLatin1String(callgrindEnableBranchSimC), false);
|
map.insert(QLatin1String(callgrindEnableBranchSimC), false);
|
||||||
map.insert(QLatin1String(callgrindCollectSystimeC), false);
|
map.insert(QLatin1String(callgrindCollectSystimeC), false);
|
||||||
map.insert(QLatin1String(callgrindCollectBusEventsC), 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;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +146,10 @@ bool AbstractCallgrindSettings::fromMap(const QVariantMap &map)
|
|||||||
setIfPresent(map, QLatin1String(callgrindEnableBranchSimC), &m_enableBranchSim);
|
setIfPresent(map, QLatin1String(callgrindEnableBranchSimC), &m_enableBranchSim);
|
||||||
setIfPresent(map, QLatin1String(callgrindCollectSystimeC), &m_collectSystime);
|
setIfPresent(map, QLatin1String(callgrindCollectSystimeC), &m_collectSystime);
|
||||||
setIfPresent(map, QLatin1String(callgrindCollectBusEventsC), &m_collectBusEvents);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +160,10 @@ QVariantMap AbstractCallgrindSettings::toMap() const
|
|||||||
map.insert(QLatin1String(callgrindEnableBranchSimC), m_enableBranchSim);
|
map.insert(QLatin1String(callgrindEnableBranchSimC), m_enableBranchSim);
|
||||||
map.insert(QLatin1String(callgrindCollectSystimeC), m_collectSystime);
|
map.insert(QLatin1String(callgrindCollectSystimeC), m_collectSystime);
|
||||||
map.insert(QLatin1String(callgrindCollectBusEventsC), m_collectBusEvents);
|
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;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +199,6 @@ QVariantMap CallgrindGlobalSettings::defaults() const
|
|||||||
QVariantMap map = AbstractCallgrindSettings::defaults();
|
QVariantMap map = AbstractCallgrindSettings::defaults();
|
||||||
map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
|
map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
|
||||||
map.insert(QLatin1String(callgrindCycleDetectionC), true);
|
map.insert(QLatin1String(callgrindCycleDetectionC), true);
|
||||||
map.insert(QLatin1String(callgrindMinimumCostRatioC), 0.0001);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +210,6 @@ bool CallgrindGlobalSettings::fromMap(const QVariantMap &map)
|
|||||||
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(QLatin1String(callgrindCostFormatC)).toInt());
|
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(QLatin1String(callgrindCostFormatC)).toInt());
|
||||||
}
|
}
|
||||||
setIfPresent(map, QLatin1String(callgrindCycleDetectionC), &m_detectCycles);
|
setIfPresent(map, QLatin1String(callgrindCycleDetectionC), &m_detectCycles);
|
||||||
setIfPresent(map, QLatin1String(callgrindMinimumCostRatioC), &m_minimumInclusiveCostRatio);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +218,6 @@ QVariantMap CallgrindGlobalSettings::toMap() const
|
|||||||
QVariantMap map = AbstractCallgrindSettings::toMap();
|
QVariantMap map = AbstractCallgrindSettings::toMap();
|
||||||
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
|
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
|
||||||
map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles);
|
map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles);
|
||||||
map.insert(QLatin1String(callgrindMinimumCostRatioC), m_minimumInclusiveCostRatio);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,17 +243,6 @@ void CallgrindGlobalSettings::setDetectCycles(bool detect)
|
|||||||
AnalyzerGlobalSettings::instance()->writeSettings();
|
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)
|
CallgrindProjectSettings::CallgrindProjectSettings(QObject *parent)
|
||||||
: AbstractCallgrindSettings(parent)
|
: AbstractCallgrindSettings(parent)
|
||||||
{
|
{
|
||||||
|
@@ -56,6 +56,13 @@ public:
|
|||||||
inline bool enableBranchSim() const { return m_enableBranchSim; }
|
inline bool enableBranchSim() const { return m_enableBranchSim; }
|
||||||
inline bool collectSystime() const { return m_collectSystime; }
|
inline bool collectSystime() const { return m_collectSystime; }
|
||||||
inline bool collectBusEvents() const { return m_collectBusEvents; }
|
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
|
// abstract virtual methods from base class
|
||||||
virtual bool fromMap(const QVariantMap &map);
|
virtual bool fromMap(const QVariantMap &map);
|
||||||
@@ -71,12 +78,22 @@ public Q_SLOTS:
|
|||||||
void setEnableBranchSim(bool enable);
|
void setEnableBranchSim(bool enable);
|
||||||
void setCollectSystime(bool collect);
|
void setCollectSystime(bool collect);
|
||||||
void setCollectBusEvents(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:
|
Q_SIGNALS:
|
||||||
void enableCacheSimChanged(bool);
|
void enableCacheSimChanged(bool);
|
||||||
void enableBranchSimChanged(bool);
|
void enableBranchSimChanged(bool);
|
||||||
void collectSystimeChanged(bool);
|
void collectSystimeChanged(bool);
|
||||||
void collectBusEventsChanged(bool);
|
void collectBusEventsChanged(bool);
|
||||||
|
void enableEventToolTipsChanged(bool);
|
||||||
|
void minimumInclusiveCostRatioChanged(double);
|
||||||
|
void visualisationMinimumInclusiveCostRatioChanged(double);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
@@ -86,6 +103,9 @@ private:
|
|||||||
bool m_collectSystime;
|
bool m_collectSystime;
|
||||||
bool m_collectBusEvents;
|
bool m_collectBusEvents;
|
||||||
bool m_enableBranchSim;
|
bool m_enableBranchSim;
|
||||||
|
bool m_enableEventToolTips;
|
||||||
|
double m_minimumInclusiveCostRatio;
|
||||||
|
double m_visualisationMinimumInclusiveCostRatio;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,12 +124,10 @@ public:
|
|||||||
|
|
||||||
CostDelegate::CostFormat costFormat() const;
|
CostDelegate::CostFormat costFormat() const;
|
||||||
bool detectCycles() const;
|
bool detectCycles() const;
|
||||||
double minimumInclusiveCostRatio() const;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCostFormat(Callgrind::Internal::CostDelegate::CostFormat format);
|
void setCostFormat(Callgrind::Internal::CostDelegate::CostFormat format);
|
||||||
void setDetectCycles(bool detect);
|
void setDetectCycles(bool detect);
|
||||||
void setMinimumInclusiveCostRatio(double minimumInclusiveCost);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
@@ -117,7 +135,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
CostDelegate::CostFormat m_costFormat;
|
CostDelegate::CostFormat m_costFormat;
|
||||||
bool m_detectCycles;
|
bool m_detectCycles;
|
||||||
double m_minimumInclusiveCostRatio;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -208,7 +208,7 @@ void CallgrindTool::extensionsInitialized()
|
|||||||
analyzerContext);
|
analyzerContext);
|
||||||
editorContextMenu->addAction(cmd);
|
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));
|
action->setIcon(QIcon(Analyzer::Constants::ANALYZER_CONTROL_START_ICON));
|
||||||
connect(action, SIGNAL(triggered()), SLOT(handleShowCostsOfFunction()));
|
connect(action, SIGNAL(triggered()), SLOT(handleShowCostsOfFunction()));
|
||||||
cmd = actionManager->registerAction(action, Callgrind::Constants::A_SHOWCOSTSOFFUNCTION,
|
cmd = actionManager->registerAction(action, Callgrind::Constants::A_SHOWCOSTSOFFUNCTION,
|
||||||
@@ -245,6 +245,15 @@ IAnalyzerEngine *CallgrindTool::createEngine(const AnalyzerStartParameters &sp,
|
|||||||
|
|
||||||
AnalyzerManager::instance()->showStatusMessage(AnalyzerManager::msgToolStarted(displayName()));
|
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;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,9 +322,6 @@ QWidget *CallgrindTool::createPaneToolBarWidget()
|
|||||||
connect(m_callgrindWidgetHandler, SIGNAL(cycleDetectionEnabled(bool)),
|
connect(m_callgrindWidgetHandler, SIGNAL(cycleDetectionEnabled(bool)),
|
||||||
settings, SLOT(setDetectCycles(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;
|
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
|
// find callgrind text mark that corresponds to this editor's file and line number
|
||||||
const Function *func = 0;
|
const Function *func = 0;
|
||||||
foreach(CallgrindTextMark *textMark, m_textMarks) {
|
foreach (CallgrindTextMark *textMark, m_textMarks) {
|
||||||
if (textMark->fileName() == editor->file()->fileName() && textMark->lineNumber() == line) {
|
if (textMark->fileName() == editor->file()->fileName() && textMark->lineNumber() == line) {
|
||||||
func = textMark->function();
|
func = textMark->function();
|
||||||
break;
|
break;
|
||||||
@@ -397,7 +403,7 @@ void CallgrindTool::requestContextMenu(TextEditor::ITextEditor *editor, int line
|
|||||||
return; // no callgrind text mark under cursor, return
|
return; // no callgrind text mark under cursor, return
|
||||||
|
|
||||||
// add our action to the context menu
|
// 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()));
|
connect(action, SIGNAL(triggered()), this, SLOT(handleShowCostsAction()));
|
||||||
action->setData(QVariant::fromValue<const Function *>(func));
|
action->setData(QVariant::fromValue<const Function *>(func));
|
||||||
menu->addAction(action);
|
menu->addAction(action);
|
||||||
@@ -435,7 +441,7 @@ void CallgrindTool::handleShowCostsOfFunction()
|
|||||||
|
|
||||||
void CallgrindTool::slotRequestDump()
|
void CallgrindTool::slotRequestDump()
|
||||||
{
|
{
|
||||||
m_callgrindWidgetHandler->visualisation()->setText(tr("Populating..."));
|
m_callgrindWidgetHandler->slotRequestDump();
|
||||||
emit dumpRequested();
|
emit dumpRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,13 +73,9 @@ public:
|
|||||||
const QStyleOptionGraphicsItem *option, QWidget *widget);
|
const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
virtual QRectF boundingRect() const;
|
virtual QRectF boundingRect() const;
|
||||||
|
|
||||||
void setRotateText(bool rotate);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_text;
|
QString m_text;
|
||||||
QStaticText m_staticText;
|
QStaticText m_staticText;
|
||||||
bool m_rotateText;
|
|
||||||
QColor m_textColor;
|
|
||||||
qreal m_previousViewportDimension;
|
qreal m_previousViewportDimension;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -105,7 +101,6 @@ FunctionGraphicsTextItem::FunctionGraphicsTextItem(const QString &text,
|
|||||||
QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
: QAbstractGraphicsShapeItem(parent)
|
: QAbstractGraphicsShapeItem(parent)
|
||||||
, m_text(text)
|
, m_text(text)
|
||||||
, m_rotateText(true)
|
|
||||||
, m_previousViewportDimension(0)
|
, m_previousViewportDimension(0)
|
||||||
{
|
{
|
||||||
setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||||
@@ -113,11 +108,6 @@ FunctionGraphicsTextItem::FunctionGraphicsTextItem(const QString &text,
|
|||||||
setToolTip(text);
|
setToolTip(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionGraphicsTextItem::setRotateText(bool rotate)
|
|
||||||
{
|
|
||||||
m_rotateText = rotate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FunctionGraphicsTextItem::paint(QPainter *painter,
|
void FunctionGraphicsTextItem::paint(QPainter *painter,
|
||||||
const QStyleOptionGraphicsItem *,
|
const QStyleOptionGraphicsItem *,
|
||||||
QWidget *widget)
|
QWidget *widget)
|
||||||
@@ -135,30 +125,17 @@ void FunctionGraphicsTextItem::paint(QPainter *painter,
|
|||||||
* parentItem()->boundingRect().height()
|
* parentItem()->boundingRect().height()
|
||||||
/ scene()->sceneRect().height();
|
/ scene()->sceneRect().height();
|
||||||
|
|
||||||
qreal textMaxHeight;
|
if (textHeight > maxHeight)
|
||||||
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)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (viewportDim != m_previousViewportDimension) {
|
if (viewportRect.width() != m_previousViewportDimension) {
|
||||||
const QString &elidedText =
|
const QString &elidedText =
|
||||||
painter->fontMetrics().elidedText(m_text, Qt::ElideRight,
|
painter->fontMetrics().elidedText(m_text, Qt::ElideRight,
|
||||||
textMaxWidth);
|
maxWidth);
|
||||||
m_staticText.setText(elidedText);
|
m_staticText.setText(elidedText);
|
||||||
m_staticText.prepare();
|
m_staticText.prepare();
|
||||||
|
|
||||||
m_previousViewportDimension = viewportDim;
|
m_previousViewportDimension = viewportRect.width();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VISUALISATION_DEBUG
|
#if VISUALISATION_DEBUG
|
||||||
@@ -169,16 +146,9 @@ void FunctionGraphicsTextItem::paint(QPainter *painter,
|
|||||||
painter->save();
|
painter->save();
|
||||||
int textLeft = 0;
|
int textLeft = 0;
|
||||||
int textTop = 0;
|
int textTop = 0;
|
||||||
if (m_rotateText) {
|
const int textWidth = painter->fontMetrics().width(m_staticText.text());
|
||||||
painter->rotate(90);
|
textLeft = -textWidth/2;
|
||||||
textLeft = 2;
|
textTop = (maxHeight - textHeight)/2;
|
||||||
textTop = -textHeight/2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const int textWidth = painter->fontMetrics().width(m_staticText.text());
|
|
||||||
textLeft = -textWidth/2;
|
|
||||||
textTop = (maxHeight - textHeight)/2;
|
|
||||||
}
|
|
||||||
painter->drawStaticText(textLeft, textTop, m_staticText);
|
painter->drawStaticText(textLeft, textTop, m_staticText);
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
@@ -218,9 +188,10 @@ void FunctionGraphicsItem::paint(QPainter *painter,
|
|||||||
QRectF rect = this->rect();
|
QRectF rect = this->rect();
|
||||||
const QColor &color = brush().color();
|
const QColor &color = brush().color();
|
||||||
if (option->state & QStyle::State_Selected) {
|
if (option->state & QStyle::State_Selected) {
|
||||||
QLinearGradient gradient(0, 0, rect.width(), rect.height());
|
QLinearGradient gradient(0, 0, rect.width(), 0);
|
||||||
gradient.setColorAt(0, color.lighter(250));
|
gradient.setColorAt(0, color.darker(100));
|
||||||
gradient.setColorAt(1, color.darker());
|
gradient.setColorAt(0.5, color.lighter(200));
|
||||||
|
gradient.setColorAt(1, color.darker(100));
|
||||||
painter->setBrush(gradient);
|
painter->setBrush(gradient);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -256,13 +227,11 @@ public:
|
|||||||
Visualisation *q;
|
Visualisation *q;
|
||||||
DataProxyModel *m_model;
|
DataProxyModel *m_model;
|
||||||
QGraphicsScene m_scene;
|
QGraphicsScene m_scene;
|
||||||
int m_modelColumn;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Visualisation::Private::Private(Visualisation *qq)
|
Visualisation::Private::Private(Visualisation *qq)
|
||||||
: q(qq)
|
: q(qq)
|
||||||
, m_model(new DataProxyModel(qq))
|
, m_model(new DataProxyModel(qq))
|
||||||
, m_modelColumn(-1)
|
|
||||||
{
|
{
|
||||||
// setup scene
|
// setup scene
|
||||||
m_scene.setObjectName("Visualisation 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
|
// find the first item that accepts mouse presses under the cursor position
|
||||||
QGraphicsItem *itemAtPos = 0;
|
QGraphicsItem *itemAtPos = 0;
|
||||||
foreach(QGraphicsItem *item, q->items(event->pos())) {
|
foreach (QGraphicsItem *item, q->items(event->pos())) {
|
||||||
if (!(item->acceptedMouseButtons() & event->button()))
|
if (!(item->acceptedMouseButtons() & event->button()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -342,7 +311,7 @@ const Function *Visualisation::functionForItem(QGraphicsItem *item) const
|
|||||||
|
|
||||||
QGraphicsItem *Visualisation::itemForFunction(const Function *function) const
|
QGraphicsItem *Visualisation::itemForFunction(const Function *function) const
|
||||||
{
|
{
|
||||||
foreach(QGraphicsItem *item, items()) {
|
foreach (QGraphicsItem *item, items()) {
|
||||||
if (functionForItem(item) == function)
|
if (functionForItem(item) == function)
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@@ -359,6 +328,11 @@ const Function *Visualisation::function() const
|
|||||||
return d->m_model->filterFunction();
|
return d->m_model->filterFunction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Visualisation::setMinimumInclusiveCostRatio(double ratio)
|
||||||
|
{
|
||||||
|
d->m_model->setMinimumInclusiveCostRatio(ratio);
|
||||||
|
}
|
||||||
|
|
||||||
void Visualisation::setModel(DataModel *model)
|
void Visualisation::setModel(DataModel *model)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!d->m_model->sourceModel() && model, return); // only set once!
|
QTC_ASSERT(!d->m_model->sourceModel() && model, return); // only set once!
|
||||||
@@ -450,28 +424,26 @@ void Visualisation::populateScene()
|
|||||||
const QColor background = CallgrindHelper::colorForString(text);
|
const QColor background = CallgrindHelper::colorForString(text);
|
||||||
item->setBrush(background);
|
item->setBrush(background);
|
||||||
item->setData(FunctionGraphicsItem::FunctionCallKey, QVariant::fromValue(d->m_model->filterFunction()));
|
item->setData(FunctionGraphicsItem::FunctionCallKey, QVariant::fromValue(d->m_model->filterFunction()));
|
||||||
item->textItem()->setRotateText(false);
|
|
||||||
// NOTE: workaround wrong tooltip being show, no idea why...
|
// NOTE: workaround wrong tooltip being show, no idea why...
|
||||||
item->setZValue(-1);
|
item->setZValue(-1);
|
||||||
d->m_scene.addItem(item);
|
d->m_scene.addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the canvas elements to the scene
|
// add the canvas elements to the scene
|
||||||
qreal used = 0;
|
qreal used = sceneHeight * 0.1;
|
||||||
foreach(const Pair &cost, costs)
|
foreach (const Pair &cost, costs)
|
||||||
{
|
{
|
||||||
const QModelIndex &index = cost.first;
|
const QModelIndex &index = cost.first;
|
||||||
const QString text = index.data().toString();
|
const QString text = index.data().toString();
|
||||||
|
|
||||||
const qreal width = (sceneWidth * cost.second) / total;
|
const qreal height = (sceneHeight * 0.9 * cost.second) / total;
|
||||||
const qreal height = sceneHeight * 0.9;
|
|
||||||
|
|
||||||
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);
|
const QColor background = CallgrindHelper::colorForString(text);
|
||||||
item->setBrush(background);
|
item->setBrush(background);
|
||||||
item->setData(FunctionGraphicsItem::FunctionCallKey, index.data(DataModel::FunctionRole));
|
item->setData(FunctionGraphicsItem::FunctionCallKey, index.data(DataModel::FunctionRole));
|
||||||
d->m_scene.addItem(item);
|
d->m_scene.addItem(item);
|
||||||
used += width;
|
used += height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,6 +66,8 @@ public:
|
|||||||
void setFunction(const Valgrind::Callgrind::Function *function);
|
void setFunction(const Valgrind::Callgrind::Function *function);
|
||||||
const Valgrind::Callgrind::Function *function() const;
|
const Valgrind::Callgrind::Function *function() const;
|
||||||
|
|
||||||
|
void setMinimumInclusiveCostRatio(double ratio);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setText(const QString &message);
|
void setText(const QString &message);
|
||||||
|
|
||||||
|
@@ -36,10 +36,6 @@
|
|||||||
#include "callgrindengine.h"
|
#include "callgrindengine.h"
|
||||||
#include "callgrindvisualisation.h"
|
#include "callgrindvisualisation.h"
|
||||||
|
|
||||||
#ifndef DISABLE_CALLGRIND_WORKAROUNDS
|
|
||||||
#include "workarounds.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <analyzerbase/analyzerconstants.h>
|
#include <analyzerbase/analyzerconstants.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -129,6 +125,7 @@ void CallgrindWidgetHandler::ensureDockWidgets()
|
|||||||
return;
|
return;
|
||||||
QWidget *parenWidget = qobject_cast<QWidget *>(parent());
|
QWidget *parenWidget = qobject_cast<QWidget *>(parent());
|
||||||
m_visualisation = new Visualisation(parenWidget);
|
m_visualisation = new Visualisation(parenWidget);
|
||||||
|
m_visualisation->setFrameStyle(QFrame::NoFrame);
|
||||||
m_visualisation->setObjectName("Valgrind.CallgrindWidgetHandler.Visualisation");
|
m_visualisation->setObjectName("Valgrind.CallgrindWidgetHandler.Visualisation");
|
||||||
m_visualisation->setModel(m_dataModel);
|
m_visualisation->setModel(m_dataModel);
|
||||||
connect(m_visualisation, SIGNAL(functionActivated(const Valgrind::Callgrind::Function*)),
|
connect(m_visualisation, SIGNAL(functionActivated(const Valgrind::Callgrind::Function*)),
|
||||||
@@ -137,6 +134,7 @@ void CallgrindWidgetHandler::ensureDockWidgets()
|
|||||||
m_callersView = new CostView(parenWidget);
|
m_callersView = new CostView(parenWidget);
|
||||||
m_callersView->sortByColumn(CallModel::CostColumn);
|
m_callersView->sortByColumn(CallModel::CostColumn);
|
||||||
m_callersView->setObjectName("Valgrind.CallgrindWidgetHandler.CallersView");
|
m_callersView->setObjectName("Valgrind.CallgrindWidgetHandler.CallersView");
|
||||||
|
m_callersView->setFrameStyle(QFrame::NoFrame);
|
||||||
// enable sorting
|
// enable sorting
|
||||||
QSortFilterProxyModel *callerProxy = new QSortFilterProxyModel(m_callersModel);
|
QSortFilterProxyModel *callerProxy = new QSortFilterProxyModel(m_callersModel);
|
||||||
callerProxy->setSourceModel(m_callersModel);
|
callerProxy->setSourceModel(m_callersModel);
|
||||||
@@ -148,6 +146,7 @@ void CallgrindWidgetHandler::ensureDockWidgets()
|
|||||||
m_calleesView = new CostView(parenWidget);
|
m_calleesView = new CostView(parenWidget);
|
||||||
m_calleesView->sortByColumn(CallModel::CostColumn);
|
m_calleesView->sortByColumn(CallModel::CostColumn);
|
||||||
m_calleesView->setObjectName("Valgrind.CallgrindWidgetHandler.CalleesView");
|
m_calleesView->setObjectName("Valgrind.CallgrindWidgetHandler.CalleesView");
|
||||||
|
m_calleesView->setFrameStyle(QFrame::NoFrame);
|
||||||
// enable sorting
|
// enable sorting
|
||||||
QSortFilterProxyModel *calleeProxy = new QSortFilterProxyModel(m_calleesModel);
|
QSortFilterProxyModel *calleeProxy = new QSortFilterProxyModel(m_calleesModel);
|
||||||
calleeProxy->setSourceModel(m_calleesModel);
|
calleeProxy->setSourceModel(m_calleesModel);
|
||||||
@@ -247,7 +246,7 @@ void CallgrindWidgetHandler::populateActions(QLayout *layout)
|
|||||||
menu->addAction(m_costRelative);
|
menu->addAction(m_costRelative);
|
||||||
|
|
||||||
// show costs relative to parent
|
// 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
|
///FIXME: icon
|
||||||
m_costRelativeToParent->setToolTip(tr("Show costs relative to parent functions inclusive cost."));
|
m_costRelativeToParent->setToolTip(tr("Show costs relative to parent functions inclusive cost."));
|
||||||
m_costRelativeToParent->setCheckable(true);
|
m_costRelativeToParent->setCheckable(true);
|
||||||
@@ -333,8 +332,19 @@ void CallgrindWidgetHandler::doClear(bool clearParseData)
|
|||||||
|
|
||||||
void CallgrindWidgetHandler::slotRequestDump()
|
void CallgrindWidgetHandler::slotRequestDump()
|
||||||
{
|
{
|
||||||
|
setBusy(true);
|
||||||
|
|
||||||
m_visualisation->setText(tr("Populating..."));
|
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)
|
void CallgrindWidgetHandler::selectFunction(const Function *func)
|
||||||
@@ -386,7 +396,7 @@ void CallgrindWidgetHandler::updateFilterString()
|
|||||||
|
|
||||||
void CallgrindWidgetHandler::setCostFormat(CostDelegate::CostFormat format)
|
void CallgrindWidgetHandler::setCostFormat(CostDelegate::CostFormat format)
|
||||||
{
|
{
|
||||||
switch(format) {
|
switch (format) {
|
||||||
case CostDelegate::FormatAbsolute:
|
case CostDelegate::FormatAbsolute:
|
||||||
m_costAbsolute->setChecked(true);
|
m_costAbsolute->setChecked(true);
|
||||||
break;
|
break;
|
||||||
@@ -510,6 +520,9 @@ void CallgrindWidgetHandler::setParseData(ParseData *data)
|
|||||||
|
|
||||||
// clear history for new data
|
// clear history for new data
|
||||||
m_stackBrowser->clear();
|
m_stackBrowser->clear();
|
||||||
|
|
||||||
|
// unset busy state
|
||||||
|
setBusy(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindWidgetHandler::updateEventCombo()
|
void CallgrindWidgetHandler::updateEventCombo()
|
||||||
@@ -525,7 +538,7 @@ void CallgrindWidgetHandler::updateEventCombo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_eventCombo->show();
|
m_eventCombo->show();
|
||||||
foreach(const QString &event, data->events())
|
foreach (const QString &event, data->events())
|
||||||
m_eventCombo->addItem(ParseData::prettyStringForEvent(event));
|
m_eventCombo->addItem(ParseData::prettyStringForEvent(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -94,10 +94,6 @@ public:
|
|||||||
Callgrind::Internal::CostDelegate::CostFormat costFormat() const;
|
Callgrind::Internal::CostDelegate::CostFormat costFormat() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dumpRequested();
|
|
||||||
void resetRequested();
|
|
||||||
void pauseToggled(bool checked);
|
|
||||||
|
|
||||||
void functionSelected(const Valgrind::Callgrind::Function *);
|
void functionSelected(const Valgrind::Callgrind::Function *);
|
||||||
|
|
||||||
void costFormatChanged(Callgrind::Internal::CostDelegate::CostFormat format);
|
void costFormatChanged(Callgrind::Internal::CostDelegate::CostFormat format);
|
||||||
@@ -121,6 +117,9 @@ private slots:
|
|||||||
void slotGoToOverview();
|
void slotGoToOverview();
|
||||||
void stackBrowserChanged();
|
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 dataFunctionSelected(const QModelIndex &index);
|
||||||
void calleeFunctionSelected(const QModelIndex &index);
|
void calleeFunctionSelected(const QModelIndex &index);
|
||||||
void callerFunctionSelected(const QModelIndex &index);
|
void callerFunctionSelected(const QModelIndex &index);
|
||||||
@@ -138,6 +137,7 @@ private:
|
|||||||
Valgrind::Callgrind::CallModel *m_callersModel;
|
Valgrind::Callgrind::CallModel *m_callersModel;
|
||||||
Valgrind::Callgrind::CallModel *m_calleesModel;
|
Valgrind::Callgrind::CallModel *m_calleesModel;
|
||||||
|
|
||||||
|
// callgrind widgets
|
||||||
CostView *m_flatView;
|
CostView *m_flatView;
|
||||||
CostView *m_callersView;
|
CostView *m_callersView;
|
||||||
CostView *m_calleesView;
|
CostView *m_calleesView;
|
||||||
|
@@ -76,7 +76,7 @@ MemcheckConfigWidget::MemcheckConfigWidget(AbstractMemcheckSettings *settings, Q
|
|||||||
this, SLOT(slotSuppressionsAdded(QStringList)));
|
this, SLOT(slotSuppressionsAdded(QStringList)));
|
||||||
|
|
||||||
m_model->clear();
|
m_model->clear();
|
||||||
foreach(const QString &file, m_settings->suppressionFiles())
|
foreach (const QString &file, m_settings->suppressionFiles())
|
||||||
m_model->appendRow(new QStandardItem(file));
|
m_model->appendRow(new QStandardItem(file));
|
||||||
|
|
||||||
connect(m_ui->suppressionList->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
connect(m_ui->suppressionList->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
@@ -101,7 +101,7 @@ void MemcheckConfigWidget::slotAddSuppression()
|
|||||||
dialog.setHistory(conf->lastSuppressionDialogHistory());
|
dialog.setHistory(conf->lastSuppressionDialogHistory());
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
foreach(const QString &file, dialog.selectedFiles())
|
foreach (const QString &file, dialog.selectedFiles())
|
||||||
m_model->appendRow(new QStandardItem(file));
|
m_model->appendRow(new QStandardItem(file));
|
||||||
|
|
||||||
m_settings->addSuppressionFiles(dialog.selectedFiles());
|
m_settings->addSuppressionFiles(dialog.selectedFiles());
|
||||||
@@ -114,10 +114,10 @@ void MemcheckConfigWidget::slotAddSuppression()
|
|||||||
void MemcheckConfigWidget::slotSuppressionsAdded(const QStringList &files)
|
void MemcheckConfigWidget::slotSuppressionsAdded(const QStringList &files)
|
||||||
{
|
{
|
||||||
QStringList filesToAdd = 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());
|
filesToAdd.removeAll(m_model->item(i)->text());
|
||||||
|
|
||||||
foreach(const QString &file, filesToAdd)
|
foreach (const QString &file, filesToAdd)
|
||||||
m_model->appendRow(new QStandardItem(file));
|
m_model->appendRow(new QStandardItem(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,14 +132,14 @@ void MemcheckConfigWidget::slotRemoveSuppression()
|
|||||||
QList<int> rows;
|
QList<int> rows;
|
||||||
|
|
||||||
QStringList removed;
|
QStringList removed;
|
||||||
foreach(const QModelIndex &index, m_ui->suppressionList->selectionModel()->selectedIndexes()) {
|
foreach (const QModelIndex &index, m_ui->suppressionList->selectionModel()->selectedIndexes()) {
|
||||||
rows << index.row();
|
rows << index.row();
|
||||||
removed << index.data().toString();
|
removed << index.data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
qSort(rows.begin(), rows.end(), sortReverse);
|
qSort(rows.begin(), rows.end(), sortReverse);
|
||||||
|
|
||||||
foreach(int row, rows)
|
foreach (int row, rows)
|
||||||
m_model->removeRow(row);
|
m_model->removeRow(row);
|
||||||
|
|
||||||
m_settings->removeSuppressionFiles(removed);
|
m_settings->removeSuppressionFiles(removed);
|
||||||
@@ -147,7 +147,7 @@ void MemcheckConfigWidget::slotRemoveSuppression()
|
|||||||
|
|
||||||
void MemcheckConfigWidget::slotSuppressionsRemoved(const QStringList &files)
|
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())) {
|
if (files.contains(m_model->item(i)->text())) {
|
||||||
m_model->removeRow(i);
|
m_model->removeRow(i);
|
||||||
--i;
|
--i;
|
||||||
@@ -158,7 +158,7 @@ void MemcheckConfigWidget::slotSuppressionsRemoved(const QStringList &files)
|
|||||||
void MemcheckConfigWidget::setSuppressions(const QStringList &files)
|
void MemcheckConfigWidget::setSuppressions(const QStringList &files)
|
||||||
{
|
{
|
||||||
m_model->clear();
|
m_model->clear();
|
||||||
foreach(const QString &file, files)
|
foreach (const QString &file, files)
|
||||||
m_model->appendRow(new QStandardItem(file));
|
m_model->appendRow(new QStandardItem(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ QStringList MemcheckConfigWidget::suppressions() const
|
|||||||
{
|
{
|
||||||
QStringList ret;
|
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();
|
ret << m_model->item(i)->text();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -101,7 +101,7 @@ QStringList MemcheckEngine::toolArguments() const
|
|||||||
if (memcheckSettings->trackOrigins())
|
if (memcheckSettings->trackOrigins())
|
||||||
arguments << QLatin1String("--track-origins=yes");
|
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("--suppressions=%1").arg(file);
|
||||||
|
|
||||||
arguments << QString("--num-callers=%1").arg(memcheckSettings->numCallers());
|
arguments << QString("--num-callers=%1").arg(memcheckSettings->numCallers());
|
||||||
|
@@ -176,7 +176,7 @@ QString errorLocation(const QModelIndex &index, const Error &error,
|
|||||||
{
|
{
|
||||||
const ErrorListModel *model = 0;
|
const ErrorListModel *model = 0;
|
||||||
const QAbstractProxyModel *proxy = qobject_cast<const QAbstractProxyModel *>(index.model());
|
const QAbstractProxyModel *proxy = qobject_cast<const QAbstractProxyModel *>(index.model());
|
||||||
while(!model && proxy) {
|
while (!model && proxy) {
|
||||||
model = qobject_cast<const ErrorListModel *>(proxy->sourceModel());
|
model = qobject_cast<const ErrorListModel *>(proxy->sourceModel());
|
||||||
proxy = qobject_cast<const QAbstractProxyModel *>(proxy->sourceModel());
|
proxy = qobject_cast<const QAbstractProxyModel *>(proxy->sourceModel());
|
||||||
};
|
};
|
||||||
@@ -393,12 +393,12 @@ void MemcheckErrorDelegate::copy()
|
|||||||
|
|
||||||
const QString relativeTo = relativeToPath();
|
const QString relativeTo = relativeToPath();
|
||||||
|
|
||||||
foreach(const Stack &stack, error.stacks()) {
|
foreach (const Stack &stack, error.stacks()) {
|
||||||
if (!stack.auxWhat().isEmpty()) {
|
if (!stack.auxWhat().isEmpty()) {
|
||||||
stream << stack.auxWhat();
|
stream << stack.auxWhat();
|
||||||
}
|
}
|
||||||
int i = 1;
|
int i = 1;
|
||||||
foreach(const Frame &frame, stack.frames()) {
|
foreach (const Frame &frame, stack.frames()) {
|
||||||
stream << " " << i++ << ": " << makeFrameName(frame, relativeTo) << "\n";
|
stream << " " << i++ << ": " << makeFrameName(frame, relativeTo) << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -488,7 +488,7 @@ void MemcheckErrorView::contextMenuEvent(QContextMenuEvent *e)
|
|||||||
|
|
||||||
|
|
||||||
QList<Error> errors;
|
QList<Error> errors;
|
||||||
foreach(const QModelIndex &index, indizes) {
|
foreach (const QModelIndex &index, indizes) {
|
||||||
Error error = model()->data(index, ErrorListModel::ErrorRole).value<Error>();
|
Error error = model()->data(index, ErrorListModel::ErrorRole).value<Error>();
|
||||||
if (!error.suppression().isNull())
|
if (!error.suppression().isNull())
|
||||||
errors << error;
|
errors << error;
|
||||||
|
@@ -73,7 +73,7 @@ QVariantMap AbstractMemcheckSettings::defaults() const
|
|||||||
map.insert(QLatin1String(filterExternalIssuesC), true);
|
map.insert(QLatin1String(filterExternalIssuesC), true);
|
||||||
|
|
||||||
QVariantList defaultErrorKinds;
|
QVariantList defaultErrorKinds;
|
||||||
for(int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
|
for (int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
|
||||||
defaultErrorKinds << i;
|
defaultErrorKinds << i;
|
||||||
map.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds);
|
map.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds);
|
||||||
|
|
||||||
|
@@ -164,10 +164,10 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel
|
|||||||
ProjectExplorer::SessionManager *session
|
ProjectExplorer::SessionManager *session
|
||||||
= ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
= ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
||||||
QSet<QString> validFolders;
|
QSet<QString> validFolders;
|
||||||
foreach(ProjectExplorer::Project *project, session->projects()) {
|
foreach (ProjectExplorer::Project *project, session->projects()) {
|
||||||
validFolders << project->projectDirectory();
|
validFolders << project->projectDirectory();
|
||||||
foreach(ProjectExplorer::Target *target, project->targets()) {
|
foreach (ProjectExplorer::Target *target, project->targets()) {
|
||||||
foreach(ProjectExplorer::BuildConfiguration *config, target->buildConfigurations()) {
|
foreach (ProjectExplorer::BuildConfiguration *config, target->buildConfigurations()) {
|
||||||
validFolders << config->buildDirectory();
|
validFolders << config->buildDirectory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,7 +180,7 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel
|
|||||||
bool inProject = false;
|
bool inProject = false;
|
||||||
for ( int i = 0; i < framesToLookAt; ++i ) {
|
for ( int i = 0; i < framesToLookAt; ++i ) {
|
||||||
const Frame &frame = frames.at(i);
|
const Frame &frame = frames.at(i);
|
||||||
foreach(const QString &folder, validFolders) {
|
foreach (const QString &folder, validFolders) {
|
||||||
if (frame.object().startsWith(folder)) {
|
if (frame.object().startsWith(folder)) {
|
||||||
inProject = true;
|
inProject = true;
|
||||||
break;
|
break;
|
||||||
@@ -333,7 +333,7 @@ public:
|
|||||||
|
|
||||||
//find the first frame belonging to the project
|
//find the first frame belonging to the project
|
||||||
if (!m_projectFiles.isEmpty()) {
|
if (!m_projectFiles.isEmpty()) {
|
||||||
foreach(const Frame &frame, frames) {
|
foreach (const Frame &frame, frames) {
|
||||||
if (frame.directory().isEmpty() || frame.file().isEmpty())
|
if (frame.directory().isEmpty() || frame.file().isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -345,7 +345,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if no frame belonging to the project was found, return the first one that is not malloc/new
|
//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")
|
if (!frame.functionName().isEmpty() && frame.functionName() != QLatin1String("malloc")
|
||||||
&& !frame.functionName().startsWith("operator new(") )
|
&& !frame.functionName().startsWith("operator new(") )
|
||||||
{
|
{
|
||||||
@@ -455,7 +455,7 @@ void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
|
|||||||
|
|
||||||
QMenu *menu = filterMenu();
|
QMenu *menu = filterMenu();
|
||||||
QTC_ASSERT(menu, return);
|
QTC_ASSERT(menu, return);
|
||||||
foreach(const QString &file, mEngine->suppressionFiles()) {
|
foreach (const QString &file, mEngine->suppressionFiles()) {
|
||||||
QAction *action = menu->addAction(QFileInfo(file).fileName());
|
QAction *action = menu->addAction(QFileInfo(file).fileName());
|
||||||
action->setToolTip(file);
|
action->setToolTip(file);
|
||||||
action->setData(file);
|
action->setData(file);
|
||||||
|
@@ -163,13 +163,13 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, QWidget *parent, Q
|
|||||||
// can happen when using arrow keys to navigate and shortcut to trigger suppression
|
// can happen when using arrow keys to navigate and shortcut to trigger suppression
|
||||||
indizes << m_view->selectionModel()->currentIndex();
|
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>();
|
Error error = m_view->model()->data(index, ErrorListModel::ErrorRole).value<Error>();
|
||||||
if (!error.suppression().isNull())
|
if (!error.suppression().isNull())
|
||||||
m_errors << error;
|
m_errors << error;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(const Error &error, m_errors)
|
foreach (const Error &error, m_errors)
|
||||||
suppressions += suppressionText(error);
|
suppressions += suppressionText(error);
|
||||||
|
|
||||||
m_ui->suppressionEdit->setPlainText(suppressions);
|
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)
|
// add file to project (if there is a project that contains this file on the file system)
|
||||||
ProjectExplorer::SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
ProjectExplorer::SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
||||||
if (!session->projectForFile(path)) {
|
if (!session->projectForFile(path)) {
|
||||||
foreach(ProjectExplorer::Project *p, session->projects()) {
|
foreach (ProjectExplorer::Project *p, session->projects()) {
|
||||||
if (path.startsWith(p->projectDirectory())) {
|
if (path.startsWith(p->projectDirectory())) {
|
||||||
p->rootProjectNode()->addFiles(ProjectExplorer::UnknownFileType, QStringList() << path);
|
p->rootProjectNode()->addFiles(ProjectExplorer::UnknownFileType, QStringList() << path);
|
||||||
break;
|
break;
|
||||||
@@ -210,7 +210,7 @@ void SuppressionDialog::accept()
|
|||||||
|
|
||||||
QModelIndexList indizes = m_view->selectionModel()->selectedRows();
|
QModelIndexList indizes = m_view->selectionModel()->selectedRows();
|
||||||
qSort(indizes.begin(), indizes.end(), sortIndizesReverse);
|
qSort(indizes.begin(), indizes.end(), sortIndizesReverse);
|
||||||
foreach(const QModelIndex &index, indizes) {
|
foreach (const QModelIndex &index, indizes) {
|
||||||
bool removed = m_view->model()->removeRow(index.row());
|
bool removed = m_view->model()->removeRow(index.row());
|
||||||
QTC_ASSERT(removed, qt_noop());
|
QTC_ASSERT(removed, qt_noop());
|
||||||
Q_UNUSED(removed);
|
Q_UNUSED(removed);
|
||||||
@@ -221,7 +221,7 @@ void SuppressionDialog::accept()
|
|||||||
const Error rowError = m_view->model()->data(
|
const Error rowError = m_view->model()->data(
|
||||||
m_view->model()->index(row, 0), ErrorListModel::ErrorRole).value<Error>();
|
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)) {
|
if (equalSuppression(rowError, error)) {
|
||||||
bool removed = m_view->model()->removeRow(row);
|
bool removed = m_view->model()->removeRow(row);
|
||||||
QTC_ASSERT(removed, qt_noop());
|
QTC_ASSERT(removed, qt_noop());
|
||||||
|
@@ -41,6 +41,10 @@
|
|||||||
#include <coreplugin/progressmanager/futureprogress.h>
|
#include <coreplugin/progressmanager/futureprogress.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <projectexplorer/applicationrunconfiguration.h>
|
#include <projectexplorer/applicationrunconfiguration.h>
|
||||||
|
#include <analyzerbase/analyzermanager.h>
|
||||||
|
|
||||||
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QMainWindow>
|
||||||
|
|
||||||
#define VALGRIND_DEBUG_OUTPUT 0
|
#define VALGRIND_DEBUG_OUTPUT 0
|
||||||
|
|
||||||
@@ -52,7 +56,8 @@ ValgrindEngine::ValgrindEngine(const AnalyzerStartParameters &sp,
|
|||||||
ProjectExplorer::RunConfiguration *runConfiguration)
|
ProjectExplorer::RunConfiguration *runConfiguration)
|
||||||
: IAnalyzerEngine(sp, runConfiguration),
|
: IAnalyzerEngine(sp, runConfiguration),
|
||||||
m_settings(0),
|
m_settings(0),
|
||||||
m_progress(new QFutureInterface<void>()) ,
|
m_progress(new QFutureInterface<void>()),
|
||||||
|
m_progressWatcher(new QFutureWatcher<void>()),
|
||||||
m_isStopping(false)
|
m_isStopping(false)
|
||||||
{
|
{
|
||||||
if (runConfiguration)
|
if (runConfiguration)
|
||||||
@@ -60,6 +65,11 @@ ValgrindEngine::ValgrindEngine(const AnalyzerStartParameters &sp,
|
|||||||
|
|
||||||
if (!m_settings)
|
if (!m_settings)
|
||||||
m_settings = AnalyzerGlobalSettings::instance();
|
m_settings = AnalyzerGlobalSettings::instance();
|
||||||
|
|
||||||
|
connect(m_progressWatcher, SIGNAL(canceled()),
|
||||||
|
this, SLOT(handleProgressCanceled()));
|
||||||
|
connect(m_progressWatcher, SIGNAL(finished()),
|
||||||
|
this, SLOT(handleProgressFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ValgrindEngine::~ValgrindEngine()
|
ValgrindEngine::~ValgrindEngine()
|
||||||
@@ -75,6 +85,7 @@ void ValgrindEngine::start()
|
|||||||
progressTitle(), "valgrind");
|
progressTitle(), "valgrind");
|
||||||
fp->setKeepOnFinish(Core::FutureProgress::DontKeepOnFinish);
|
fp->setKeepOnFinish(Core::FutureProgress::DontKeepOnFinish);
|
||||||
m_progress->reportStarted();
|
m_progress->reportStarted();
|
||||||
|
m_progressWatcher->setFuture(m_progress->future());
|
||||||
|
|
||||||
#if VALGRIND_DEBUG_OUTPUT
|
#if VALGRIND_DEBUG_OUTPUT
|
||||||
emit standardOutputReceived(tr("Valgrind options: %1").arg(toolArguments().join(" ")));
|
emit standardOutputReceived(tr("Valgrind options: %1").arg(toolArguments().join(" ")));
|
||||||
@@ -119,6 +130,16 @@ QString ValgrindEngine::executable() const
|
|||||||
return startParameters().debuggee;
|
return startParameters().debuggee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ValgrindEngine::handleProgressCanceled()
|
||||||
|
{
|
||||||
|
AnalyzerManager::instance()->stopTool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ValgrindEngine::handleProgressFinished()
|
||||||
|
{
|
||||||
|
QApplication::alert(Core::ICore::instance()->mainWindow(), 3000);
|
||||||
|
}
|
||||||
|
|
||||||
void ValgrindEngine::runnerFinished()
|
void ValgrindEngine::runnerFinished()
|
||||||
{
|
{
|
||||||
emit standardOutputReceived(tr("** Analyzing finished **"));
|
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
|
///FIXME: get a better API for this into Qt Creator
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
QList< Core::IOutputPane *> panes = pm->getObjects<Core::IOutputPane>();
|
QList< Core::IOutputPane *> panes = pm->getObjects<Core::IOutputPane>();
|
||||||
foreach(Core::IOutputPane *pane, panes) {
|
foreach (Core::IOutputPane *pane, panes) {
|
||||||
if (pane->displayName() == tr("Application Output")) {
|
if (pane->displayName() == tr("Application Output")) {
|
||||||
pane->popup(false);
|
pane->popup(false);
|
||||||
break;
|
break;
|
||||||
|
@@ -48,6 +48,7 @@
|
|||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
#include <QtCore/QFutureInterface>
|
#include <QtCore/QFutureInterface>
|
||||||
|
#include <QtCore/QFutureWatcher>
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
class AnalyzerSettings;
|
class AnalyzerSettings;
|
||||||
@@ -76,8 +77,11 @@ protected:
|
|||||||
|
|
||||||
Analyzer::AnalyzerSettings *m_settings;
|
Analyzer::AnalyzerSettings *m_settings;
|
||||||
QFutureInterface<void> *m_progress;
|
QFutureInterface<void> *m_progress;
|
||||||
|
QFutureWatcher<void> *m_progressWatcher;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void handleProgressCanceled();
|
||||||
|
void handleProgressFinished();
|
||||||
void runnerFinished();
|
void runnerFinished();
|
||||||
|
|
||||||
void receiveStandardOutput(const QByteArray &);
|
void receiveStandardOutput(const QByteArray &);
|
||||||
|
@@ -368,7 +368,7 @@ void CallgrindParserTests::testMultiPosAndCost()
|
|||||||
|
|
||||||
const Function *findFunction(const QString &needle, const QVector<const Function *> &haystack)
|
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) {
|
if (function->name() == needle) {
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
|
@@ -162,9 +162,9 @@ void ModelTestWidget::showViewContextMenu(const QPoint &pos)
|
|||||||
|
|
||||||
QVector<quint64> totalCosts;
|
QVector<quint64> totalCosts;
|
||||||
totalCosts.fill(0, data->events().size());
|
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);
|
const CostItem *item = func->costItems().at(row);
|
||||||
for(int column = 0; column < columns; ++column) {
|
for (int column = 0; column < columns; ++column) {
|
||||||
QVariant value;
|
QVariant value;
|
||||||
if (column < lastEventColumn) {
|
if (column < lastEventColumn) {
|
||||||
value = item->cost(column);
|
value = item->cost(column);
|
||||||
@@ -181,7 +181,7 @@ void ModelTestWidget::showViewContextMenu(const QPoint &pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QStringList totalCostsStrings;
|
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));
|
totalCostsStrings << QString("%1: %2").arg(totalCosts.at(i)).arg(data->events().at(i));
|
||||||
}
|
}
|
||||||
view->setWindowTitle(totalCostsStrings.join(QLatin1String(", ")));
|
view->setWindowTitle(totalCostsStrings.join(QLatin1String(", ")));
|
||||||
|
Reference in New Issue
Block a user