diff options
Diffstat (limited to 'src/tools/tracegen')
-rw-r--r-- | src/tools/tracegen/ctf.cpp | 5 | ||||
-rw-r--r-- | src/tools/tracegen/ctf.h | 2 | ||||
-rw-r--r-- | src/tools/tracegen/etw.cpp | 3 | ||||
-rw-r--r-- | src/tools/tracegen/etw.h | 2 | ||||
-rw-r--r-- | src/tools/tracegen/helpers.cpp | 11 | ||||
-rw-r--r-- | src/tools/tracegen/helpers.h | 5 | ||||
-rw-r--r-- | src/tools/tracegen/lttng.cpp | 42 | ||||
-rw-r--r-- | src/tools/tracegen/lttng.h | 2 | ||||
-rw-r--r-- | src/tools/tracegen/panic.cpp | 2 | ||||
-rw-r--r-- | src/tools/tracegen/panic.h | 2 | ||||
-rw-r--r-- | src/tools/tracegen/provider.cpp | 2 | ||||
-rw-r--r-- | src/tools/tracegen/provider.h | 2 | ||||
-rw-r--r-- | src/tools/tracegen/qtheaders.cpp | 2 | ||||
-rw-r--r-- | src/tools/tracegen/qtheaders.h | 2 | ||||
-rw-r--r-- | src/tools/tracegen/tracegen.cpp | 2 |
15 files changed, 56 insertions, 30 deletions
diff --git a/src/tools/tracegen/ctf.cpp b/src/tools/tracegen/ctf.cpp index 5a3902dd71..95ffcf89cc 100644 --- a/src/tools/tracegen/ctf.cpp +++ b/src/tools/tracegen/ctf.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2022 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "ctf.h" #include "provider.h" @@ -15,6 +15,7 @@ static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider) { + writeCommonPrologue(stream); const QString guard = includeGuard(fileName); // include prefix text or qt headers only once @@ -148,7 +149,7 @@ inline QString floatArrayToMetadata(const QString &size, const QString &name) ret += QStringLiteral("double "); else if (sizeof(T) == 4) ret += QStringLiteral("float "); - ret += name + QLatin1Char('[') + size + QStringLiteral("];"); + ret += name + QLatin1Char('[') + size + QLatin1Char(']'); return ret + QLatin1Char(';'); } diff --git a/src/tools/tracegen/ctf.h b/src/tools/tracegen/ctf.h index 54f5e398c2..113e30919f 100644 --- a/src/tools/tracegen/ctf.h +++ b/src/tools/tracegen/ctf.h @@ -1,5 +1,5 @@ // Copyright (C) 2022 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef CTF_H #define CTF_H diff --git a/src/tools/tracegen/etw.cpp b/src/tools/tracegen/etw.cpp index 0bf8d0e2d2..f54a7896ea 100644 --- a/src/tools/tracegen/etw.cpp +++ b/src/tools/tracegen/etw.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "etw.h" #include "provider.h" @@ -104,6 +104,7 @@ static QString createGuid(const QUuid &uuid) static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider) { + writeCommonPrologue(stream); QUuid uuid = QUuid::createUuidV5(QUuid(), provider.name.toLocal8Bit()); const QString providerV = providerVar(provider.name); diff --git a/src/tools/tracegen/etw.h b/src/tools/tracegen/etw.h index ad68fe08de..88508e2034 100644 --- a/src/tools/tracegen/etw.h +++ b/src/tools/tracegen/etw.h @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef ETW_H #define ETW_H diff --git a/src/tools/tracegen/helpers.cpp b/src/tools/tracegen/helpers.cpp index db0fdb142e..0ea5848493 100644 --- a/src/tools/tracegen/helpers.cpp +++ b/src/tools/tracegen/helpers.cpp @@ -1,11 +1,20 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "helpers.h" #include <qdebug.h> using namespace Qt::StringLiterals; +void writeCommonPrologue(QTextStream &stream) +{ + stream << R"CPP( +#ifndef Q_TRACEPOINT +#error "Q_TRACEPOINT not set for the module, Q_TRACE not enabled." +#endif +)CPP"; +} + QString typeToTypeName(const QString &name) { QString ret = name; diff --git a/src/tools/tracegen/helpers.h b/src/tools/tracegen/helpers.h index 00a1f99686..ea6db016a6 100644 --- a/src/tools/tracegen/helpers.h +++ b/src/tools/tracegen/helpers.h @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef HELPERS_H #define HELPERS_H @@ -8,6 +8,7 @@ #include <qlist.h> #include <qstring.h> +#include <qtextstream.h> enum ParamType { LTTNG, @@ -20,6 +21,8 @@ QString includeGuard(const QString &filename); QString formatFunctionSignature(const QList<Tracepoint::Argument> &args); QString formatParameterList(const Provider &provider, const QList<Tracepoint::Argument> &args, const QList<Tracepoint::Field> &fields, ParamType type); +void writeCommonPrologue(QTextStream &stream); + template <typename T> static QString aggregateListValues(int value, const QList<T> &list) { diff --git a/src/tools/tracegen/lttng.cpp b/src/tools/tracegen/lttng.cpp index b812682217..9711570874 100644 --- a/src/tools/tracegen/lttng.cpp +++ b/src/tools/tracegen/lttng.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "lttng.h" #include "provider.h" @@ -20,8 +20,19 @@ static void writeCtfMacro(QTextStream &stream, const Provider &provider, const T const int arrayLen = field.arrayLen; if (arrayLen > 0) { - stream << "ctf_array(" <<paramType << ", " - << name << ", " << name << ", " << arrayLen << ")"; + if (paramType == QStringLiteral("double") || paramType == QStringLiteral("float")) { + const char *newline = nullptr; + for (int i = 0; i < arrayLen; i++) { + stream << newline; + stream << "ctf_float(" <<paramType << ", " << name << "_" << QString::number(i) << ", " + << name << "[" << QString::number(i) << "]" << ")"; + newline = "\n "; + } + + } else { + stream << "ctf_array(" <<paramType << ", " + << name << ", " << name << ", " << arrayLen << ")"; + } return; } @@ -56,24 +67,24 @@ static void writeCtfMacro(QTextStream &stream, const Provider &provider, const T stream << "ctf_string(" << name << ", " << name << ".toString().toUtf8().constData())"; return; case Tracepoint::Field::QtRect: - stream << "ctf_integer(int, x, " << name << ".x()) " - << "ctf_integer(int, y, " << name << ".y()) " - << "ctf_integer(int, width, " << name << ".width()) " - << "ctf_integer(int, height, " << name << ".height()) "; + stream << "ctf_integer(int, QRect_" << name << "_x, " << name << ".x()) " + << "ctf_integer(int, QRect_" << name << "_y, " << name << ".y()) " + << "ctf_integer(int, QRect_" << name << "_width, " << name << ".width()) " + << "ctf_integer(int, QRect_" << name << "_height, " << name << ".height()) "; return; case Tracepoint::Field::QtSizeF: - stream << "ctf_float(int, width, " << name << ".width()) " - << "ctf_float(int, height, " << name << ".height()) "; + stream << "ctf_float(double, QSizeF_" << name << "_width, " << name << ".width()) " + << "ctf_float(double, QSizeF_" << name << "_height, " << name << ".height()) "; return; case Tracepoint::Field::QtRectF: - stream << "ctf_float(int, x, " << name << ".x()) " - << "ctf_float(int, y, " << name << ".y()) " - << "ctf_float(int, width, " << name << ".width()) " - << "ctf_float(int, height, " << name << ".height()) "; + stream << "ctf_float(double, QRectF_" << name << "_x, " << name << ".x()) " + << "ctf_float(double, QRectF_" << name << "_y, " << name << ".y()) " + << "ctf_float(double, QRectF_" << name << "_width, " << name << ".width()) " + << "ctf_float(double, QRectF_" << name << "_height, " << name << ".height()) "; return; case Tracepoint::Field::QtSize: - stream << "ctf_integer(int, width, " << name << ".width()) " - << "ctf_integer(int, height, " << name << ".height()) "; + stream << "ctf_integer(int, QSize_" << name << "_width, " << name << ".width()) " + << "ctf_integer(int, QSize_" << name << "_height, " << name << ".height()) "; return; case Tracepoint::Field::EnumeratedType: stream << "ctf_enum(" << provider.name << ", " << typeToTypeName(paramType) << ", int, " << name << ", " << name << ") "; @@ -90,6 +101,7 @@ static void writeCtfMacro(QTextStream &stream, const Provider &provider, const T static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider) { + writeCommonPrologue(stream); const QString guard = includeGuard(fileName); stream << "#undef TRACEPOINT_PROVIDER\n"; diff --git a/src/tools/tracegen/lttng.h b/src/tools/tracegen/lttng.h index d8fbd1291e..c36c70a1d4 100644 --- a/src/tools/tracegen/lttng.h +++ b/src/tools/tracegen/lttng.h @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef LTTNG_H #define LTTNG_H diff --git a/src/tools/tracegen/panic.cpp b/src/tools/tracegen/panic.cpp index 5258b5ba9d..fa4e6b3ee3 100644 --- a/src/tools/tracegen/panic.cpp +++ b/src/tools/tracegen/panic.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "panic.h" diff --git a/src/tools/tracegen/panic.h b/src/tools/tracegen/panic.h index 51cd96fba6..ee635a8aeb 100644 --- a/src/tools/tracegen/panic.h +++ b/src/tools/tracegen/panic.h @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef PANIC_H #define PANIC_H diff --git a/src/tools/tracegen/provider.cpp b/src/tools/tracegen/provider.cpp index 0a0b033d84..bdd669c9cd 100644 --- a/src/tools/tracegen/provider.cpp +++ b/src/tools/tracegen/provider.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "provider.h" #include "panic.h" diff --git a/src/tools/tracegen/provider.h b/src/tools/tracegen/provider.h index 29d83f2a40..e5e99b868e 100644 --- a/src/tools/tracegen/provider.h +++ b/src/tools/tracegen/provider.h @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef PROVIDER_H #define PROVIDER_H diff --git a/src/tools/tracegen/qtheaders.cpp b/src/tools/tracegen/qtheaders.cpp index a65ece5c5b..237c22b237 100644 --- a/src/tools/tracegen/qtheaders.cpp +++ b/src/tools/tracegen/qtheaders.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qtheaders.h" diff --git a/src/tools/tracegen/qtheaders.h b/src/tools/tracegen/qtheaders.h index 6be4d15f4a..86405c9479 100644 --- a/src/tools/tracegen/qtheaders.h +++ b/src/tools/tracegen/qtheaders.h @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef QTHEADERS_H #define QTHEADERS_H diff --git a/src/tools/tracegen/tracegen.cpp b/src/tools/tracegen/tracegen.cpp index 46b354c520..776d81675d 100644 --- a/src/tools/tracegen/tracegen.cpp +++ b/src/tools/tracegen/tracegen.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "provider.h" #include "ctf.h" |