NanoTrace: Remove user literal workaround

Since C++ 20 consteval we can enforce compile time evaluation. So the
workaround is not anymore needed.

Change-Id: Icfe254431e2d1c364846107474bab911efbf5641
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2024-10-23 07:12:24 +02:00
parent b2052cf807
commit cec3838fc4
26 changed files with 481 additions and 486 deletions

View File

@@ -62,7 +62,6 @@ struct TracerLiteral
: text{text} : text{text}
{} {}
friend consteval TracerLiteral operator""_t(const char *text, size_t size);
constexpr operator std::string_view() const { return text; } constexpr operator std::string_view() const { return text; }
@@ -74,10 +73,6 @@ private:
std::string_view text; std::string_view text;
}; };
consteval TracerLiteral operator""_t(const char *text, size_t size)
{
return {std::string_view{text, size}};
}
} // namespace Literals } // namespace Literals
using namespace Literals; using namespace Literals;
@@ -333,7 +328,7 @@ template<typename String, typename... Arguments>
{ {
static_assert( static_assert(
!std::is_same_v<String, std::string_view>, !std::is_same_v<String, std::string_view>,
R"(The arguments type of the tracing event queue is a string view. You can only provide trace token arguments as TracerLiteral (""_t).)"); R"(The arguments type of the tracing event queue is a string view. You can only provide trace token arguments as TracerLiteral ("").)");
if constexpr (std::is_same_v<String, std::string_view>) if constexpr (std::is_same_v<String, std::string_view>)
eventArguments = {}; eventArguments = {};

View File

@@ -82,7 +82,7 @@ void BaseStatement::waitForUnlockNotify() const
void BaseStatement::reset() const noexcept void BaseStatement::reset() const noexcept
{ {
NanotraceHR::Tracer tracer{"reset"_t, NanotraceHR::Tracer tracer{"reset",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle())}; keyValue("sqlite statement", handle())};
@@ -91,7 +91,7 @@ void BaseStatement::reset() const noexcept
bool BaseStatement::next() const bool BaseStatement::next() const
{ {
NanotraceHR::Tracer tracer{"next"_t, NanotraceHR::Tracer tracer{"next",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle())}; keyValue("sqlite statement", handle())};
int resultCode; int resultCode;
@@ -120,7 +120,7 @@ void BaseStatement::step() const
void BaseStatement::bindNull(int index) void BaseStatement::bindNull(int index)
{ {
NanotraceHR::Tracer tracer{"bind null"_t, NanotraceHR::Tracer tracer{"bind null",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index)}; keyValue("index", index)};
@@ -137,7 +137,7 @@ void BaseStatement::bind(int index, NullValue)
void BaseStatement::bind(int index, int value) void BaseStatement::bind(int index, int value)
{ {
NanotraceHR::Tracer tracer{"bind int"_t, NanotraceHR::Tracer tracer{"bind int",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index), keyValue("index", index),
@@ -150,7 +150,7 @@ void BaseStatement::bind(int index, int value)
void BaseStatement::bind(int index, long long value) void BaseStatement::bind(int index, long long value)
{ {
NanotraceHR::Tracer tracer{"bind long long"_t, NanotraceHR::Tracer tracer{"bind long long",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index), keyValue("index", index),
@@ -163,7 +163,7 @@ void BaseStatement::bind(int index, long long value)
void BaseStatement::bind(int index, double value) void BaseStatement::bind(int index, double value)
{ {
NanotraceHR::Tracer tracer{"bind double"_t, NanotraceHR::Tracer tracer{"bind double",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index), keyValue("index", index),
@@ -176,7 +176,7 @@ void BaseStatement::bind(int index, double value)
void BaseStatement::bind(int index, void *pointer) void BaseStatement::bind(int index, void *pointer)
{ {
NanotraceHR::Tracer tracer{"bind pointer"_t, NanotraceHR::Tracer tracer{"bind pointer",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index), keyValue("index", index),
@@ -189,7 +189,7 @@ void BaseStatement::bind(int index, void *pointer)
void BaseStatement::bind(int index, Utils::span<const int> values) void BaseStatement::bind(int index, Utils::span<const int> values)
{ {
NanotraceHR::Tracer tracer{"bind int span"_t, NanotraceHR::Tracer tracer{"bind int span",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index), keyValue("index", index),
@@ -208,7 +208,7 @@ void BaseStatement::bind(int index, Utils::span<const int> values)
void BaseStatement::bind(int index, Utils::span<const long long> values) void BaseStatement::bind(int index, Utils::span<const long long> values)
{ {
NanotraceHR::Tracer tracer{"bind long long span"_t, NanotraceHR::Tracer tracer{"bind long long span",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index), keyValue("index", index),
@@ -227,7 +227,7 @@ void BaseStatement::bind(int index, Utils::span<const long long> values)
void BaseStatement::bind(int index, Utils::span<const double> values) void BaseStatement::bind(int index, Utils::span<const double> values)
{ {
NanotraceHR::Tracer tracer{"bind double span"_t, NanotraceHR::Tracer tracer{"bind double span",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index), keyValue("index", index),
@@ -246,7 +246,7 @@ void BaseStatement::bind(int index, Utils::span<const double> values)
void BaseStatement::bind(int index, Utils::span<const char *> values) void BaseStatement::bind(int index, Utils::span<const char *> values)
{ {
NanotraceHR::Tracer tracer{"bind const char* span"_t, NanotraceHR::Tracer tracer{"bind const char* span",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index), keyValue("index", index),
@@ -265,7 +265,7 @@ void BaseStatement::bind(int index, Utils::span<const char *> values)
void BaseStatement::bind(int index, Utils::SmallStringView text) void BaseStatement::bind(int index, Utils::SmallStringView text)
{ {
NanotraceHR::Tracer tracer{"bind string"_t, NanotraceHR::Tracer tracer{"bind string",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index), keyValue("index", index),
@@ -282,7 +282,7 @@ void BaseStatement::bind(int index, Utils::SmallStringView text)
void BaseStatement::bind(int index, BlobView blobView) void BaseStatement::bind(int index, BlobView blobView)
{ {
NanotraceHR::Tracer tracer{"bind blob"_t, NanotraceHR::Tracer tracer{"bind blob",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("index", index), keyValue("index", index),
@@ -308,7 +308,7 @@ void BaseStatement::bind(int index, BlobView blobView)
void BaseStatement::bind(int index, const Value &value) void BaseStatement::bind(int index, const Value &value)
{ {
NanotraceHR::Tracer tracer{ NanotraceHR::Tracer tracer{
"bind value"_t, "bind value",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
}; };
@@ -335,7 +335,7 @@ void BaseStatement::bind(int index, const Value &value)
void BaseStatement::bind(int index, ValueView value) void BaseStatement::bind(int index, ValueView value)
{ {
NanotraceHR::Tracer tracer{ NanotraceHR::Tracer tracer{
"bind value"_t, "bind value",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
}; };
@@ -361,7 +361,7 @@ void BaseStatement::bind(int index, ValueView value)
void BaseStatement::prepare(Utils::SmallStringView sqlStatement) void BaseStatement::prepare(Utils::SmallStringView sqlStatement)
{ {
NanotraceHR::Tracer tracer{"prepare"_t, NanotraceHR::Tracer tracer{"prepare",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sql statement", sqlStatement)}; keyValue("sql statement", sqlStatement)};
@@ -380,7 +380,7 @@ void BaseStatement::prepare(Utils::SmallStringView sqlStatement)
m_compiledStatement.reset(sqliteStatement); m_compiledStatement.reset(sqliteStatement);
if (resultCode == SQLITE_LOCKED) { if (resultCode == SQLITE_LOCKED) {
tracer.tick("wait for unlock"_t); tracer.tick("wait for unlock");
waitForUnlockNotify(); waitForUnlockNotify();
} }
@@ -468,7 +468,7 @@ StringType convertToTextForColumn(sqlite3_stmt *sqlStatment, int column)
Type BaseStatement::fetchType(int column) const Type BaseStatement::fetchType(int column) const
{ {
NanotraceHR::Tracer tracer{"fetch type"_t, NanotraceHR::Tracer tracer{"fetch type",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("column", column)}; keyValue("column", column)};
@@ -493,7 +493,7 @@ Type BaseStatement::fetchType(int column) const
int BaseStatement::fetchIntValue(int column) const int BaseStatement::fetchIntValue(int column) const
{ {
NanotraceHR::Tracer tracer{"fetch int"_t, NanotraceHR::Tracer tracer{"fetch int",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("column", column)}; keyValue("column", column)};
@@ -524,7 +524,7 @@ long BaseStatement::fetchValue<long>(int column) const
long long BaseStatement::fetchLongLongValue(int column) const long long BaseStatement::fetchLongLongValue(int column) const
{ {
NanotraceHR::Tracer tracer{"fetch long long"_t, NanotraceHR::Tracer tracer{"fetch long long",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("column", column)}; keyValue("column", column)};
@@ -544,7 +544,7 @@ long long BaseStatement::fetchValue<long long>(int column) const
double BaseStatement::fetchDoubleValue(int column) const double BaseStatement::fetchDoubleValue(int column) const
{ {
NanotraceHR::Tracer tracer{"fetch double"_t, NanotraceHR::Tracer tracer{"fetch double",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("column", column)}; keyValue("column", column)};
@@ -558,7 +558,7 @@ double BaseStatement::fetchDoubleValue(int column) const
BlobView BaseStatement::fetchBlobValue(int column) const BlobView BaseStatement::fetchBlobValue(int column) const
{ {
NanotraceHR::Tracer tracer{"fetch blob"_t, NanotraceHR::Tracer tracer{"fetch blob",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("column", column)}; keyValue("column", column)};
@@ -575,7 +575,7 @@ double BaseStatement::fetchValue<double>(int column) const
template<typename StringType> template<typename StringType>
StringType BaseStatement::fetchValue(int column) const StringType BaseStatement::fetchValue(int column) const
{ {
NanotraceHR::Tracer tracer{"fetch string value"_t, NanotraceHR::Tracer tracer{"fetch string value",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("column", column)}; keyValue("column", column)};
@@ -596,7 +596,7 @@ template SQLITE_EXPORT Utils::PathString BaseStatement::fetchValue<Utils::PathSt
Utils::SmallStringView BaseStatement::fetchSmallStringViewValue(int column) const Utils::SmallStringView BaseStatement::fetchSmallStringViewValue(int column) const
{ {
NanotraceHR::Tracer tracer{"fetch string view"_t, NanotraceHR::Tracer tracer{"fetch string view",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("column", column)}; keyValue("column", column)};
@@ -610,7 +610,7 @@ Utils::SmallStringView BaseStatement::fetchSmallStringViewValue(int column) cons
ValueView BaseStatement::fetchValueView(int column) const ValueView BaseStatement::fetchValueView(int column) const
{ {
NanotraceHR::Tracer tracer{"fetch value view"_t, NanotraceHR::Tracer tracer{"fetch value view",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", handle()), keyValue("sqlite statement", handle()),
keyValue("column", column)}; keyValue("column", column)};
@@ -635,7 +635,7 @@ ValueView BaseStatement::fetchValueView(int column) const
void BaseStatement::Deleter::operator()(sqlite3_stmt *statement) void BaseStatement::Deleter::operator()(sqlite3_stmt *statement)
{ {
NanotraceHR::Tracer tracer{ NanotraceHR::Tracer tracer{
"finalize"_t, "finalize",
sqliteLowLevelCategory(), sqliteLowLevelCategory(),
keyValue("sqlite statement", reinterpret_cast<std::uintptr_t>(statement)), keyValue("sqlite statement", reinterpret_cast<std::uintptr_t>(statement)),
}; };

View File

@@ -154,7 +154,7 @@ public:
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{ NanotraceHR::Tracer tracer{
"execute"_t, "execute",
sqliteHighLevelCategory(), sqliteHighLevelCategory(),
keyValue("sqlite statement", BaseStatement::handle()), keyValue("sqlite statement", BaseStatement::handle()),
}; };
@@ -167,7 +167,7 @@ public:
void bindValues(const ValueType &...values) void bindValues(const ValueType &...values)
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"bind"_t, NanotraceHR::Tracer tracer{"bind",
sqliteHighLevelCategory(), sqliteHighLevelCategory(),
keyValue("sqlite statement", BaseStatement::handle())}; keyValue("sqlite statement", BaseStatement::handle())};
@@ -181,7 +181,7 @@ public:
void write(const ValueType&... values) void write(const ValueType&... values)
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"write"_t, NanotraceHR::Tracer tracer{"write",
sqliteHighLevelCategory(), sqliteHighLevelCategory(),
keyValue("sqlite statement", BaseStatement::handle())}; keyValue("sqlite statement", BaseStatement::handle())};
@@ -218,7 +218,7 @@ public:
auto values(const QueryTypes &...queryValues) auto values(const QueryTypes &...queryValues)
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"values"_t, NanotraceHR::Tracer tracer{"values",
sqliteHighLevelCategory(), sqliteHighLevelCategory(),
keyValue("sqlite statement", BaseStatement::handle())}; keyValue("sqlite statement", BaseStatement::handle())};
@@ -252,7 +252,7 @@ public:
auto value(const QueryTypes &...queryValues) auto value(const QueryTypes &...queryValues)
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"value"_t, NanotraceHR::Tracer tracer{"value",
sqliteHighLevelCategory(), sqliteHighLevelCategory(),
keyValue("sqlite statement", BaseStatement::handle())}; keyValue("sqlite statement", BaseStatement::handle())};
@@ -271,7 +271,7 @@ public:
auto optionalValue(const QueryTypes &...queryValues) auto optionalValue(const QueryTypes &...queryValues)
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"optionalValue"_t, NanotraceHR::Tracer tracer{"optionalValue",
sqliteHighLevelCategory(), sqliteHighLevelCategory(),
keyValue("sqlite statement", BaseStatement::handle())}; keyValue("sqlite statement", BaseStatement::handle())};
@@ -290,7 +290,7 @@ public:
static auto toValue(Utils::SmallStringView sqlStatement, Database &database) static auto toValue(Utils::SmallStringView sqlStatement, Database &database)
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"toValue"_t, sqliteHighLevelCategory()}; NanotraceHR::Tracer tracer{"toValue", sqliteHighLevelCategory()};
StatementImplementation statement(sqlStatement, database); StatementImplementation statement(sqlStatement, database);
@@ -305,7 +305,7 @@ public:
void readCallback(Callable &&callable, const QueryTypes &...queryValues) void readCallback(Callable &&callable, const QueryTypes &...queryValues)
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"readCallback"_t, NanotraceHR::Tracer tracer{"readCallback",
sqliteHighLevelCategory(), sqliteHighLevelCategory(),
keyValue("sqlite statement", BaseStatement::handle())}; keyValue("sqlite statement", BaseStatement::handle())};
@@ -325,7 +325,7 @@ public:
void readTo(Container &container, const QueryTypes &...queryValues) void readTo(Container &container, const QueryTypes &...queryValues)
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"readTo"_t, NanotraceHR::Tracer tracer{"readTo",
sqliteHighLevelCategory(), sqliteHighLevelCategory(),
keyValue("sqlite statement", BaseStatement::handle())}; keyValue("sqlite statement", BaseStatement::handle())};
@@ -427,7 +427,7 @@ public:
using TracerCategory = std::decay_t<decltype(sqliteHighLevelCategory())>; using TracerCategory = std::decay_t<decltype(sqliteHighLevelCategory())>;
StatementImplementation &m_statement; StatementImplementation &m_statement;
NanotraceHR::Tracer<TracerCategory, typename TracerCategory::IsActive> tracer{ NanotraceHR::Tracer<TracerCategory, typename TracerCategory::IsActive> tracer{
"range"_t, "range",
sqliteHighLevelCategory(), sqliteHighLevelCategory(),
NanotraceHR::keyValue("sqlite statement", m_statement.handle())}; NanotraceHR::keyValue("sqlite statement", m_statement.handle())};
}; };

View File

@@ -38,7 +38,7 @@ void ExceptionWithMessage::printWarning() const
StatementIsBusy::StatementIsBusy(Utils::SmallString &&sqliteErrorMessage) StatementIsBusy::StatementIsBusy(Utils::SmallString &&sqliteErrorMessage)
: ExceptionWithMessage{std::move(sqliteErrorMessage)} : ExceptionWithMessage{std::move(sqliteErrorMessage)}
{ {
sqliteHighLevelCategory().threadEvent("StatementIsBusy"_t, sqliteHighLevelCategory().threadEvent("StatementIsBusy",
keyValue("error message", std::string_view{what()})); keyValue("error message", std::string_view{what()}));
} }
@@ -55,7 +55,7 @@ const char *DatabaseIsBusy::what() const noexcept
StatementHasError::StatementHasError(Utils::SmallString &&sqliteErrorMessage) StatementHasError::StatementHasError(Utils::SmallString &&sqliteErrorMessage)
: ExceptionWithMessage{std::move(sqliteErrorMessage)} : ExceptionWithMessage{std::move(sqliteErrorMessage)}
{ {
sqliteHighLevelCategory().threadEvent("StatementHasError"_t, sqliteHighLevelCategory().threadEvent("StatementHasError",
keyValue("error message", std::string_view{what()})); keyValue("error message", std::string_view{what()}));
} }

View File

@@ -23,14 +23,14 @@ thread_local NanotraceHR::EventQueue<NanotraceHR::StringViewWithStringArgumentsT
NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()> &sqliteLowLevelCategory() NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()> &sqliteLowLevelCategory()
{ {
thread_local NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()> thread_local NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()>
sqliteLowLevelCategory_{"sqlite low level"_t, eventQueue, sqliteLowLevelCategory}; sqliteLowLevelCategory_{"sqlite low level", eventQueue, sqliteLowLevelCategory};
return sqliteLowLevelCategory_; return sqliteLowLevelCategory_;
} }
NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()> &sqliteHighLevelCategory() NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()> &sqliteHighLevelCategory()
{ {
thread_local NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()> thread_local NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()>
sqliteHighLevelCategory_{"sqlite high level"_t, eventQueue, sqliteHighLevelCategory}; sqliteHighLevelCategory_{"sqlite high level", eventQueue, sqliteHighLevelCategory};
return sqliteHighLevelCategory_; return sqliteHighLevelCategory_;
} }

View File

@@ -83,7 +83,7 @@ void ImageCacheCollector::start(Utils::SmallStringView name,
using namespace NanotraceHR::Literals; using namespace NanotraceHR::Literals;
auto [collectorTraceToken, flowtoken] = traceToken.beginDurationWithFlow( auto [collectorTraceToken, flowtoken] = traceToken.beginDurationWithFlow(
"generate image in standard collector"_t); "generate image in standard collector");
RewriterView rewriterView{m_externalDependencies, RewriterView::Amend}; RewriterView rewriterView{m_externalDependencies, RewriterView::Amend};
NodeInstanceView nodeInstanceView{m_connectionManager, m_externalDependencies}; NodeInstanceView nodeInstanceView{m_connectionManager, m_externalDependencies};

View File

@@ -20,7 +20,7 @@ using namespace NanotraceHR::Literals;
namespace ImageCache { namespace ImageCache {
namespace { namespace {
thread_local Category category_{"image cache"_t, thread_local Category category_{"image cache",
QmlDesigner::Tracing::eventQueueWithStringArguments(), QmlDesigner::Tracing::eventQueueWithStringArguments(),
category}; category};
} // namespace } // namespace
@@ -63,15 +63,15 @@ void AsynchronousImageCache::request(Utils::SmallStringView name,
using namespace std::literals::string_view_literals; using namespace std::literals::string_view_literals;
auto [durationToken, flowToken] = traceToken.beginDurationWithFlow( auto [durationToken, flowToken] = traceToken.beginDurationWithFlow(
"AsynchronousImageCache works on the image request"_t, "AsynchronousImageCache works on the image request",
keyValue("name", name), keyValue("name", name),
keyValue("extra id", extraId)); keyValue("extra id", extraId));
auto timeStrampToken = durationToken.beginDuration("getting timestamp"_t); auto timeStrampToken = durationToken.beginDuration("getting timestamp");
const auto timeStamp = timeStampProvider.timeStamp(name); const auto timeStamp = timeStampProvider.timeStamp(name);
timeStrampToken.end(keyValue("time stamp", timeStamp.value)); timeStrampToken.end(keyValue("time stamp", timeStamp.value));
auto storageTraceToken = durationToken.beginDuration("fetching image from storage"_t, auto storageTraceToken = durationToken.beginDuration("fetching image from storage",
keyValue("storage id", id)); keyValue("storage id", id));
auto requestImageFromStorage = [&](RequestType requestType) { auto requestImageFromStorage = [&](RequestType requestType) {
switch (requestType) { switch (requestType) {
@@ -92,7 +92,7 @@ void AsynchronousImageCache::request(Utils::SmallStringView name,
if (entry) { if (entry) {
if (entry->isNull()) { if (entry->isNull()) {
storageTraceToken.tick("there was an null image in storage"_t); storageTraceToken.tick("there was an null image in storage");
abortCallback(ImageCache::AbortReason::Failed); abortCallback(ImageCache::AbortReason::Failed);
} else { } else {
captureCallback(*entry); captureCallback(*entry);
@@ -106,7 +106,7 @@ void AsynchronousImageCache::request(Utils::SmallStringView name,
const QImage &midSizeImage, const QImage &midSizeImage,
const QImage &smallImage, const QImage &smallImage,
ImageCache::TraceToken traceToken) { ImageCache::TraceToken traceToken) {
auto token = traceToken.beginDuration("call capture callback"_t); auto token = traceToken.beginDuration("call capture callback");
auto selectImage = [](RequestType requestType, auto selectImage = [](RequestType requestType,
const QImage &image, const QImage &image,
const QImage &midSizeImage, const QImage &midSizeImage,
@@ -130,11 +130,11 @@ void AsynchronousImageCache::request(Utils::SmallStringView name,
auto imageGenerationAbortedCallback = auto imageGenerationAbortedCallback =
[abortCallback = std::move(abortCallback)](ImageCache::AbortReason reason, [abortCallback = std::move(abortCallback)](ImageCache::AbortReason reason,
ImageCache::TraceToken traceToken) { ImageCache::TraceToken traceToken) {
traceToken.tick("image could not be created"_t); traceToken.tick("image could not be created");
abortCallback(reason); abortCallback(reason);
}; };
traceToken.tick("call the generator"_t); traceToken.tick("call the generator");
generator.generateImage(name, generator.generateImage(name,
extraId, extraId,
@@ -153,7 +153,7 @@ void AsynchronousImageCache::requestImage(Utils::SmallStringView name,
ImageCache::AuxiliaryData auxiliaryData) ImageCache::AuxiliaryData auxiliaryData)
{ {
auto [trace, flowToken] = ImageCache::category().beginDurationWithFlow( auto [trace, flowToken] = ImageCache::category().beginDurationWithFlow(
"request image in asynchronous image cache"_t); "request image in asynchronous image cache");
m_taskQueue.addTask(trace.createToken(), m_taskQueue.addTask(trace.createToken(),
std::move(name), std::move(name),
std::move(extraId), std::move(extraId),
@@ -171,7 +171,7 @@ void AsynchronousImageCache::requestMidSizeImage(Utils::SmallStringView name,
ImageCache::AuxiliaryData auxiliaryData) ImageCache::AuxiliaryData auxiliaryData)
{ {
auto [traceToken, flowToken] = ImageCache::category().beginDurationWithFlow( auto [traceToken, flowToken] = ImageCache::category().beginDurationWithFlow(
"request mid size image in asynchronous image cache"_t); "request mid size image in asynchronous image cache");
m_taskQueue.addTask(traceToken.createToken(), m_taskQueue.addTask(traceToken.createToken(),
std::move(name), std::move(name),
std::move(extraId), std::move(extraId),
@@ -189,7 +189,7 @@ void AsynchronousImageCache::requestSmallImage(Utils::SmallStringView name,
ImageCache::AuxiliaryData auxiliaryData) ImageCache::AuxiliaryData auxiliaryData)
{ {
auto [traceToken, flowtoken] = ImageCache::category().beginDurationWithFlow( auto [traceToken, flowtoken] = ImageCache::category().beginDurationWithFlow(
"request small size image in asynchronous image cache"_t); "request small size image in asynchronous image cache");
m_taskQueue.addTask(traceToken.createToken(), m_taskQueue.addTask(traceToken.createToken(),
std::move(name), std::move(name),
std::move(extraId), std::move(extraId),
@@ -226,7 +226,7 @@ void AsynchronousImageCache::Clean::operator()(Entry &entry)
{ {
using namespace NanotraceHR::Literals; using namespace NanotraceHR::Literals;
entry.traceToken.tick("cleaning up in the cache"_t); entry.traceToken.tick("cleaning up in the cache");
entry.abortCallback(ImageCache::AbortReason::Abort); entry.abortCallback(ImageCache::AbortReason::Abort);
} }

View File

@@ -27,7 +27,7 @@ void AsynchronousImageFactory::generate(Utils::SmallStringView name,
ImageCache::AuxiliaryData auxiliaryData) ImageCache::AuxiliaryData auxiliaryData)
{ {
auto [trace, flowToken] = ImageCache::category().beginDurationWithFlow( auto [trace, flowToken] = ImageCache::category().beginDurationWithFlow(
"request image in asynchronous image factory"_t); "request image in asynchronous image factory");
m_taskQueue.addTask(trace.createToken(), m_taskQueue.addTask(trace.createToken(),
name, name,
extraId, extraId,
@@ -45,7 +45,7 @@ void AsynchronousImageFactory::request(Utils::SmallStringView name,
ImageCacheCollectorInterface &collector, ImageCacheCollectorInterface &collector,
ImageCache::TraceToken traceToken) ImageCache::TraceToken traceToken)
{ {
auto [storageTracer, flowToken] = traceToken.beginDurationWithFlow("starte image generator"_t); auto [storageTracer, flowToken] = traceToken.beginDurationWithFlow("starte image generator");
const auto id = extraId.empty() ? Utils::PathString{name} const auto id = extraId.empty() ? Utils::PathString{name}
: Utils::PathString::join({name, "+", extraId}); : Utils::PathString::join({name, "+", extraId});

View File

@@ -124,10 +124,10 @@ private:
return; return;
auto [threadCreateToken, flowToken] = traceToken.beginDurationWithFlow( auto [threadCreateToken, flowToken] = traceToken.beginDurationWithFlow(
"thread is created in the task queue"_t); "thread is created in the task queue");
m_backgroundThread = std::thread{[this](auto traceToken) { m_backgroundThread = std::thread{[this](auto traceToken) {
auto duration = traceToken.beginDuration( auto duration = traceToken.beginDuration(
"thread is ready"_t); "thread is ready");
while (true) { while (true) {
auto [lock, abort] = waitForTasks(); auto [lock, abort] = waitForTasks();
@@ -137,7 +137,7 @@ private:
return; return;
auto getTaskToken = duration.beginDuration( auto getTaskToken = duration.beginDuration(
"get task from queue"_t); "get task from queue");
if (auto task = getTask(std::move(lock)); task) { if (auto task = getTask(std::move(lock)); task) {
getTaskToken.end(); getTaskToken.end();
m_dispatchCallback(*task); m_dispatchCallback(*task);

View File

@@ -24,7 +24,7 @@ QString InternalBindingProperty::expression() const
void InternalBindingProperty::setExpression(const QString &expression) void InternalBindingProperty::setExpression(const QString &expression)
{ {
traceToken.tick("expression"_t, keyValue("expression", expression)); traceToken.tick("expression", keyValue("expression", expression));
m_expression = expression; m_expression = expression;
} }

View File

@@ -63,7 +63,7 @@ public:
, minorVersion(minorVersion) , minorVersion(minorVersion)
, isValid(true) , isValid(true)
, internalId(internalId) , internalId(internalId)
, traceToken(flowTraceToken.beginAsynchronous("InternalNode"_t, , traceToken(flowTraceToken.beginAsynchronous("InternalNode",
keyValue("type", typeName), keyValue("type", typeName),
keyValue("internal id", internalId))) keyValue("internal id", internalId)))
{} {}

View File

@@ -41,8 +41,8 @@ void InternalNodeListProperty::add(const InternalNode::Pointer &internalNode)
{ {
Q_ASSERT(!m_nodes.contains(internalNode)); Q_ASSERT(!m_nodes.contains(internalNode));
auto flowToken = traceToken.tickWithFlow("add node"_t); auto flowToken = traceToken.tickWithFlow("add node");
internalNode->traceToken.tick(flowToken, "node added"_t); internalNode->traceToken.tick(flowToken, "node added");
m_nodes.append(internalNode); m_nodes.append(internalNode);
} }
@@ -51,8 +51,8 @@ void InternalNodeListProperty::remove(const InternalNodePointer &internalNode)
{ {
Q_ASSERT(m_nodes.contains(internalNode)); Q_ASSERT(m_nodes.contains(internalNode));
auto flowToken = traceToken.tickWithFlow("remove node"_t); auto flowToken = traceToken.tickWithFlow("remove node");
internalNode->traceToken.tick(flowToken, "node removed"_t); internalNode->traceToken.tick(flowToken, "node removed");
m_nodes.removeAll(internalNode); m_nodes.removeAll(internalNode);
} }
@@ -64,7 +64,7 @@ const InternalNodeListProperty::FewNodes &InternalNodeListProperty::nodeList() c
void InternalNodeListProperty::slide(int from, int to) void InternalNodeListProperty::slide(int from, int to)
{ {
traceToken.tick("slide"_t, keyValue("from", from), keyValue("to", to)); traceToken.tick("slide", keyValue("from", from), keyValue("to", to));
InternalNode::Pointer internalNode = m_nodes.at(from); InternalNode::Pointer internalNode = m_nodes.at(from);
m_nodes.remove(from); m_nodes.remove(from);

View File

@@ -43,8 +43,8 @@ void InternalNodeProperty::remove([[maybe_unused]] const InternalNode::Pointer &
{ {
Q_ASSERT(m_node == node); Q_ASSERT(m_node == node);
auto flowToken = traceToken.tickWithFlow("remove node"_t); auto flowToken = traceToken.tickWithFlow("remove node");
node->traceToken.tick(flowToken, "node removed"_t); node->traceToken.tick(flowToken, "node removed");
m_node.reset(); m_node.reset();
} }
@@ -54,8 +54,8 @@ void InternalNodeProperty::add(const InternalNode::Pointer &node)
Q_ASSERT(node); Q_ASSERT(node);
Q_ASSERT(node->parentProperty()); Q_ASSERT(node->parentProperty());
auto flowToken = traceToken.tickWithFlow("add node"_t); auto flowToken = traceToken.tickWithFlow("add node");
node->traceToken.tick(flowToken, "node added"_t); node->traceToken.tick(flowToken, "node added");
m_node = node; m_node = node;
} }

View File

@@ -69,14 +69,14 @@ TypeName InternalProperty::dynamicTypeName() const
void InternalProperty::setDynamicTypeName(const TypeName &name) void InternalProperty::setDynamicTypeName(const TypeName &name)
{ {
traceToken.tick("dynamic type name"_t, keyValue("name", name)); traceToken.tick("dynamic type name", keyValue("name", name));
m_dynamicType = name; m_dynamicType = name;
} }
void InternalProperty::resetDynamicTypeName() void InternalProperty::resetDynamicTypeName()
{ {
traceToken.tick("reset dynamic type name"_t); traceToken.tick("reset dynamic type name");
m_dynamicType.clear(); m_dynamicType.clear();
} }

View File

@@ -23,7 +23,7 @@ QString InternalSignalHandlerProperty::source() const
} }
void InternalSignalHandlerProperty::setSource(const QString &source) void InternalSignalHandlerProperty::setSource(const QString &source)
{ {
traceToken.tick("source"_t, keyValue("source", source)); traceToken.tick("source", keyValue("source", source));
m_source = source; m_source = source;
} }
@@ -40,7 +40,7 @@ QString InternalSignalDeclarationProperty::signature() const
void InternalSignalDeclarationProperty::setSignature(const QString &signature) void InternalSignalDeclarationProperty::setSignature(const QString &signature)
{ {
traceToken.tick("signature"_t, keyValue("signature", signature)); traceToken.tick("signature", keyValue("signature", signature));
m_signature = signature; m_signature = signature;
} }

View File

@@ -18,7 +18,7 @@ QVariant InternalVariantProperty::value() const
void InternalVariantProperty::setValue(const QVariant &value) void InternalVariantProperty::setValue(const QVariant &value)
{ {
traceToken.tick("value"_t, keyValue("value", value)); traceToken.tick("value", keyValue("value", value));
m_value = value; m_value = value;
} }

View File

@@ -152,7 +152,7 @@ ModelPrivate::~ModelPrivate()
void ModelPrivate::detachAllViews() void ModelPrivate::detachAllViews()
{ {
auto tracer = traceToken.begin("detach all views"_t); auto tracer = traceToken.begin("detach all views");
for (const QPointer<AbstractView> &view : std::as_const(m_viewList)) for (const QPointer<AbstractView> &view : std::as_const(m_viewList))
detachView(view.data(), true); detachView(view.data(), true);
@@ -197,7 +197,7 @@ Storage::Imports createStorageImports(const Imports &imports,
void ModelPrivate::changeImports(Imports toBeAddedImports, Imports toBeRemovedImports) void ModelPrivate::changeImports(Imports toBeAddedImports, Imports toBeRemovedImports)
{ {
auto tracer = traceToken.begin("change imports"_t); auto tracer = traceToken.begin("change imports");
std::sort(toBeAddedImports.begin(), toBeAddedImports.end()); std::sort(toBeAddedImports.begin(), toBeAddedImports.end());
std::sort(toBeRemovedImports.begin(), toBeRemovedImports.end()); std::sort(toBeRemovedImports.begin(), toBeRemovedImports.end());
@@ -274,7 +274,7 @@ void ModelPrivate::setDocumentMessages(const QList<DocumentMessage> &errors,
void ModelPrivate::setFileUrl(const QUrl &fileUrl) void ModelPrivate::setFileUrl(const QUrl &fileUrl)
{ {
auto tracer = traceToken.begin("file url"_t); auto tracer = traceToken.begin("file url");
QUrl oldPath = m_fileUrl; QUrl oldPath = m_fileUrl;
@@ -327,7 +327,7 @@ InternalNodePointer ModelPrivate::createNode(TypeNameView typeName,
majorVersion, majorVersion,
minorVersion, minorVersion,
internalId, internalId,
traceToken.tickWithFlow("create node"_t)); traceToken.tickWithFlow("create node"));
setTypeId(newNode.get(), typeName); setTypeId(newNode.get(), typeName);
@@ -538,7 +538,7 @@ void ModelPrivate::changeNodeId(const InternalNodePointer &node, const QString &
const QString oldId = node->id; const QString oldId = node->id;
node->id = id; node->id = id;
node->traceToken.tick("id"_t, std::forward_as_tuple("id", id)); node->traceToken.tick("id", std::forward_as_tuple("id", id));
if (!oldId.isEmpty()) if (!oldId.isEmpty())
m_idNodeHash.remove(oldId); m_idNodeHash.remove(oldId);
if (!id.isEmpty()) if (!id.isEmpty())
@@ -1175,7 +1175,7 @@ void ModelPrivate::setSelectedNodes(const FewNodes &selectedNodeList)
if (sortedSelectedList == m_selectedInternalNodes) if (sortedSelectedList == m_selectedInternalNodes)
return; return;
auto flowToken = traceToken.tickWithFlow("selected model nodes"_t); auto flowToken = traceToken.tickWithFlow("selected model nodes");
if constexpr (decltype(traceToken)::categoryIsActive()) { // the compiler should optimize it away but to be sure if constexpr (decltype(traceToken)::categoryIsActive()) { // the compiler should optimize it away but to be sure
std::set_difference(sortedSelectedList.begin(), std::set_difference(sortedSelectedList.begin(),
@@ -1183,7 +1183,7 @@ void ModelPrivate::setSelectedNodes(const FewNodes &selectedNodeList)
m_selectedInternalNodes.begin(), m_selectedInternalNodes.begin(),
m_selectedInternalNodes.end(), m_selectedInternalNodes.end(),
Utils::make_iterator([&](const auto &node) { Utils::make_iterator([&](const auto &node) {
node->traceToken.tick(flowToken, "select model node"_t); node->traceToken.tick(flowToken, "select model node");
})); }));
} }
@@ -1196,7 +1196,7 @@ void ModelPrivate::setSelectedNodes(const FewNodes &selectedNodeList)
m_selectedInternalNodes.begin(), m_selectedInternalNodes.begin(),
m_selectedInternalNodes.end(), m_selectedInternalNodes.end(),
Utils::make_iterator([&](const auto &node) { Utils::make_iterator([&](const auto &node) {
node->traceToken.tick(flowToken, "deselect model node"_t); node->traceToken.tick(flowToken, "deselect model node");
})); }));
} }
@@ -1205,7 +1205,7 @@ void ModelPrivate::setSelectedNodes(const FewNodes &selectedNodeList)
void ModelPrivate::clearSelectedNodes() void ModelPrivate::clearSelectedNodes()
{ {
auto tracer = traceToken.begin("clear selected model nodes"_t); auto tracer = traceToken.begin("clear selected model nodes");
auto lastSelectedNodeList = m_selectedInternalNodes; auto lastSelectedNodeList = m_selectedInternalNodes;
m_selectedInternalNodes.clear(); m_selectedInternalNodes.clear();
@@ -1573,7 +1573,7 @@ void ModelPrivate::changeRootNodeType(const TypeName &type, int majorVersion, in
{ {
Q_ASSERT(rootNode()); Q_ASSERT(rootNode());
m_rootInternalNode->traceToken.tick("type name"_t, keyValue("type name", type)); m_rootInternalNode->traceToken.tick("type name", keyValue("type name", type));
m_rootInternalNode->typeName = type; m_rootInternalNode->typeName = type;
m_rootInternalNode->majorVersion = majorVersion; m_rootInternalNode->majorVersion = majorVersion;
@@ -1584,7 +1584,7 @@ void ModelPrivate::changeRootNodeType(const TypeName &type, int majorVersion, in
void ModelPrivate::setScriptFunctions(const InternalNodePointer &node, const QStringList &scriptFunctionList) void ModelPrivate::setScriptFunctions(const InternalNodePointer &node, const QStringList &scriptFunctionList)
{ {
m_rootInternalNode->traceToken.tick("script function"_t); m_rootInternalNode->traceToken.tick("script function");
node->scriptFunctions = scriptFunctionList; node->scriptFunctions = scriptFunctionList;
@@ -1593,7 +1593,7 @@ void ModelPrivate::setScriptFunctions(const InternalNodePointer &node, const QSt
void ModelPrivate::setNodeSource(const InternalNodePointer &node, const QString &nodeSource) void ModelPrivate::setNodeSource(const InternalNodePointer &node, const QString &nodeSource)
{ {
m_rootInternalNode->traceToken.tick("node source"_t); m_rootInternalNode->traceToken.tick("node source");
node->nodeSource = nodeSource; node->nodeSource = nodeSource;
notifyNodeSourceChanged(node, nodeSource); notifyNodeSourceChanged(node, nodeSource);
@@ -1858,7 +1858,7 @@ void Model::changeImports(Imports importsToBeAdded, Imports importsToBeRemoved)
#ifndef QDS_USE_PROJECTSTORAGE #ifndef QDS_USE_PROJECTSTORAGE
void Model::setPossibleImports(Imports possibleImports) void Model::setPossibleImports(Imports possibleImports)
{ {
auto tracer = d->traceToken.begin("possible imports"_t); auto tracer = d->traceToken.begin("possible imports");
std::sort(possibleImports.begin(), possibleImports.end()); std::sort(possibleImports.begin(), possibleImports.end());
@@ -1872,7 +1872,7 @@ void Model::setPossibleImports(Imports possibleImports)
#ifndef QDS_USE_PROJECTSTORAGE #ifndef QDS_USE_PROJECTSTORAGE
void Model::setUsedImports(Imports usedImports) void Model::setUsedImports(Imports usedImports)
{ {
auto tracer = d->traceToken.begin("used imports"_t); auto tracer = d->traceToken.begin("used imports");
std::sort(usedImports.begin(), usedImports.end()); std::sort(usedImports.begin(), usedImports.end());
@@ -2847,7 +2847,7 @@ The view is informed that it has been registered within the model by a call to A
*/ */
void Model::attachView(AbstractView *view) void Model::attachView(AbstractView *view)
{ {
auto traceToken = d->traceToken.begin("attachView"_t, auto traceToken = d->traceToken.begin("attachView",
keyValue("name", keyValue("name",
std::string_view{view->metaObject()->className()})); std::string_view{view->metaObject()->className()}));
@@ -2877,7 +2877,7 @@ void Model::attachView(AbstractView *view)
*/ */
void Model::detachView(AbstractView *view, ViewNotification emitDetachNotify) void Model::detachView(AbstractView *view, ViewNotification emitDetachNotify)
{ {
auto traceToken = d->traceToken.begin("detachView"_t, auto traceToken = d->traceToken.begin("detachView",
keyValue("name", keyValue("name",
std::string_view{view->metaObject()->className()})); std::string_view{view->metaObject()->className()}));

View File

@@ -345,7 +345,7 @@ private:
public: public:
NotNullPointer<ProjectStorageType> projectStorage = nullptr; NotNullPointer<ProjectStorageType> projectStorage = nullptr;
NotNullPointer<PathCacheType> pathCache = nullptr; NotNullPointer<PathCacheType> pathCache = nullptr;
ModelTracing::AsynchronousToken traceToken = ModelTracing::category().beginAsynchronous("Model"_t); ModelTracing::AsynchronousToken traceToken = ModelTracing::category().beginAsynchronous("Model");
private: private:
Model *m_model = nullptr; Model *m_model = nullptr;

View File

@@ -132,7 +132,7 @@ public:
TypeId commonTypeId() const TypeId commonTypeId() const
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"get type id from common type cache"_t, NanotraceHR::Tracer tracer{"get type id from common type cache",
projectStorageCategory(), projectStorageCategory(),
keyValue("module name", std::string_view{moduleName}), keyValue("module name", std::string_view{moduleName}),
keyValue("type name", std::string_view{typeName})}; keyValue("type name", std::string_view{typeName})};
@@ -148,7 +148,7 @@ public:
TypeId builtinTypeId() const TypeId builtinTypeId() const
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"get builtin type id from common type cache"_t, NanotraceHR::Tracer tracer{"get builtin type id from common type cache",
projectStorageCategory()}; projectStorageCategory()};
auto typeId = commonTypeCache_.builtinTypeId<BuiltinType>(); auto typeId = commonTypeCache_.builtinTypeId<BuiltinType>();
@@ -162,7 +162,7 @@ public:
TypeId builtinTypeId() const TypeId builtinTypeId() const
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"get builtin type id from common type cache"_t, NanotraceHR::Tracer tracer{"get builtin type id from common type cache",
projectStorageCategory()}; projectStorageCategory()};
auto typeId = commonTypeCache_.builtinTypeId<builtinType>(); auto typeId = commonTypeCache_.builtinTypeId<builtinType>();
@@ -837,7 +837,7 @@ private:
template<typename Relinkable> template<typename Relinkable>
void removeRelinkableEntries(std::vector<Relinkable> &relinkables, auto &ids, auto projection) void removeRelinkableEntries(std::vector<Relinkable> &relinkables, auto &ids, auto projection)
{ {
NanotraceHR::Tracer tracer{"remove relinkable entries"_t, projectStorageCategory()}; NanotraceHR::Tracer tracer{"remove relinkable entries", projectStorageCategory()};
std::vector<Relinkable> newRelinkables; std::vector<Relinkable> newRelinkables;
newRelinkables.reserve(relinkables.size()); newRelinkables.reserve(relinkables.size());

View File

@@ -19,7 +19,7 @@ auto &category()
TypeHasInvalidSourceId::TypeHasInvalidSourceId() TypeHasInvalidSourceId::TypeHasInvalidSourceId()
{ {
category().threadEvent("TypeHasInvalidSourceId"_t); category().threadEvent("TypeHasInvalidSourceId");
} }
const char *TypeHasInvalidSourceId::what() const noexcept const char *TypeHasInvalidSourceId::what() const noexcept
@@ -29,7 +29,7 @@ const char *TypeHasInvalidSourceId::what() const noexcept
ModuleDoesNotExists::ModuleDoesNotExists() ModuleDoesNotExists::ModuleDoesNotExists()
{ {
category().threadEvent("ModuleDoesNotExists"_t); category().threadEvent("ModuleDoesNotExists");
} }
const char *ModuleDoesNotExists::what() const noexcept const char *ModuleDoesNotExists::what() const noexcept
@@ -39,7 +39,7 @@ const char *ModuleDoesNotExists::what() const noexcept
ModuleAlreadyExists::ModuleAlreadyExists() ModuleAlreadyExists::ModuleAlreadyExists()
{ {
category().threadEvent("ModuleAlreadyExists"_t); category().threadEvent("ModuleAlreadyExists");
} }
const char *ModuleAlreadyExists::what() const noexcept const char *ModuleAlreadyExists::what() const noexcept
@@ -53,14 +53,14 @@ TypeNameDoesNotExists::TypeNameDoesNotExists(std::string_view typeName, SourceId
Utils::SmallString::join( Utils::SmallString::join(
{"type: ", typeName, ", source id: ", Utils::SmallString::number(sourceId.internalId())})} {"type: ", typeName, ", source id: ", Utils::SmallString::number(sourceId.internalId())})}
{ {
category().threadEvent("TypeNameDoesNotExists"_t, category().threadEvent("TypeNameDoesNotExists",
keyValue("type name", typeName), keyValue("type name", typeName),
keyValue("source id", sourceId)); keyValue("source id", sourceId));
} }
PrototypeChainCycle::PrototypeChainCycle() PrototypeChainCycle::PrototypeChainCycle()
{ {
category().threadEvent("PrototypeChainCycle"_t); category().threadEvent("PrototypeChainCycle");
} }
const char *PrototypeChainCycle::what() const noexcept const char *PrototypeChainCycle::what() const noexcept
@@ -70,7 +70,7 @@ const char *PrototypeChainCycle::what() const noexcept
AliasChainCycle::AliasChainCycle() AliasChainCycle::AliasChainCycle()
{ {
category().threadEvent("AliasChainCycle"_t); category().threadEvent("AliasChainCycle");
} }
const char *AliasChainCycle::what() const noexcept const char *AliasChainCycle::what() const noexcept
@@ -80,7 +80,7 @@ const char *AliasChainCycle::what() const noexcept
CannotParseQmlTypesFile::CannotParseQmlTypesFile() CannotParseQmlTypesFile::CannotParseQmlTypesFile()
{ {
category().threadEvent("CannotParseQmlTypesFile"_t); category().threadEvent("CannotParseQmlTypesFile");
} }
const char *CannotParseQmlTypesFile::what() const noexcept const char *CannotParseQmlTypesFile::what() const noexcept
@@ -90,7 +90,7 @@ const char *CannotParseQmlTypesFile::what() const noexcept
CannotParseQmlDocumentFile::CannotParseQmlDocumentFile() CannotParseQmlDocumentFile::CannotParseQmlDocumentFile()
{ {
category().threadEvent("CannotParseQmlDocumentFile"_t); category().threadEvent("CannotParseQmlDocumentFile");
} }
const char *CannotParseQmlDocumentFile::what() const noexcept const char *CannotParseQmlDocumentFile::what() const noexcept
@@ -100,7 +100,7 @@ const char *CannotParseQmlDocumentFile::what() const noexcept
DirectoryInfoHasInvalidProjectSourceId::DirectoryInfoHasInvalidProjectSourceId() DirectoryInfoHasInvalidProjectSourceId::DirectoryInfoHasInvalidProjectSourceId()
{ {
category().threadEvent("DirectoryInfoHasInvalidProjectSourceId"_t); category().threadEvent("DirectoryInfoHasInvalidProjectSourceId");
} }
const char *DirectoryInfoHasInvalidProjectSourceId::what() const noexcept const char *DirectoryInfoHasInvalidProjectSourceId::what() const noexcept
@@ -110,7 +110,7 @@ const char *DirectoryInfoHasInvalidProjectSourceId::what() const noexcept
DirectoryInfoHasInvalidSourceId::DirectoryInfoHasInvalidSourceId() DirectoryInfoHasInvalidSourceId::DirectoryInfoHasInvalidSourceId()
{ {
category().threadEvent("DirectoryInfoHasInvalidSourceId"_t); category().threadEvent("DirectoryInfoHasInvalidSourceId");
} }
const char *DirectoryInfoHasInvalidSourceId::what() const noexcept const char *DirectoryInfoHasInvalidSourceId::what() const noexcept
@@ -120,7 +120,7 @@ const char *DirectoryInfoHasInvalidSourceId::what() const noexcept
DirectoryInfoHasInvalidModuleId::DirectoryInfoHasInvalidModuleId() DirectoryInfoHasInvalidModuleId::DirectoryInfoHasInvalidModuleId()
{ {
category().threadEvent("DirectoryInfoHasInvalidModuleId"_t); category().threadEvent("DirectoryInfoHasInvalidModuleId");
} }
const char *DirectoryInfoHasInvalidModuleId::what() const noexcept const char *DirectoryInfoHasInvalidModuleId::what() const noexcept
@@ -130,7 +130,7 @@ const char *DirectoryInfoHasInvalidModuleId::what() const noexcept
FileStatusHasInvalidSourceId::FileStatusHasInvalidSourceId() FileStatusHasInvalidSourceId::FileStatusHasInvalidSourceId()
{ {
category().threadEvent("FileStatusHasInvalidSourceId"_t); category().threadEvent("FileStatusHasInvalidSourceId");
} }
const char *FileStatusHasInvalidSourceId::what() const noexcept const char *FileStatusHasInvalidSourceId::what() const noexcept
@@ -160,12 +160,12 @@ const char *ProjectStorageErrorWithMessage::what() const noexcept
ExportedTypeCannotBeInserted::ExportedTypeCannotBeInserted(std::string_view errorMessage) ExportedTypeCannotBeInserted::ExportedTypeCannotBeInserted(std::string_view errorMessage)
: ProjectStorageErrorWithMessage{"ExportedTypeCannotBeInserted"sv, errorMessage} : ProjectStorageErrorWithMessage{"ExportedTypeCannotBeInserted"sv, errorMessage}
{ {
category().threadEvent("ExportedTypeCannotBeInserted"_t, keyValue("error message", errorMessage)); category().threadEvent("ExportedTypeCannotBeInserted", keyValue("error message", errorMessage));
} }
TypeAnnotationHasInvalidSourceId::TypeAnnotationHasInvalidSourceId() TypeAnnotationHasInvalidSourceId::TypeAnnotationHasInvalidSourceId()
{ {
category().threadEvent("TypeAnnotationHasInvalidSourceId"_t); category().threadEvent("TypeAnnotationHasInvalidSourceId");
} }
const char *TypeAnnotationHasInvalidSourceId::what() const noexcept const char *TypeAnnotationHasInvalidSourceId::what() const noexcept

View File

@@ -183,7 +183,7 @@ void addModuleExportedImport(Storage::Synchronization::ModuleExportedImports &im
Storage::ModuleKind moduleKind, Storage::ModuleKind moduleKind,
std::string_view exportedModuleName) std::string_view exportedModuleName)
{ {
NanotraceHR::Tracer tracer{"add module exported imports"_t, NanotraceHR::Tracer tracer{"add module exported imports",
category(), category(),
keyValue("module id", moduleId), keyValue("module id", moduleId),
keyValue("exported module id", exportedModuleId), keyValue("exported module id", exportedModuleId),
@@ -208,7 +208,7 @@ void addModuleExportedImports(Storage::Synchronization::ModuleExportedImports &i
const QList<QmlDirParser::Import> &qmldirImports, const QList<QmlDirParser::Import> &qmldirImports,
ProjectStorageInterface &projectStorage) ProjectStorageInterface &projectStorage)
{ {
NanotraceHR::Tracer tracer{"add module exported imports"_t, NanotraceHR::Tracer tracer{"add module exported imports",
category(), category(),
keyValue("cpp module id", cppModuleId), keyValue("cpp module id", cppModuleId),
keyValue("module id", moduleId)}; keyValue("module id", moduleId)};
@@ -268,7 +268,7 @@ void ProjectStorageUpdater::update(Update update)
const QString &propertyEditorResourcesPath = update.propertyEditorResourcesPath; const QString &propertyEditorResourcesPath = update.propertyEditorResourcesPath;
const QStringList &typeAnnotationPaths = update.typeAnnotationPaths; const QStringList &typeAnnotationPaths = update.typeAnnotationPaths;
NanotraceHR::Tracer tracer{"update"_t, NanotraceHR::Tracer tracer{"update",
category(), category(),
keyValue("directories", directories), keyValue("directories", directories),
keyValue("qml types paths", qmlTypesPaths)}; keyValue("qml types paths", qmlTypesPaths)};
@@ -307,14 +307,14 @@ void ProjectStorageUpdater::updateQmlTypes(const QStringList &qmlTypesPaths,
if (qmlTypesPaths.empty()) if (qmlTypesPaths.empty())
return; return;
NanotraceHR::Tracer tracer{"update qmltypes file"_t, category()}; NanotraceHR::Tracer tracer{"update qmltypes file", category()};
ModuleId moduleId = m_projectStorage.moduleId("QML", Storage::ModuleKind::CppLibrary); ModuleId moduleId = m_projectStorage.moduleId("QML", Storage::ModuleKind::CppLibrary);
for (const QString &qmlTypesPath : qmlTypesPaths) { for (const QString &qmlTypesPath : qmlTypesPaths) {
SourceId sourceId = m_pathCache.sourceId(SourcePath{qmlTypesPath}); SourceId sourceId = m_pathCache.sourceId(SourcePath{qmlTypesPath});
watchedSourceIdsIds.qmltypesSourceIds.push_back(sourceId); watchedSourceIdsIds.qmltypesSourceIds.push_back(sourceId);
tracer.tick("append watched qml types source id"_t, tracer.tick("append watched qml types source id",
keyValue("source id", sourceId), keyValue("source id", sourceId),
keyValue("qml types path", qmlTypesPath)); keyValue("qml types path", qmlTypesPath));
@@ -327,9 +327,9 @@ void ProjectStorageUpdater::updateQmlTypes(const QStringList &qmlTypesPaths,
notUpdatedSourceIds); notUpdatedSourceIds);
if (state == FileState::Changed) { if (state == FileState::Changed) {
tracer.tick("append project data"_t, keyValue("project data", directoryInfo)); tracer.tick("append project data", keyValue("project data", directoryInfo));
package.directoryInfos.push_back(std::move(directoryInfo)); package.directoryInfos.push_back(std::move(directoryInfo));
tracer.tick("append updated project source ids"_t, keyValue("source id", sourceId)); tracer.tick("append updated project source ids", keyValue("source id", sourceId));
package.updatedDirectoryInfoSourceIds.push_back(sourceId); package.updatedDirectoryInfoSourceIds.push_back(sourceId);
} }
} }
@@ -366,7 +366,7 @@ void ProjectStorageUpdater::updateDirectoryChanged(std::string_view directoryPat
parser.parse(m_fileSystem.contentAsQString(QString{qmldirSourcePath})); parser.parse(m_fileSystem.contentAsQString(QString{qmldirSourcePath}));
if (qmldirState != FileState::NotChanged) { if (qmldirState != FileState::NotChanged) {
tracer.tick("append updated source id"_t, keyValue("module id", qmldirSourceId)); tracer.tick("append updated source id", keyValue("module id", qmldirSourceId));
package.updatedSourceIds.push_back(qmldirSourceId); package.updatedSourceIds.push_back(qmldirSourceId);
} }
@@ -384,14 +384,14 @@ void ProjectStorageUpdater::updateDirectoryChanged(std::string_view directoryPat
moduleName, moduleName,
imports, imports,
m_projectStorage); m_projectStorage);
tracer.tick("append updated module id"_t, keyValue("module id", moduleId)); tracer.tick("append updated module id", keyValue("module id", moduleId));
package.updatedModuleIds.push_back(moduleId); package.updatedModuleIds.push_back(moduleId);
const auto qmlDirectoryInfos = m_projectStorage.fetchDirectoryInfos(directorySourceId); const auto qmlDirectoryInfos = m_projectStorage.fetchDirectoryInfos(directorySourceId);
addSourceIds(package.updatedSourceIds, qmlDirectoryInfos, "append updated source id"_t, tracer); addSourceIds(package.updatedSourceIds, qmlDirectoryInfos, "append updated source id", tracer);
addSourceIds(package.updatedFileStatusSourceIds, addSourceIds(package.updatedFileStatusSourceIds,
qmlDirectoryInfos, qmlDirectoryInfos,
"append updated file status source id"_t, "append updated file status source id",
tracer); tracer);
auto qmlTypes = filterMultipleEntries(parser.typeInfos()); auto qmlTypes = filterMultipleEntries(parser.typeInfos());
@@ -415,7 +415,7 @@ void ProjectStorageUpdater::updateDirectoryChanged(std::string_view directoryPat
notUpdatedSourceIds, notUpdatedSourceIds,
watchedSourceIdsIds, watchedSourceIdsIds,
qmldirState); qmldirState);
tracer.tick("append updated project source id"_t, keyValue("module id", moduleId)); tracer.tick("append updated project source id", keyValue("module id", moduleId));
package.updatedDirectoryInfoSourceIds.push_back(directorySourceId); package.updatedDirectoryInfoSourceIds.push_back(directorySourceId);
} }
@@ -424,7 +424,7 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
NotUpdatedSourceIds &notUpdatedSourceIds, NotUpdatedSourceIds &notUpdatedSourceIds,
WatchedSourceIdsIds &watchedSourceIdsIds) WatchedSourceIdsIds &watchedSourceIdsIds)
{ {
NanotraceHR::Tracer tracer{"update directories"_t, category()}; NanotraceHR::Tracer tracer{"update directories", category()};
for (const QString &directory : directories) for (const QString &directory : directories)
updateDirectory({directory}, {}, package, notUpdatedSourceIds, watchedSourceIdsIds); updateDirectory({directory}, {}, package, notUpdatedSourceIds, watchedSourceIdsIds);
@@ -532,7 +532,7 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
NotUpdatedSourceIds &notUpdatedSourceIds, NotUpdatedSourceIds &notUpdatedSourceIds,
WatchedSourceIdsIds &watchedSourceIdsIds) WatchedSourceIdsIds &watchedSourceIdsIds)
{ {
NanotraceHR::Tracer tracer{"update directory"_t, category(), keyValue("directory", directoryPath)}; NanotraceHR::Tracer tracer{"update directory", category(), keyValue("directory", directoryPath)};
SourcePath qmldirSourcePath{directoryPath + "/qmldir"}; SourcePath qmldirSourcePath{directoryPath + "/qmldir"};
auto [directoryId, qmldirSourceId] = m_pathCache.sourceContextAndSourceId(qmldirSourcePath); auto [directoryId, qmldirSourceId] = m_pathCache.sourceContextAndSourceId(qmldirSourcePath);
@@ -549,7 +549,7 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
switch (combineState(directoryState, qmldirState)) { switch (combineState(directoryState, qmldirState)) {
case FileState::Changed: { case FileState::Changed: {
tracer.tick("update directory changed"_t); tracer.tick("update directory changed");
updateDirectoryChanged(directoryPath, updateDirectoryChanged(directoryPath,
qmldirState, qmldirState,
qmldirSourcePath, qmldirSourcePath,
@@ -563,7 +563,7 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
break; break;
} }
case FileState::NotChanged: { case FileState::NotChanged: {
tracer.tick("update directory not changed"_t); tracer.tick("update directory not changed");
parseDirectoryInfos(m_projectStorage.fetchDirectoryInfos(directorySourceId), parseDirectoryInfos(m_projectStorage.fetchDirectoryInfos(directorySourceId),
package, package,
@@ -572,7 +572,7 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
break; break;
} }
case FileState::NotExists: { case FileState::NotExists: {
tracer.tick("update directory don't exits"_t); tracer.tick("update directory don't exits");
package.updatedFileStatusSourceIds.push_back(directorySourceId); package.updatedFileStatusSourceIds.push_back(directorySourceId);
package.updatedFileStatusSourceIds.push_back(qmldirSourceId); package.updatedFileStatusSourceIds.push_back(qmldirSourceId);
@@ -580,9 +580,9 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
package.updatedSourceIds.push_back(qmldirSourceId); package.updatedSourceIds.push_back(qmldirSourceId);
auto qmlDirectoryInfos = m_projectStorage.fetchDirectoryInfos(directorySourceId); auto qmlDirectoryInfos = m_projectStorage.fetchDirectoryInfos(directorySourceId);
for (const Storage::Synchronization::DirectoryInfo &directoryInfo : qmlDirectoryInfos) { for (const Storage::Synchronization::DirectoryInfo &directoryInfo : qmlDirectoryInfos) {
tracer.tick("append updated source id"_t, keyValue("source id", directoryInfo.sourceId)); tracer.tick("append updated source id", keyValue("source id", directoryInfo.sourceId));
package.updatedSourceIds.push_back(directoryInfo.sourceId); package.updatedSourceIds.push_back(directoryInfo.sourceId);
tracer.tick("append updated file status source id"_t, tracer.tick("append updated file status source id",
keyValue("source id", directoryInfo.sourceId)); keyValue("source id", directoryInfo.sourceId));
package.updatedFileStatusSourceIds.push_back(directoryInfo.sourceId); package.updatedFileStatusSourceIds.push_back(directoryInfo.sourceId);
} }
@@ -613,7 +613,7 @@ void ProjectStorageUpdater::updatePropertyEditorPaths(
Storage::Synchronization::SynchronizationPackage &package, Storage::Synchronization::SynchronizationPackage &package,
NotUpdatedSourceIds &notUpdatedSourceIds) NotUpdatedSourceIds &notUpdatedSourceIds)
{ {
NanotraceHR::Tracer tracer{"update property editor paths"_t, NanotraceHR::Tracer tracer{"update property editor paths",
category(), category(),
keyValue("property editor resources path", propertyEditorResourcesPath)}; keyValue("property editor resources path", propertyEditorResourcesPath)};
@@ -661,7 +661,7 @@ void ProjectStorageUpdater::updateTypeAnnotations(const QStringList &directoryPa
Storage::Synchronization::SynchronizationPackage &package, Storage::Synchronization::SynchronizationPackage &package,
NotUpdatedSourceIds &notUpdatedSourceIds) NotUpdatedSourceIds &notUpdatedSourceIds)
{ {
NanotraceHR::Tracer tracer("update type annotations"_t, category()); NanotraceHR::Tracer tracer("update type annotations", category());
std::map<SourceId, SmallSourceIds<16>> updatedSourceIdsDictonary; std::map<SourceId, SmallSourceIds<16>> updatedSourceIdsDictonary;
@@ -680,7 +680,7 @@ void ProjectStorageUpdater::updateTypeAnnotations(
NotUpdatedSourceIds &notUpdatedSourceIds, NotUpdatedSourceIds &notUpdatedSourceIds,
std::map<SourceId, SmallSourceIds<16>> &updatedSourceIdsDictonary) std::map<SourceId, SmallSourceIds<16>> &updatedSourceIdsDictonary)
{ {
NanotraceHR::Tracer tracer("update type annotation directory"_t, NanotraceHR::Tracer tracer("update type annotation directory",
category(), category(),
keyValue("path", rootDirectoryPath)); keyValue("path", rootDirectoryPath));
@@ -753,7 +753,7 @@ void ProjectStorageUpdater::updateTypeAnnotation(const QString &directoryPath,
SourceId directorySourceId, SourceId directorySourceId,
Storage::Synchronization::SynchronizationPackage &package) Storage::Synchronization::SynchronizationPackage &package)
{ {
NanotraceHR::Tracer tracer{"update type annotation path"_t, NanotraceHR::Tracer tracer{"update type annotation path",
category(), category(),
keyValue("path", filePath), keyValue("path", filePath),
keyValue("directory path", directoryPath)}; keyValue("directory path", directoryPath)};
@@ -776,12 +776,12 @@ void ProjectStorageUpdater::updatePropertyEditorPath(
SourceId directorySourceId, SourceId directorySourceId,
long long pathOffset) long long pathOffset)
{ {
NanotraceHR::Tracer tracer{"update property editor path"_t, NanotraceHR::Tracer tracer{"update property editor path",
category(), category(),
keyValue("directory path", directoryPath), keyValue("directory path", directoryPath),
keyValue("directory source id", directorySourceId)}; keyValue("directory source id", directorySourceId)};
tracer.tick("append updated property editor qml path source id"_t, tracer.tick("append updated property editor qml path source id",
keyValue("source id", directorySourceId)); keyValue("source id", directorySourceId));
package.updatedPropertyEditorQmlPathSourceIds.push_back(directorySourceId); package.updatedPropertyEditorQmlPathSourceIds.push_back(directorySourceId);
auto dir = QDir{directoryPath}; auto dir = QDir{directoryPath};
@@ -796,7 +796,7 @@ void ProjectStorageUpdater::updatePropertyEditorFilePath(
SourceId directorySourceId, SourceId directorySourceId,
long long pathOffset) long long pathOffset)
{ {
NanotraceHR::Tracer tracer{"update property editor file path"_t, NanotraceHR::Tracer tracer{"update property editor file path",
category(), category(),
keyValue("directory path", path), keyValue("directory path", path),
keyValue("directory source id", directorySourceId)}; keyValue("directory source id", directorySourceId)};
@@ -819,7 +819,7 @@ void ProjectStorageUpdater::updatePropertyEditorFilePath(
typeName, typeName,
pathId, pathId,
directorySourceId); directorySourceId);
tracer.tick("append property editor qml paths"_t, tracer.tick("append property editor qml paths",
keyValue("property editor qml paths", paths)); keyValue("property editor qml paths", paths));
} }
} }
@@ -854,7 +854,7 @@ bool contains(const Container &container, Id id)
void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &changedIdPaths) void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &changedIdPaths)
{ {
NanotraceHR::Tracer tracer{"paths with ids changed"_t, NanotraceHR::Tracer tracer{"paths with ids changed",
category(), category(),
keyValue("id paths", changedIdPaths)}; keyValue("id paths", changedIdPaths)};
@@ -954,35 +954,35 @@ void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
NotUpdatedSourceIds &notUpdatedSourceIds, NotUpdatedSourceIds &notUpdatedSourceIds,
WatchedSourceIdsIds &watchedSourceIds) WatchedSourceIdsIds &watchedSourceIds)
{ {
NanotraceHR::Tracer tracer{"parse type infos"_t, NanotraceHR::Tracer tracer{"parse type infos",
category(), category(),
keyValue("directory source id", directorySourceId), keyValue("directory source id", directorySourceId),
keyValue("directory path", directoryPath), keyValue("directory path", directoryPath),
keyValue("module id", moduleId)}; keyValue("module id", moduleId)};
for (const QString &typeInfo : typeInfos) { for (const QString &typeInfo : typeInfos) {
NanotraceHR::Tracer tracer{"parse type info"_t, category(), keyValue("type info", typeInfo)}; NanotraceHR::Tracer tracer{"parse type info", category(), keyValue("type info", typeInfo)};
Utils::PathString qmltypesPath = Utils::PathString::join( Utils::PathString qmltypesPath = Utils::PathString::join(
{directoryPath, "/", Utils::SmallString{typeInfo}}); {directoryPath, "/", Utils::SmallString{typeInfo}});
SourceId sourceId = m_pathCache.sourceId(SourcePathView{qmltypesPath}); SourceId sourceId = m_pathCache.sourceId(SourcePathView{qmltypesPath});
tracer.tick("append qmltypes source id"_t, keyValue("source id", sourceId)); tracer.tick("append qmltypes source id", keyValue("source id", sourceId));
watchedSourceIds.qmltypesSourceIds.push_back(sourceId); watchedSourceIds.qmltypesSourceIds.push_back(sourceId);
addDependencies(package.moduleDependencies, addDependencies(package.moduleDependencies,
sourceId, sourceId,
joinImports(qmldirDependencies, qmldirImports), joinImports(qmldirDependencies, qmldirImports),
m_projectStorage, m_projectStorage,
"append module dependency"_t, "append module dependency",
tracer); tracer);
tracer.tick("append module dependenct source source id"_t, keyValue("source id", sourceId)); tracer.tick("append module dependenct source source id", keyValue("source id", sourceId));
package.updatedModuleDependencySourceIds.push_back(sourceId); package.updatedModuleDependencySourceIds.push_back(sourceId);
const auto &directoryInfo = package.directoryInfos.emplace_back( const auto &directoryInfo = package.directoryInfos.emplace_back(
directorySourceId, sourceId, moduleId, Storage::Synchronization::FileType::QmlTypes); directorySourceId, sourceId, moduleId, Storage::Synchronization::FileType::QmlTypes);
tracer.tick("append project data"_t, keyValue("source id", sourceId)); tracer.tick("append project data", keyValue("source id", sourceId));
parseTypeInfo(directoryInfo, qmltypesPath, package, notUpdatedSourceIds); parseTypeInfo(directoryInfo, qmltypesPath, package, notUpdatedSourceIds);
} }
@@ -994,7 +994,7 @@ void ProjectStorageUpdater::parseDirectoryInfos(
NotUpdatedSourceIds &notUpdatedSourceIds, NotUpdatedSourceIds &notUpdatedSourceIds,
WatchedSourceIdsIds &watchedSourceIds) WatchedSourceIdsIds &watchedSourceIds)
{ {
NanotraceHR::Tracer tracer{"parse project datas"_t, category()}; NanotraceHR::Tracer tracer{"parse project datas", category()};
for (const Storage::Synchronization::DirectoryInfo &directoryInfo : directoryInfos) { for (const Storage::Synchronization::DirectoryInfo &directoryInfo : directoryInfos) {
switch (directoryInfo.fileType) { switch (directoryInfo.fileType) {
@@ -1022,14 +1022,14 @@ auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::Direct
Storage::Synchronization::SynchronizationPackage &package, Storage::Synchronization::SynchronizationPackage &package,
NotUpdatedSourceIds &notUpdatedSourceIds) -> FileState NotUpdatedSourceIds &notUpdatedSourceIds) -> FileState
{ {
NanotraceHR::Tracer tracer{"parse type info"_t, NanotraceHR::Tracer tracer{"parse type info",
category(), category(),
keyValue("qmltypes path", qmltypesPath)}; keyValue("qmltypes path", qmltypesPath)};
auto state = fileState(directoryInfo.sourceId, package, notUpdatedSourceIds); auto state = fileState(directoryInfo.sourceId, package, notUpdatedSourceIds);
switch (state) { switch (state) {
case FileState::Changed: { case FileState::Changed: {
tracer.tick("append updated source ids"_t, keyValue("source id", directoryInfo.sourceId)); tracer.tick("append updated source ids", keyValue("source id", directoryInfo.sourceId));
package.updatedSourceIds.push_back(directoryInfo.sourceId); package.updatedSourceIds.push_back(directoryInfo.sourceId);
const auto content = m_fileSystem.contentAsQString(QString{qmltypesPath}); const auto content = m_fileSystem.contentAsQString(QString{qmltypesPath});
@@ -1037,7 +1037,7 @@ auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::Direct
break; break;
} }
case FileState::NotChanged: { case FileState::NotChanged: {
tracer.tick("append not updated source ids"_t, keyValue("source id", directoryInfo.sourceId)); tracer.tick("append not updated source ids", keyValue("source id", directoryInfo.sourceId));
notUpdatedSourceIds.sourceIds.push_back(directoryInfo.sourceId); notUpdatedSourceIds.sourceIds.push_back(directoryInfo.sourceId);
break; break;
} }
@@ -1059,7 +1059,7 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
WatchedSourceIdsIds &watchedSourceIds, WatchedSourceIdsIds &watchedSourceIds,
FileState qmldirState) FileState qmldirState)
{ {
NanotraceHR::Tracer tracer{"parse qml component"_t, NanotraceHR::Tracer tracer{"parse qml component",
category(), category(),
keyValue("relative file path", relativeFilePath), keyValue("relative file path", relativeFilePath),
keyValue("directory path", directoryPath), keyValue("directory path", directoryPath),
@@ -1076,18 +1076,18 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
Storage::Synchronization::Type type; Storage::Synchronization::Type type;
auto state = fileState(sourceId, package, notUpdatedSourceIds); auto state = fileState(sourceId, package, notUpdatedSourceIds);
tracer.tick("append watched qml source id"_t, keyValue("source id", sourceId)); tracer.tick("append watched qml source id", keyValue("source id", sourceId));
watchedSourceIds.qmlSourceIds.push_back(sourceId); watchedSourceIds.qmlSourceIds.push_back(sourceId);
switch (state) { switch (state) {
case FileState::NotChanged: case FileState::NotChanged:
if (qmldirState == FileState::NotExists) { if (qmldirState == FileState::NotExists) {
tracer.tick("append not updated source id"_t, keyValue("source id", sourceId)); tracer.tick("append not updated source id", keyValue("source id", sourceId));
notUpdatedSourceIds.sourceIds.emplace_back(sourceId); notUpdatedSourceIds.sourceIds.emplace_back(sourceId);
const auto &directoryInfo = package.directoryInfos.emplace_back( const auto &directoryInfo = package.directoryInfos.emplace_back(
directorySourceId, sourceId, ModuleId{}, Storage::Synchronization::FileType::QmlDocument); directorySourceId, sourceId, ModuleId{}, Storage::Synchronization::FileType::QmlDocument);
tracer.tick("append project data"_t, keyValue("project data", directoryInfo)); tracer.tick("append project data", keyValue("project data", directoryInfo));
return; return;
} }
@@ -1103,9 +1103,9 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
const auto &directoryInfo = package.directoryInfos.emplace_back( const auto &directoryInfo = package.directoryInfos.emplace_back(
directorySourceId, sourceId, ModuleId{}, Storage::Synchronization::FileType::QmlDocument); directorySourceId, sourceId, ModuleId{}, Storage::Synchronization::FileType::QmlDocument);
tracer.tick("append project data"_t, keyValue("project data", directoryInfo)); tracer.tick("append project data", keyValue("project data", directoryInfo));
tracer.tick("append updated source id"_t, keyValue("source id", sourceId)); tracer.tick("append updated source id", keyValue("source id", sourceId));
package.updatedSourceIds.push_back(sourceId); package.updatedSourceIds.push_back(sourceId);
type.typeName = SourcePath{qmlFilePath}.name(); type.typeName = SourcePath{qmlFilePath}.name();
@@ -1121,13 +1121,13 @@ void ProjectStorageUpdater::parseQmlComponent(SourceId sourceId,
Storage::Synchronization::SynchronizationPackage &package, Storage::Synchronization::SynchronizationPackage &package,
NotUpdatedSourceIds &notUpdatedSourceIds) NotUpdatedSourceIds &notUpdatedSourceIds)
{ {
NanotraceHR::Tracer tracer{"parse qml component"_t, category(), keyValue("source id", sourceId)}; NanotraceHR::Tracer tracer{"parse qml component", category(), keyValue("source id", sourceId)};
auto state = fileState(sourceId, package, notUpdatedSourceIds); auto state = fileState(sourceId, package, notUpdatedSourceIds);
if (state == FileState::NotChanged) if (state == FileState::NotChanged)
return; return;
tracer.tick("append updated source id"_t, keyValue("source id", sourceId)); tracer.tick("append updated source id", keyValue("source id", sourceId));
package.updatedSourceIds.push_back(sourceId); package.updatedSourceIds.push_back(sourceId);
if (state == FileState::NotExists) if (state == FileState::NotExists)
@@ -1191,7 +1191,7 @@ void ProjectStorageUpdater::parseQmlComponents(Components components,
WatchedSourceIdsIds &watchedSourceIdsIds, WatchedSourceIdsIds &watchedSourceIdsIds,
FileState qmldirState) FileState qmldirState)
{ {
NanotraceHR::Tracer tracer{"parse qml components"_t, NanotraceHR::Tracer tracer{"parse qml components",
category(), category(),
keyValue("directory source id", directorySourceId), keyValue("directory source id", directorySourceId),
keyValue("directory id", directoryId), keyValue("directory id", directoryId),
@@ -1224,14 +1224,14 @@ ProjectStorageUpdater::FileState ProjectStorageUpdater::fileState(
Storage::Synchronization::SynchronizationPackage &package, Storage::Synchronization::SynchronizationPackage &package,
NotUpdatedSourceIds &notUpdatedSourceIds) const NotUpdatedSourceIds &notUpdatedSourceIds) const
{ {
NanotraceHR::Tracer tracer{"update property editor paths"_t, NanotraceHR::Tracer tracer{"update property editor paths",
category(), category(),
keyValue("source id", sourceId)}; keyValue("source id", sourceId)};
auto currentFileStatus = m_fileStatusCache.find(sourceId); auto currentFileStatus = m_fileStatusCache.find(sourceId);
if (!currentFileStatus.isValid()) { if (!currentFileStatus.isValid()) {
tracer.tick("append updated file status source id"_t, keyValue("source id", sourceId)); tracer.tick("append updated file status source id", keyValue("source id", sourceId));
package.updatedFileStatusSourceIds.push_back(sourceId); package.updatedFileStatusSourceIds.push_back(sourceId);
tracer.end(keyValue("state", FileState::NotExists)); tracer.end(keyValue("state", FileState::NotExists));
@@ -1241,17 +1241,17 @@ ProjectStorageUpdater::FileState ProjectStorageUpdater::fileState(
auto projectStorageFileStatus = m_projectStorage.fetchFileStatus(sourceId); auto projectStorageFileStatus = m_projectStorage.fetchFileStatus(sourceId);
if (!projectStorageFileStatus.isValid() || projectStorageFileStatus != currentFileStatus) { if (!projectStorageFileStatus.isValid() || projectStorageFileStatus != currentFileStatus) {
tracer.tick("append file status"_t, keyValue("file status", sourceId)); tracer.tick("append file status", keyValue("file status", sourceId));
package.fileStatuses.push_back(currentFileStatus); package.fileStatuses.push_back(currentFileStatus);
tracer.tick("append updated file status source id"_t, keyValue("source id", sourceId)); tracer.tick("append updated file status source id", keyValue("source id", sourceId));
package.updatedFileStatusSourceIds.push_back(sourceId); package.updatedFileStatusSourceIds.push_back(sourceId);
tracer.end(keyValue("state", FileState::Changed)); tracer.end(keyValue("state", FileState::Changed));
return FileState::Changed; return FileState::Changed;
} }
tracer.tick("append not updated file status source id"_t, keyValue("source id", sourceId)); tracer.tick("append not updated file status source id", keyValue("source id", sourceId));
notUpdatedSourceIds.fileStatusSourceIds.push_back(sourceId); notUpdatedSourceIds.fileStatusSourceIds.push_back(sourceId);
tracer.end(keyValue("state", FileState::NotChanged)); tracer.end(keyValue("state", FileState::NotChanged));

View File

@@ -101,7 +101,7 @@ QualifiedImports createQualifiedImports(const QList<QmlDom::Import> &qmlImports,
Utils::SmallStringView directoryPath, Utils::SmallStringView directoryPath,
ProjectStorageType &storage) ProjectStorageType &storage)
{ {
NanotraceHR::Tracer tracer{"create qualified imports"_t, NanotraceHR::Tracer tracer{"create qualified imports",
category(), category(),
keyValue("sourceId", sourceId), keyValue("sourceId", sourceId),
keyValue("directoryPath", directoryPath)}; keyValue("directoryPath", directoryPath)};
@@ -324,7 +324,7 @@ Storage::Synchronization::Type QmlDocumentParser::parse(const QString &sourceCon
SourceId sourceId, SourceId sourceId,
Utils::SmallStringView directoryPath) Utils::SmallStringView directoryPath)
{ {
NanotraceHR::Tracer tracer{"qml document parser parse"_t, NanotraceHR::Tracer tracer{"qml document parser parse",
category(), category(),
keyValue("sourceId", sourceId), keyValue("sourceId", sourceId),
keyValue("directoryPath", directoryPath)}; keyValue("directoryPath", directoryPath)};

View File

@@ -39,7 +39,7 @@ using Storage::TypeNameString;
ComponentWithoutNamespaces createComponentNameWithoutNamespaces(const QList<QQmlJSExportedScope> &objects) ComponentWithoutNamespaces createComponentNameWithoutNamespaces(const QList<QQmlJSExportedScope> &objects)
{ {
NanotraceHR::Tracer tracer{"parse qmltypes file"_t, category()}; NanotraceHR::Tracer tracer{"parse qmltypes file", category()};
ComponentWithoutNamespaces componentWithoutNamespaces; ComponentWithoutNamespaces componentWithoutNamespaces;
@@ -81,7 +81,7 @@ void addImports(Storage::Imports &imports,
ModuleId cppModuleId) ModuleId cppModuleId)
{ {
NanotraceHR::Tracer tracer{ NanotraceHR::Tracer tracer{
"add imports"_t, "add imports",
category(), category(),
keyValue("source id", sourceId), keyValue("source id", sourceId),
keyValue("module id", cppModuleId), keyValue("module id", cppModuleId),
@@ -89,16 +89,16 @@ void addImports(Storage::Imports &imports,
for (const QString &dependency : dependencies) { for (const QString &dependency : dependencies) {
const auto &import = appendImports(imports, dependency, sourceId, storage); const auto &import = appendImports(imports, dependency, sourceId, storage);
tracer.tick("append import"_t, keyValue("import", import), keyValue("dependency", dependency)); tracer.tick("append import", keyValue("import", import), keyValue("dependency", dependency));
} }
const auto &import = imports.emplace_back(cppModuleId, Storage::Version{}, sourceId); const auto &import = imports.emplace_back(cppModuleId, Storage::Version{}, sourceId);
tracer.tick("append import"_t, keyValue("import", import)); tracer.tick("append import", keyValue("import", import));
if (ModuleId qmlCppModuleId = storage.moduleId("QML", ModuleKind::CppLibrary); if (ModuleId qmlCppModuleId = storage.moduleId("QML", ModuleKind::CppLibrary);
cppModuleId != qmlCppModuleId) { cppModuleId != qmlCppModuleId) {
const auto &import = imports.emplace_back(qmlCppModuleId, Storage::Version{}, sourceId); const auto &import = imports.emplace_back(qmlCppModuleId, Storage::Version{}, sourceId);
tracer.tick("append import"_t, keyValue("import", import)); tracer.tick("append import", keyValue("import", import));
} }
} }
@@ -438,7 +438,7 @@ void addType(Storage::Synchronization::Types &types,
QmlTypesParser::ProjectStorage &storage, QmlTypesParser::ProjectStorage &storage,
const ComponentWithoutNamespaces &componentNameWithoutNamespace) const ComponentWithoutNamespaces &componentNameWithoutNamespace)
{ {
NanotraceHR::Tracer tracer{"add type"_t, NanotraceHR::Tracer tracer{"add type",
category(), category(),
keyValue("source id", sourceId), keyValue("source id", sourceId),
keyValue("module id", cppModuleId)}; keyValue("module id", cppModuleId)};
@@ -503,7 +503,7 @@ void addTypes(Storage::Synchronization::Types &types,
QmlTypesParser::ProjectStorage &storage, QmlTypesParser::ProjectStorage &storage,
const ComponentWithoutNamespaces &componentNameWithoutNamespaces) const ComponentWithoutNamespaces &componentNameWithoutNamespaces)
{ {
NanotraceHR::Tracer tracer{"add types"_t, category()}; NanotraceHR::Tracer tracer{"add types", category()};
types.reserve(Utils::usize(objects) + types.size()); types.reserve(Utils::usize(objects) + types.size());
const auto skipList = getSkipList(storage.module(directoryInfo.moduleId)); const auto skipList = getSkipList(storage.module(directoryInfo.moduleId));
@@ -528,7 +528,7 @@ void QmlTypesParser::parse(const QString &sourceContent,
Storage::Synchronization::Types &types, Storage::Synchronization::Types &types,
const Storage::Synchronization::DirectoryInfo &directoryInfo) const Storage::Synchronization::DirectoryInfo &directoryInfo)
{ {
NanotraceHR::Tracer tracer{"qmltypes parser parse"_t, category()}; NanotraceHR::Tracer tracer{"qmltypes parser parse", category()};
QQmlJSTypeDescriptionReader reader({}, sourceContent); QQmlJSTypeDescriptionReader reader({}, sourceContent);
QList<QQmlJSExportedScope> components; QList<QQmlJSExportedScope> components;

View File

@@ -55,7 +55,7 @@ StringEventQueue &stringEventQueue()
namespace ModelTracing { namespace ModelTracing {
namespace { namespace {
thread_local Category category_{"model"_t, Tracing::stringEventQueue(), category}; thread_local Category category_{"model", Tracing::stringEventQueue(), category};
} // namespace } // namespace
@@ -70,7 +70,7 @@ namespace ProjectStorageTracing {
Category &projectStorageCategory() Category &projectStorageCategory()
{ {
thread_local Category category{"project storage"_t, thread_local Category category{"project storage",
Tracing::eventQueueWithStringArguments(), Tracing::eventQueueWithStringArguments(),
projectStorageCategory}; projectStorageCategory};
@@ -79,7 +79,7 @@ Category &projectStorageCategory()
Category &projectStorageUpdaterCategory() Category &projectStorageUpdaterCategory()
{ {
thread_local Category category{"project storage updater"_t, thread_local Category category{"project storage updater",
Tracing::eventQueueWithStringArguments(), Tracing::eventQueueWithStringArguments(),
projectStorageCategory}; projectStorageCategory};
@@ -91,7 +91,7 @@ Category &projectStorageUpdaterCategory()
namespace SourcePathStorageTracing { namespace SourcePathStorageTracing {
Category &category() Category &category()
{ {
thread_local Category category_{"project storage updater"_t, thread_local Category category_{"project storage updater",
Tracing::eventQueueWithStringArguments(), Tracing::eventQueueWithStringArguments(),
category}; category};
@@ -102,7 +102,7 @@ Category &category()
namespace MetaInfoTracing { namespace MetaInfoTracing {
Category &category() Category &category()
{ {
thread_local Category category_{"meta info"_t, Tracing::eventQueueWithStringArguments(), category}; thread_local Category category_{"meta info", Tracing::eventQueueWithStringArguments(), category};
return category_; return category_;
} }