Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracepoint hover #684

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
[submodule "3rdparty/PrefixTickLabels"]
path = 3rdparty/PrefixTickLabels
url = https://github.com/koenpoppe/PrefixTickLabels
[submodule "3rdparty/fmtparser"]
path = 3rdparty/fmtparser
url = https://github.com/fmtparser/fmtparser
1 change: 1 addition & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include(perfparser.cmake)
include(PrefixTickLabels.cmake)
add_subdirectory(fmtparser)
1 change: 1 addition & 0 deletions 3rdparty/fmtparser
Submodule fmtparser added at c10a48
3 changes: 3 additions & 0 deletions src/models/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_library(
disassemblymodel.cpp
disassemblyoutput.cpp
eventmodel.cpp
eventmodelproxy.cpp
filterandzoomstack.cpp
formattingutils.cpp
frequencymodel.cpp
Expand All @@ -22,11 +23,13 @@ add_library(
timeaxisheaderview.cpp
timelinedelegate.cpp
topproxy.cpp
tracepointformat.cpp
treemodel.cpp
)

target_link_libraries(
models
fmt_parser
Qt::Core
Qt::Widgets
KF${QT_MAJOR_VERSION}::ItemModels
Expand Down
57 changes: 37 additions & 20 deletions src/models/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <QSet>
#include <QString>
#include <QTypeInfo>
#include <QVariant>
#include <QVector>

#include "../util.h"
Expand Down Expand Up @@ -787,18 +788,23 @@ const constexpr auto INVALID_CPU_ID = std::numeric_limits<quint32>::max();
const constexpr int INVALID_TID = -1;
const constexpr int INVALID_PID = -1;

const constexpr auto INVALID_TRACEPOINTFORMAT = std::numeric_limits<quint32>::max();
const constexpr auto INVALID_TRACEPOINTDATA = std::numeric_limits<quint32>::max();

struct Event
{
quint64 time = 0;
quint64 cost = 0;
qint32 type = -1;
qint32 stackId = -1;
quint32 cpuId = INVALID_CPU_ID;
quint32 tracepointFormat = INVALID_TRACEPOINTFORMAT;
quint32 tracepointData = INVALID_TRACEPOINTDATA;

bool operator==(const Event& rhs) const
{
return std::tie(time, cost, type, stackId, cpuId)
== std::tie(rhs.time, rhs.cost, rhs.type, rhs.stackId, rhs.cpuId);
return std::tie(time, cost, type, stackId, cpuId, tracepointFormat, tracepointData)
== std::tie(rhs.time, rhs.cost, rhs.type, rhs.stackId, rhs.cpuId, rhs.tracepointFormat, rhs.tracepointData);
}
};

Expand Down Expand Up @@ -952,36 +958,50 @@ struct ThreadNames
QHash<qint32, QHash<qint32, QString>> names;
};

struct TracepointEvents
{
QString name;
Events events;
bool operator==(const TracepointEvents& rhs) const
{
return std::tie(name, events) == std::tie(rhs.name, rhs.events);
}
};

struct TracePointFormat
{
QString systemId;
QString nameId;
quint32 flags;
QString format;
};

#include <QHash>
using TracePointData = QHash<QString, QVariant>;

struct EventResults
{
QVector<ThreadEvents> threads;
QVector<CpuEvents> cpus;
QVector<TracepointEvents> tracepoints;
QVector<QVector<qint32>> stacks;
QVector<CostSummary> totalCosts;
QHash<quint32, TracePointFormat> tracePointFormats;
QVector<TracePointData> tracePointData;
qint32 offCpuTimeCostId = -1;
qint32 lostEventCostId = -1;
qint32 tracepointEventCostId = -1;

ThreadEvents* findThread(qint32 pid, qint32 tid);
const ThreadEvents* findThread(qint32 pid, qint32 tid) const;

bool operator==(const EventResults& rhs) const
{
return std::tie(threads, cpus, stacks, totalCosts, offCpuTimeCostId)
== std::tie(rhs.threads, rhs.cpus, rhs.stacks, rhs.totalCosts, rhs.offCpuTimeCostId);
return std::tie(threads, cpus, tracepoints, stacks, totalCosts, offCpuTimeCostId)
== std::tie(rhs.threads, rhs.cpus, rhs.tracepoints, rhs.stacks, rhs.totalCosts, rhs.offCpuTimeCostId);
}
};

struct Tracepoint
{
quint64 time = 0;
QString name;
};

struct TracepointResults
{
QVector<Tracepoint> tracepoints;
};

struct FilterAction
{
TimeRange time;
Expand Down Expand Up @@ -1094,11 +1114,8 @@ Q_DECLARE_TYPEINFO(Data::ThreadNames, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(Data::EventResults)
Q_DECLARE_TYPEINFO(Data::EventResults, Q_MOVABLE_TYPE);

Q_DECLARE_METATYPE(Data::Tracepoint)
Q_DECLARE_TYPEINFO(Data::Tracepoint, Q_MOVABLE_TYPE);

Q_DECLARE_METATYPE(Data::TracepointResults)
Q_DECLARE_TYPEINFO(Data::TracepointResults, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(Data::TracepointEvents)
Q_DECLARE_TYPEINFO(Data::TracepointEvents, Q_MOVABLE_TYPE);

Q_DECLARE_METATYPE(Data::TimeRange)
Q_DECLARE_TYPEINFO(Data::TimeRange, Q_MOVABLE_TYPE);
Expand Down
Loading
Loading