2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-06-29 15:05:45 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
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
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2011-06-29 15:05:45 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-06-29 15:05:45 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-06-29 15:05:45 +02:00
|
|
|
|
|
|
|
|
#ifndef QMLPROFILEREVENTVIEW_H
|
|
|
|
|
#define QMLPROFILEREVENTVIEW_H
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QTreeView>
|
|
|
|
|
#include <QStandardItemModel>
|
2012-04-18 12:06:10 +02:00
|
|
|
#include <qmldebug/qmlprofilereventtypes.h>
|
2012-02-24 10:47:17 +01:00
|
|
|
#include "qmlprofilerdatamodel.h"
|
|
|
|
|
|
|
|
|
|
#include <analyzerbase/ianalyzertool.h>
|
|
|
|
|
|
|
|
|
|
#include "qmlprofilerviewmanager.h"
|
2011-06-29 15:05:45 +02:00
|
|
|
|
|
|
|
|
namespace QmlProfiler {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2011-11-04 17:33:09 +01:00
|
|
|
class QmlProfilerEventsMainView;
|
|
|
|
|
class QmlProfilerEventsParentsAndChildrenView;
|
|
|
|
|
|
2011-06-29 15:05:45 +02:00
|
|
|
enum ItemRole {
|
2011-12-05 16:32:05 +01:00
|
|
|
EventHashStrRole = Qt::UserRole+1,
|
2011-06-29 15:05:45 +02:00
|
|
|
FilenameRole = Qt::UserRole+2,
|
2011-11-04 17:33:09 +01:00
|
|
|
LineRole = Qt::UserRole+3,
|
2012-01-12 16:36:40 +01:00
|
|
|
ColumnRole = Qt::UserRole+4,
|
|
|
|
|
EventIdRole = Qt::UserRole+5
|
2011-06-29 15:05:45 +02:00
|
|
|
};
|
|
|
|
|
|
2011-11-04 17:33:09 +01:00
|
|
|
class QmlProfilerEventsWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2012-02-24 10:47:17 +01:00
|
|
|
explicit QmlProfilerEventsWidget(QWidget *parent,
|
|
|
|
|
Analyzer::IAnalyzerTool *profilerTool,
|
|
|
|
|
QmlProfilerViewManager *container,
|
|
|
|
|
QmlProfilerDataModel *profilerDataModel );
|
2011-11-04 17:33:09 +01:00
|
|
|
~QmlProfilerEventsWidget();
|
|
|
|
|
|
|
|
|
|
void switchToV8View();
|
|
|
|
|
void clear();
|
|
|
|
|
|
2011-11-08 16:54:23 +01:00
|
|
|
void getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd);
|
2011-11-04 17:33:09 +01:00
|
|
|
QModelIndex selectedItem() const;
|
|
|
|
|
bool mouseOnTable(const QPoint &position) const;
|
|
|
|
|
void copyTableToClipboard() const;
|
|
|
|
|
void copyRowToClipboard() const;
|
|
|
|
|
|
2011-11-10 11:19:22 +01:00
|
|
|
bool hasGlobalStats() const;
|
2012-02-03 17:28:29 +01:00
|
|
|
void setShowExtendedStatistics(bool show);
|
|
|
|
|
bool showExtendedStatistics() const;
|
2011-11-10 11:19:22 +01:00
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
bool isQml() const;
|
|
|
|
|
bool isV8() const;
|
|
|
|
|
|
2011-11-04 17:33:09 +01:00
|
|
|
signals:
|
2012-01-12 16:36:40 +01:00
|
|
|
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
|
2011-11-09 12:57:41 +01:00
|
|
|
void showEventInTimeline(int eventId);
|
2012-05-16 12:16:45 +02:00
|
|
|
void resized();
|
2011-11-09 12:57:41 +01:00
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void updateSelectedEvent(int eventId) const;
|
2012-01-12 16:36:40 +01:00
|
|
|
void selectBySourceLocation(const QString &filename, int line, int column);
|
2011-11-04 17:33:09 +01:00
|
|
|
|
2012-02-13 15:26:57 +01:00
|
|
|
private slots:
|
2012-02-24 10:47:17 +01:00
|
|
|
void profilerDataModelStateChanged();
|
2012-02-13 15:26:57 +01:00
|
|
|
|
2011-11-04 17:33:09 +01:00
|
|
|
protected:
|
|
|
|
|
void contextMenuEvent(QContextMenuEvent *ev);
|
2012-05-16 12:16:45 +02:00
|
|
|
virtual void resizeEvent(QResizeEvent *event);
|
2011-11-04 17:33:09 +01:00
|
|
|
|
|
|
|
|
private:
|
2012-02-24 10:47:17 +01:00
|
|
|
class QmlProfilerEventsWidgetPrivate;
|
|
|
|
|
QmlProfilerEventsWidgetPrivate *d;
|
2011-11-04 17:33:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class QmlProfilerEventsMainView : public QTreeView
|
2011-06-29 15:05:45 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
enum Fields {
|
|
|
|
|
Name,
|
|
|
|
|
Type,
|
|
|
|
|
Percent,
|
|
|
|
|
TotalDuration,
|
2011-09-27 14:38:22 +02:00
|
|
|
SelfPercent,
|
|
|
|
|
SelfDuration,
|
2011-06-29 15:05:45 +02:00
|
|
|
CallCount,
|
|
|
|
|
TimePerCall,
|
|
|
|
|
MaxTime,
|
|
|
|
|
MinTime,
|
2011-08-24 16:30:31 +02:00
|
|
|
MedianTime,
|
2011-06-29 15:05:45 +02:00
|
|
|
Details,
|
|
|
|
|
|
|
|
|
|
MaxFields
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum ViewTypes {
|
|
|
|
|
EventsView,
|
|
|
|
|
CallersView,
|
|
|
|
|
CalleesView,
|
2011-09-27 14:38:22 +02:00
|
|
|
V8ProfileView,
|
2011-06-29 15:05:45 +02:00
|
|
|
|
|
|
|
|
MaxViewTypes
|
|
|
|
|
};
|
|
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
explicit QmlProfilerEventsMainView(ViewTypes viewType,
|
|
|
|
|
QWidget *parent,
|
|
|
|
|
QmlProfilerDataModel *dataModel);
|
2011-11-04 17:33:09 +01:00
|
|
|
~QmlProfilerEventsMainView();
|
2011-06-29 15:05:45 +02:00
|
|
|
|
|
|
|
|
void setFieldViewable(Fields field, bool show);
|
|
|
|
|
void setViewType(ViewTypes type);
|
2012-02-24 10:47:17 +01:00
|
|
|
ViewTypes viewType() const;
|
2011-06-29 15:05:45 +02:00
|
|
|
void setShowAnonymousEvents( bool showThem );
|
|
|
|
|
|
2011-08-24 11:18:48 +02:00
|
|
|
QModelIndex selectedItem() const;
|
2011-11-04 17:33:09 +01:00
|
|
|
void copyTableToClipboard() const;
|
|
|
|
|
void copyRowToClipboard() const;
|
|
|
|
|
|
2011-12-05 16:32:05 +01:00
|
|
|
static QString displayTime(double time);
|
2011-11-04 17:33:09 +01:00
|
|
|
static QString nameForType(int typeNumber);
|
2011-08-24 11:18:48 +02:00
|
|
|
|
2011-11-08 16:54:23 +01:00
|
|
|
void getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd);
|
2011-11-10 11:19:22 +01:00
|
|
|
bool isRangeGlobal(qint64 rangeStart, qint64 rangeEnd) const;
|
2011-11-09 12:57:41 +01:00
|
|
|
int selectedEventId() 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);
|
2011-11-04 17:33:09 +01:00
|
|
|
void eventSelected(int eventId);
|
2011-11-09 12:57:41 +01:00
|
|
|
void showEventInTimeline(int eventId);
|
2011-06-29 15:05:45 +02:00
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void clear();
|
|
|
|
|
void jumpToItem(const QModelIndex &index);
|
2011-11-04 17:33:09 +01:00
|
|
|
void selectEvent(int eventId);
|
2011-12-14 14:30:37 +01:00
|
|
|
void selectEventByLocation(const QString &filename, int line);
|
2011-06-29 15:05:45 +02:00
|
|
|
void buildModel();
|
2012-01-17 13:26:57 +01:00
|
|
|
void changeDetailsForEvent(int eventId, const QString &newString);
|
2011-06-29 15:05:45 +02:00
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
private slots:
|
|
|
|
|
void profilerDataModelStateChanged();
|
|
|
|
|
|
2011-06-29 15:05:45 +02:00
|
|
|
private:
|
|
|
|
|
void setHeaderLabels();
|
|
|
|
|
|
|
|
|
|
private:
|
2011-11-04 17:33:09 +01:00
|
|
|
class QmlProfilerEventsMainViewPrivate;
|
|
|
|
|
QmlProfilerEventsMainViewPrivate *d;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class QmlProfilerEventsParentsAndChildrenView : public QTreeView
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
enum SubViewType {
|
|
|
|
|
ParentsView,
|
|
|
|
|
ChildrenView,
|
|
|
|
|
V8ParentsView,
|
|
|
|
|
V8ChildrenView,
|
|
|
|
|
MaxSubtableTypes
|
|
|
|
|
};
|
|
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
explicit QmlProfilerEventsParentsAndChildrenView(SubViewType subtableType,
|
|
|
|
|
QWidget *parent,
|
|
|
|
|
QmlProfilerDataModel *model);
|
2011-11-04 17:33:09 +01:00
|
|
|
~QmlProfilerEventsParentsAndChildrenView();
|
|
|
|
|
|
|
|
|
|
void setViewType(SubViewType type);
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void eventClicked(int eventId);
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void displayEvent(int eventId);
|
|
|
|
|
void jumpToItem(const QModelIndex &);
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
|
|
private:
|
2012-02-24 10:47:17 +01:00
|
|
|
void rebuildTree(void *profilerDataModel);
|
2011-11-04 17:33:09 +01:00
|
|
|
void updateHeader();
|
|
|
|
|
QStandardItemModel *treeModel();
|
2012-02-24 10:47:17 +01:00
|
|
|
QmlProfilerDataModel *m_profilerDataModel;
|
2011-06-29 15:05:45 +02:00
|
|
|
|
2011-11-04 17:33:09 +01:00
|
|
|
SubViewType m_subtableType;
|
2011-06-29 15:05:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlProfiler
|
|
|
|
|
|
|
|
|
|
#endif // QMLPROFILEREVENTVIEW_H
|