2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-06-29 15:05:45 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-06-29 15:05:45 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-06-29 15:05:45 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-06-29 15:05:45 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-06-29 15:05:45 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-06-29 15:05:45 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2011-06-29 15:05:45 +02:00
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
#include "qmlprofilermodelmanager.h"
|
2015-12-04 15:41:20 +01:00
|
|
|
#include "qmlprofilerstatisticsmodel.h"
|
2015-07-01 18:04:26 +02:00
|
|
|
#include "qmlprofilerviewmanager.h"
|
2015-12-04 13:30:54 +01:00
|
|
|
#include "qmlprofilereventsview.h"
|
2016-05-02 12:18:57 +02:00
|
|
|
#include "qmlprofilereventtypes.h"
|
2012-02-24 10:47:17 +01:00
|
|
|
|
2016-02-26 14:14:49 +01:00
|
|
|
#include <debugger/analyzer/analyzermanager.h>
|
2015-07-01 18:04:26 +02:00
|
|
|
#include <utils/itemviews.h>
|
2012-02-24 10:47:17 +01:00
|
|
|
|
2015-07-01 18:04:26 +02:00
|
|
|
#include <QStandardItemModel>
|
2011-06-29 15:05:45 +02:00
|
|
|
|
|
|
|
|
namespace QmlProfiler {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2015-12-04 13:30:54 +01:00
|
|
|
class QmlProfilerStatisticsMainView;
|
|
|
|
|
class QmlProfilerStatisticsRelativesView;
|
2011-11-04 17:33:09 +01:00
|
|
|
|
2011-06-29 15:05:45 +02:00
|
|
|
enum ItemRole {
|
2014-07-04 14:10:37 +02:00
|
|
|
SortRole = Qt::UserRole + 1, // Sort by data, not by displayed string
|
2014-08-29 16:32:42 +02:00
|
|
|
TypeIdRole,
|
2014-07-04 14:10:37 +02:00
|
|
|
FilenameRole,
|
|
|
|
|
LineRole,
|
2014-08-29 16:32:42 +02:00
|
|
|
ColumnRole
|
2011-06-29 15:05:45 +02:00
|
|
|
};
|
|
|
|
|
|
2015-07-01 18:04:26 +02:00
|
|
|
enum Fields {
|
|
|
|
|
Name,
|
|
|
|
|
Callee,
|
|
|
|
|
CalleeDescription,
|
|
|
|
|
Caller,
|
|
|
|
|
CallerDescription,
|
|
|
|
|
CallCount,
|
|
|
|
|
Details,
|
|
|
|
|
Location,
|
|
|
|
|
MaxTime,
|
|
|
|
|
TimePerCall,
|
|
|
|
|
SelfTime,
|
|
|
|
|
SelfTimeInPercent,
|
|
|
|
|
MinTime,
|
|
|
|
|
TimeInPercent,
|
|
|
|
|
TotalTime,
|
|
|
|
|
Type,
|
|
|
|
|
MedianTime,
|
|
|
|
|
MaxFields
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-04 13:30:54 +01:00
|
|
|
class QmlProfilerStatisticsView : public QmlProfilerEventsView
|
2011-11-04 17:33:09 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2016-01-04 17:20:13 +01:00
|
|
|
explicit QmlProfilerStatisticsView(QWidget *parent,
|
2015-12-04 13:30:54 +01:00
|
|
|
QmlProfilerModelManager *profilerModelManager);
|
|
|
|
|
~QmlProfilerStatisticsView();
|
2011-11-04 17:33:09 +01:00
|
|
|
|
2015-12-04 13:30:54 +01:00
|
|
|
void clear() override;
|
|
|
|
|
void restrictToRange(qint64 rangeStart, qint64 rangeEnd) override;
|
|
|
|
|
bool isRestrictedToRange() const override;
|
2011-11-10 11:19:22 +01:00
|
|
|
|
2011-11-09 12:57:41 +01:00
|
|
|
public slots:
|
2015-12-04 13:30:54 +01:00
|
|
|
void selectByTypeId(int typeIndex) override;
|
|
|
|
|
void onVisibleFeaturesChanged(quint64 features) override;
|
2011-11-04 17:33:09 +01:00
|
|
|
|
|
|
|
|
protected:
|
2016-01-19 16:24:21 +01:00
|
|
|
void contextMenuEvent(QContextMenuEvent *ev) override;
|
2011-11-04 17:33:09 +01:00
|
|
|
|
|
|
|
|
private:
|
2015-12-04 13:02:12 +01:00
|
|
|
QModelIndex selectedModelIndex() const;
|
|
|
|
|
void copyTableToClipboard() const;
|
|
|
|
|
void copyRowToClipboard() const;
|
|
|
|
|
bool mouseOnTable(const QPoint &position) const;
|
|
|
|
|
void setShowExtendedStatistics(bool show);
|
|
|
|
|
bool showExtendedStatistics() const;
|
|
|
|
|
|
2015-12-04 13:30:54 +01:00
|
|
|
class QmlProfilerStatisticsViewPrivate;
|
|
|
|
|
QmlProfilerStatisticsViewPrivate *d;
|
2011-11-04 17:33:09 +01:00
|
|
|
};
|
|
|
|
|
|
2015-12-04 13:30:54 +01:00
|
|
|
class QmlProfilerStatisticsMainView : public Utils::TreeView
|
2011-06-29 15:05:45 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2015-12-04 15:41:20 +01:00
|
|
|
explicit QmlProfilerStatisticsMainView(QWidget *parent, QmlProfilerStatisticsModel *model);
|
2015-12-04 13:30:54 +01:00
|
|
|
~QmlProfilerStatisticsMainView();
|
2011-06-29 15:05:45 +02:00
|
|
|
|
|
|
|
|
void setFieldViewable(Fields field, bool show);
|
|
|
|
|
void setShowAnonymousEvents( bool showThem );
|
|
|
|
|
|
2014-08-29 16:32:42 +02:00
|
|
|
QModelIndex selectedModelIndex() const;
|
2011-11-04 17:33:09 +01:00
|
|
|
void copyTableToClipboard() const;
|
|
|
|
|
void copyRowToClipboard() const;
|
|
|
|
|
|
2016-05-02 12:18:57 +02:00
|
|
|
static QString nameForType(RangeType typeNumber);
|
2011-08-24 11:18:48 +02:00
|
|
|
|
2014-08-29 16:32:42 +02:00
|
|
|
int selectedTypeId() const;
|
2011-11-08 16:54:23 +01:00
|
|
|
|
2012-02-03 17:28:29 +01:00
|
|
|
void setShowExtendedStatistics(bool);
|
|
|
|
|
bool showExtendedStatistics() const;
|
|
|
|
|
|
2011-06-29 15:05:45 +02:00
|
|
|
signals:
|
2012-01-12 16:36:40 +01:00
|
|
|
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
|
2014-08-29 16:32:42 +02:00
|
|
|
void typeSelected(int typeIndex);
|
2011-06-29 15:05:45 +02:00
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void clear();
|
|
|
|
|
void jumpToItem(const QModelIndex &index);
|
2014-08-29 16:32:42 +02:00
|
|
|
void selectType(int typeIndex);
|
2011-06-29 15:05:45 +02:00
|
|
|
void buildModel();
|
2014-09-26 18:25:39 +02:00
|
|
|
void updateNotes(int typeIndex);
|
2011-06-29 15:05:45 +02:00
|
|
|
|
|
|
|
|
private:
|
2014-04-03 11:15:56 +02:00
|
|
|
void selectItem(const QStandardItem *item);
|
2011-06-29 15:05:45 +02:00
|
|
|
void setHeaderLabels();
|
2015-12-04 15:41:20 +01:00
|
|
|
void parseModel();
|
2015-11-11 11:46:21 +01:00
|
|
|
QStandardItem *itemFromIndex(const QModelIndex &index) const;
|
2011-06-29 15:05:45 +02:00
|
|
|
|
|
|
|
|
private:
|
2015-12-04 13:30:54 +01:00
|
|
|
class QmlProfilerStatisticsMainViewPrivate;
|
|
|
|
|
QmlProfilerStatisticsMainViewPrivate *d;
|
2011-11-04 17:33:09 +01:00
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-04 13:30:54 +01:00
|
|
|
class QmlProfilerStatisticsRelativesView : public Utils::TreeView
|
2011-11-04 17:33:09 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2015-12-04 15:41:20 +01:00
|
|
|
explicit QmlProfilerStatisticsRelativesView(QmlProfilerStatisticsRelativesModel *model,
|
|
|
|
|
QWidget *parent);
|
2015-12-04 13:30:54 +01:00
|
|
|
~QmlProfilerStatisticsRelativesView();
|
2011-11-04 17:33:09 +01:00
|
|
|
|
|
|
|
|
signals:
|
2014-08-29 16:32:42 +02:00
|
|
|
void typeClicked(int typeIndex);
|
2015-11-11 11:46:21 +01:00
|
|
|
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
|
2011-11-04 17:33:09 +01:00
|
|
|
|
|
|
|
|
public slots:
|
2014-08-29 16:32:42 +02:00
|
|
|
void displayType(int typeIndex);
|
2011-11-04 17:33:09 +01:00
|
|
|
void jumpToItem(const QModelIndex &);
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
|
|
private:
|
2015-12-04 15:41:20 +01:00
|
|
|
void rebuildTree(const QmlProfilerStatisticsParentsModel::QmlStatisticsRelativesMap &map);
|
2011-11-04 17:33:09 +01:00
|
|
|
void updateHeader();
|
|
|
|
|
QStandardItemModel *treeModel();
|
2011-06-29 15:05:45 +02:00
|
|
|
|
2015-12-04 13:30:54 +01:00
|
|
|
class QmlProfilerStatisticsRelativesViewPrivate;
|
|
|
|
|
QmlProfilerStatisticsRelativesViewPrivate *d;
|
2011-06-29 15:05:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlProfiler
|