Tracing: Add Chrome Trace Format Visualizer plugin

This new plugin adds a viewer for Chrome Trace Format (CTF) files
(aka Trace Event Format). It uses the same UI components as the
QML Profiler timeline and the Perf Profiler.

The Trace Event Format is generated by different kinds of tracing tools.
Usually the files are display with the trace-viewer, built into Chrome
(chrome://tracing). This plugin was developed because of the high memory
usage of trace-viewer, which makes it difficult to use with trace files
bigger than 100 MB.

The plugin fully supports all event types used in data generated by
LTTng, converted to CTF by https://github.com/KDAB/ctf2ctf.
Some of the more advanced event types used for example in Android system
traces, though, are not supported. The viewer will silently ignore
unsupported event types.

Supported Event Types:
- Begin, End, Duration and Instant events
- Counter events (graphs)
- Metadata events (process and thread name)

The plugin uses nlohmann/json instead of QJson because of the ~128 MB
object size limit by QJson.

[ChangeLog][Tracing][CtfVisualizer] Added Chrome Trace Format Visualizer plugin

Change-Id: I5969f7f83f3305712d4aec04487e2403510af64b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Tim Henning
2019-08-29 11:45:45 +02:00
parent 41361047b4
commit 7fec418205
22 changed files with 22816 additions and 2 deletions

View File

@@ -0,0 +1,86 @@
/****************************************************************************
**
** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company,
** info@kdab.com, author Tim Henning <tim.henning@kdab.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** 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 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.
**
** 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.
**
****************************************************************************/
#pragma once
#include "ctfvisualizerconstants.h"
#include <debugger/debuggermainwindow.h>
#include <tracing/timelinemodelaggregator.h>
#include <tracing/timelinezoomcontrol.h>
#include <QScopedPointer>
namespace CtfVisualizer {
namespace Internal {
class CtfTraceManager;
class CtfStatisticsModel;
class CtfStatisticsView;
class CtfVisualizerTraceView;
class CtfVisualizerTool : public QObject
{
Q_OBJECT
public:
CtfVisualizerTool();
~CtfVisualizerTool();
Timeline::TimelineModelAggregator *modelAggregator() const;
CtfTraceManager *traceManager() const;
Timeline::TimelineZoomControl *zoomControl() const;
void loadJson();
signals:
void viewsCreated();
private:
void createViews();
void initialize();
void finalize();
Utils::Perspective m_perspective{Constants::CtfVisualizerPerspectiveId,
tr("Chrome Trace Format Visualizer")};
bool m_isLoading;
QScopedPointer<QAction> m_loadJson;
CtfVisualizerTraceView *m_traceView;
const QScopedPointer<Timeline::TimelineModelAggregator> m_modelAggregator;
const QScopedPointer<Timeline::TimelineZoomControl> m_zoomControl;
const QScopedPointer<CtfStatisticsModel> m_statisticsModel;
CtfStatisticsView *m_statisticsView;
const QScopedPointer<CtfTraceManager> m_traceManager;
};
} // namespace Internal
} // namespace CtfVisualizer