QmlDesigner: Introduce extra tracing file for project storage

That is reducing dependecies and compilation time.

Change-Id: Ib495c7d7a61e9ff18d976d0a94db215691097ad9
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2025-06-19 10:36:03 +02:00
parent e938d3ddc1
commit cc2a83f532
12 changed files with 349 additions and 393 deletions

View File

@@ -402,6 +402,7 @@ extend_qtc_library(QmlDesignerCore
projectstoragepathwatcher.h projectstoragepathwatcher.h
projectstoragepathwatchertypes.h projectstoragepathwatchertypes.h
projectstorageprinting.h projectstorageprinting.h
projectstoragetracing.cpp projectstoragetracing.h
projectstoragetypes.h projectstoragetypes.h
projectstorageupdater.cpp projectstorageupdater.h projectstorageupdater.cpp projectstorageupdater.h
projectstorage.cpp projectstorage.h projectstorage.cpp projectstorage.h

View File

@@ -10,7 +10,7 @@
#include "projectstoragetypes.h" #include "projectstoragetypes.h"
#include "sourcepathstorage/storagecache.h" #include "sourcepathstorage/storagecache.h"
#include <tracing/qmldesignertracing.h> #include "projectstoragetracing.h"
#include <sqlitealgorithms.h> #include <sqlitealgorithms.h>
#include <sqlitedatabase.h> #include <sqlitedatabase.h>
@@ -31,8 +31,6 @@ namespace QmlDesigner {
using namespace NanotraceHR::Literals; using namespace NanotraceHR::Literals;
using ProjectStorageTracing::projectStorageCategory;
class QMLDESIGNERCORE_EXPORT ProjectStorage final : public ProjectStorageInterface class QMLDESIGNERCORE_EXPORT ProjectStorage final : public ProjectStorageInterface
{ {
using Database = Sqlite::Database; using Database = Sqlite::Database;
@@ -136,7 +134,7 @@ public:
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"get type id from common type cache", NanotraceHR::Tracer tracer{"get type id from common type cache",
projectStorageCategory(), ProjectStorageTracing::category(),
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})};
@@ -152,7 +150,7 @@ public:
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"get builtin type id from common type cache", NanotraceHR::Tracer tracer{"get builtin type id from common type cache",
projectStorageCategory()}; ProjectStorageTracing::category()};
auto typeId = commonTypeCache_.builtinTypeId<BuiltinType>(); auto typeId = commonTypeCache_.builtinTypeId<BuiltinType>();
@@ -166,7 +164,7 @@ public:
{ {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
NanotraceHR::Tracer tracer{"get builtin type id from common type cache", NanotraceHR::Tracer tracer{"get builtin type id from common type cache",
projectStorageCategory()}; ProjectStorageTracing::category()};
auto typeId = commonTypeCache_.builtinTypeId<builtinType>(); auto typeId = commonTypeCache_.builtinTypeId<builtinType>();
@@ -322,30 +320,11 @@ private:
class ModuleStorageAdapter class ModuleStorageAdapter
{ {
public: public:
auto fetchId(ModuleView module) auto fetchId(ModuleView module);
{
NanotraceHR::Tracer tracer{"module stoeage adapter fetch id",
projectStorageCategory(),
NanotraceHR::keyValue("module name", module.name),
NanotraceHR::keyValue("module kind", module.kind)};
return storage.fetchModuleId(module.name, module.kind);
}
auto fetchValue(ModuleId id) auto fetchValue(ModuleId id);
{
NanotraceHR::Tracer tracer{"module stoeage adapter fetch value",
projectStorageCategory(),
NanotraceHR::keyValue("module id", id)};
return storage.fetchModule(id); auto fetchAll();
}
auto fetchAll()
{
NanotraceHR::Tracer tracer{"module stoeage adapter fetch all", projectStorageCategory()};
return storage.fetchAllModules();
}
ProjectStorage &storage; ProjectStorage &storage;
}; };
@@ -895,26 +874,8 @@ private:
AliasPropertyDeclarations &aliasPropertyDeclarationsToLink, AliasPropertyDeclarations &aliasPropertyDeclarationsToLink,
PropertyDeclarationIds &propertyDeclarationIds); PropertyDeclarationIds &propertyDeclarationIds);
template<typename Relinkable> template<typename Relinkable, typename Ids, typename Projection>
void removeRelinkableEntries(std::vector<Relinkable> &relinkables, auto &ids, auto projection) void removeRelinkableEntries(std::vector<Relinkable> &relinkables, Ids ids, Projection projection);
{
NanotraceHR::Tracer tracer{"remove relinkable entries", projectStorageCategory()};
std::vector<Relinkable> newRelinkables;
newRelinkables.reserve(relinkables.size());
std::ranges::sort(ids);
std::ranges::sort(relinkables, {}, projection);
Utils::set_greedy_difference(
relinkables,
ids,
[&](Relinkable &entry) { newRelinkables.push_back(std::move(entry)); },
{},
projection);
relinkables = std::move(newRelinkables);
}
void syncDeclarations(Storage::Synchronization::Types &types, void syncDeclarations(Storage::Synchronization::Types &types,
AliasPropertyDeclarations &aliasPropertyDeclarationsToLink, AliasPropertyDeclarations &aliasPropertyDeclarationsToLink,

View File

@@ -3,24 +3,20 @@
#include "projectstorageexceptions.h" #include "projectstorageexceptions.h"
#include <tracing/qmldesignertracing.h> #include "projectstoragetracing.h"
namespace QmlDesigner { namespace QmlDesigner {
using namespace NanotraceHR::Literals; using namespace NanotraceHR::Literals;
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
namespace { using ProjectStorageTracing::category;
using ProjectStorageTracing::projectStorageCategory;
} // namespace
TypeHasInvalidSourceId::TypeHasInvalidSourceId(const Sqlite::source_location &location) TypeHasInvalidSourceId::TypeHasInvalidSourceId(const Sqlite::source_location &location)
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("TypeHasInvalidSourceId"); category().threadEvent("TypeHasInvalidSourceId");
} }
const char *TypeHasInvalidSourceId::what() const noexcept const char *TypeHasInvalidSourceId::what() const noexcept
@@ -32,7 +28,7 @@ ModuleDoesNotExists::ModuleDoesNotExists(const Sqlite::source_location &location
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("ModuleDoesNotExists"); category().threadEvent("ModuleDoesNotExists");
} }
const char *ModuleDoesNotExists::what() const noexcept const char *ModuleDoesNotExists::what() const noexcept
@@ -44,7 +40,7 @@ ModuleAlreadyExists::ModuleAlreadyExists(const Sqlite::source_location &location
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("ModuleAlreadyExists"); category().threadEvent("ModuleAlreadyExists");
} }
const char *ModuleAlreadyExists::what() const noexcept const char *ModuleAlreadyExists::what() const noexcept
@@ -61,16 +57,16 @@ TypeNameDoesNotExists::TypeNameDoesNotExists(std::string_view typeName,
{"type: ", typeName, ", source id: ", Utils::SmallString::number(sourceId.internalId())}), {"type: ", typeName, ", source id: ", Utils::SmallString::number(sourceId.internalId())}),
location} location}
{ {
projectStorageCategory().threadEvent("TypeNameDoesNotExists", category().threadEvent("TypeNameDoesNotExists",
keyValue("type name", typeName), keyValue("type name", typeName),
keyValue("source id", sourceId)); keyValue("source id", sourceId));
} }
PrototypeChainCycle::PrototypeChainCycle(const Sqlite::source_location &location) PrototypeChainCycle::PrototypeChainCycle(const Sqlite::source_location &location)
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("PrototypeChainCycle"); category().threadEvent("PrototypeChainCycle");
} }
const char *PrototypeChainCycle::what() const noexcept const char *PrototypeChainCycle::what() const noexcept
@@ -82,7 +78,7 @@ AliasChainCycle::AliasChainCycle(const Sqlite::source_location &location)
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("AliasChainCycle"); category().threadEvent("AliasChainCycle");
} }
const char *AliasChainCycle::what() const noexcept const char *AliasChainCycle::what() const noexcept
@@ -94,7 +90,7 @@ CannotParseQmlTypesFile::CannotParseQmlTypesFile(const Sqlite::source_location &
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("CannotParseQmlTypesFile"); category().threadEvent("CannotParseQmlTypesFile");
} }
const char *CannotParseQmlTypesFile::what() const noexcept const char *CannotParseQmlTypesFile::what() const noexcept
@@ -106,7 +102,7 @@ CannotParseQmlDocumentFile::CannotParseQmlDocumentFile(const Sqlite::source_loca
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("CannotParseQmlDocumentFile"); category().threadEvent("CannotParseQmlDocumentFile");
} }
const char *CannotParseQmlDocumentFile::what() const noexcept const char *CannotParseQmlDocumentFile::what() const noexcept
@@ -119,7 +115,7 @@ DirectoryInfoHasInvalidProjectSourceId::DirectoryInfoHasInvalidProjectSourceId(
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("DirectoryInfoHasInvalidProjectSourceId"); category().threadEvent("DirectoryInfoHasInvalidProjectSourceId");
} }
const char *DirectoryInfoHasInvalidProjectSourceId::what() const noexcept const char *DirectoryInfoHasInvalidProjectSourceId::what() const noexcept
@@ -131,7 +127,7 @@ DirectoryInfoHasInvalidSourceId::DirectoryInfoHasInvalidSourceId(const Sqlite::s
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("DirectoryInfoHasInvalidSourceId"); category().threadEvent("DirectoryInfoHasInvalidSourceId");
} }
const char *DirectoryInfoHasInvalidSourceId::what() const noexcept const char *DirectoryInfoHasInvalidSourceId::what() const noexcept
@@ -143,7 +139,7 @@ DirectoryInfoHasInvalidModuleId::DirectoryInfoHasInvalidModuleId(const Sqlite::s
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("DirectoryInfoHasInvalidModuleId"); category().threadEvent("DirectoryInfoHasInvalidModuleId");
} }
const char *DirectoryInfoHasInvalidModuleId::what() const noexcept const char *DirectoryInfoHasInvalidModuleId::what() const noexcept
@@ -155,7 +151,7 @@ FileStatusHasInvalidSourceId::FileStatusHasInvalidSourceId(const Sqlite::source_
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("FileStatusHasInvalidSourceId"); category().threadEvent("FileStatusHasInvalidSourceId");
} }
const char *FileStatusHasInvalidSourceId::what() const noexcept const char *FileStatusHasInvalidSourceId::what() const noexcept
@@ -188,14 +184,13 @@ ExportedTypeCannotBeInserted::ExportedTypeCannotBeInserted(std::string_view erro
const Sqlite::source_location &location) const Sqlite::source_location &location)
: ProjectStorageErrorWithMessage{"ExportedTypeCannotBeInserted"sv, errorMessage, location} : ProjectStorageErrorWithMessage{"ExportedTypeCannotBeInserted"sv, errorMessage, location}
{ {
projectStorageCategory().threadEvent("ExportedTypeCannotBeInserted", category().threadEvent("ExportedTypeCannotBeInserted", keyValue("error message", errorMessage));
keyValue("error message", errorMessage));
} }
TypeAnnotationHasInvalidSourceId::TypeAnnotationHasInvalidSourceId(const Sqlite::source_location &location) TypeAnnotationHasInvalidSourceId::TypeAnnotationHasInvalidSourceId(const Sqlite::source_location &location)
: ProjectStorageError{location} : ProjectStorageError{location}
{ {
projectStorageCategory().threadEvent("TypeAnnotationHasInvalidSourceId"); category().threadEvent("TypeAnnotationHasInvalidSourceId");
} }
const char *TypeAnnotationHasInvalidSourceId::what() const noexcept const char *TypeAnnotationHasInvalidSourceId::what() const noexcept

View File

@@ -0,0 +1,31 @@
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "projectstoragetracing.h"
#include <tracing/qmldesignertracing.h>
#include <sqlitebasestatement.h>
namespace QmlDesigner::ProjectStorageTracing {
using namespace NanotraceHR::Literals;
#ifdef ENABLE_PROJECT_STORAGE_TRACING
namespace {
thread_local Category category_{"project storage",
Tracing::eventQueueWithStringArguments(),
Tracing::eventQueueWithoutArguments(),
category};
} // namespace
Category &category()
{
return category_;
}
#endif
} // namespace QmlDesigner::ProjectStorageTracing

View File

@@ -0,0 +1,30 @@
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qmldesignercorelib_exports.h>
#include <nanotrace/nanotracehr.h>
#pragma once
namespace QmlDesigner::ProjectStorageTracing {
#ifdef ENABLE_PROJECT_STORAGE_TRACING
using Category = NanotraceHR::EnabledCategory;
using SourceLocation = Category::SourceLocation;
[[gnu::pure]] QMLDESIGNERCORE_EXPORT Category &category();
#else
using Category = NanotraceHR::DisabledCategory;
using SourceLocation = Category::SourceLocation;
inline Category category()
{
return {};
}
#endif
} // namespace QmlDesigner::ProjectStorageTracing

View File

@@ -7,6 +7,7 @@
#include "filesysteminterface.h" #include "filesysteminterface.h"
#include "projectstorage.h" #include "projectstorage.h"
#include "projectstoragepathwatcherinterface.h" #include "projectstoragepathwatcherinterface.h"
#include "projectstoragetracing.h"
#include "qmldocumentparserinterface.h" #include "qmldocumentparserinterface.h"
#include "qmltypesparserinterface.h" #include "qmltypesparserinterface.h"
#include "sourcepathstorage/sourcepath.h" #include "sourcepathstorage/sourcepath.h"
@@ -15,7 +16,6 @@
#include <functional.h> #include <functional.h>
#include <sqlitedatabase.h> #include <sqlitedatabase.h>
#include <tracing/qmldesignertracing.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/set_algorithm.h> #include <utils/set_algorithm.h>
@@ -29,7 +29,7 @@
namespace QmlDesigner { namespace QmlDesigner {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
using ProjectStorageTracing::projectStorageUpdaterCategory; using ProjectStorageTracing::category;
using Tracer = NanotraceHR::Tracer<ProjectStorageTracing::Category>; using Tracer = NanotraceHR::Tracer<ProjectStorageTracing::Category>;
template<typename String> template<typename String>
@@ -205,7 +205,7 @@ void addModuleExportedImport(Storage::Synchronization::ModuleExportedImports &im
std::string_view exportedModuleName) std::string_view exportedModuleName)
{ {
NanotraceHR::Tracer tracer{"add module exported imports", NanotraceHR::Tracer tracer{"add module exported imports",
projectStorageUpdaterCategory(), category(),
keyValue("module id", moduleId), keyValue("module id", moduleId),
keyValue("exported module id", exportedModuleId), keyValue("exported module id", exportedModuleId),
keyValue("version", version), keyValue("version", version),
@@ -231,7 +231,7 @@ void addModuleExportedImports(Storage::Synchronization::ModuleExportedImports &i
ProjectStorageInterface &projectStorage) ProjectStorageInterface &projectStorage)
{ {
NanotraceHR::Tracer tracer{"add module exported imports", NanotraceHR::Tracer tracer{"add module exported imports",
projectStorageUpdaterCategory(), category(),
keyValue("cpp module id", cppModuleId), keyValue("cpp module id", cppModuleId),
keyValue("module id", moduleId)}; keyValue("module id", moduleId)};
@@ -294,7 +294,7 @@ void ProjectStorageUpdater::update(Update update)
const Utils::PathString projectDirectory = update.projectDirectory; const Utils::PathString projectDirectory = update.projectDirectory;
NanotraceHR::Tracer tracer{"update", NanotraceHR::Tracer tracer{"update",
projectStorageUpdaterCategory(), category(),
keyValue("Qt directories", qtDirectories), keyValue("Qt directories", qtDirectories),
keyValue("project directory", projectDirectory)}; keyValue("project directory", projectDirectory)};
@@ -516,7 +516,7 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
NotUpdatedSourceIds &notUpdatedSourceIds, NotUpdatedSourceIds &notUpdatedSourceIds,
WatchedSourceIds &watchedSourceIds) WatchedSourceIds &watchedSourceIds)
{ {
NanotraceHR::Tracer tracer{"update directories", projectStorageUpdaterCategory()}; NanotraceHR::Tracer tracer{"update directories", category()};
for (const QString &directory : directories) for (const QString &directory : directories)
updateDirectory( updateDirectory(
@@ -624,7 +624,7 @@ void ProjectStorageUpdater::annotationDirectoryChanged(
Storage::Synchronization::SynchronizationPackage &package) Storage::Synchronization::SynchronizationPackage &package)
{ {
NanotraceHR::Tracer tracer{"annotation directory changed", NanotraceHR::Tracer tracer{"annotation directory changed",
projectStorageUpdaterCategory(), category(),
keyValue("directory path", directoryPath), keyValue("directory path", directoryPath),
keyValue("directory id", directoryId)}; keyValue("directory id", directoryId)};
@@ -640,7 +640,7 @@ void ProjectStorageUpdater::updatePropertyEditorFiles(
Storage::Synchronization::SynchronizationPackage &package) Storage::Synchronization::SynchronizationPackage &package)
{ {
NanotraceHR::Tracer tracer{"update property editor files", NanotraceHR::Tracer tracer{"update property editor files",
projectStorageUpdaterCategory(), category(),
keyValue("directory path", directoryPath), keyValue("directory path", directoryPath),
keyValue("directory id", directoryId)}; keyValue("directory id", directoryId)};
@@ -676,9 +676,7 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
WatchedSourceIds &watchedSourceIds, WatchedSourceIds &watchedSourceIds,
IsInsideProject isInsideProject) IsInsideProject isInsideProject)
{ {
NanotraceHR::Tracer tracer{"update directory", NanotraceHR::Tracer tracer{"update directory", category(), keyValue("directory", directoryPath)};
projectStorageUpdaterCategory(),
keyValue("directory", directoryPath)};
SourcePath qmldirPath{directoryPath + "/qmldir"}; SourcePath qmldirPath{directoryPath + "/qmldir"};
SourceId qmldirSourceId = m_pathCache.sourceId(qmldirPath); SourceId qmldirSourceId = m_pathCache.sourceId(qmldirPath);
@@ -766,7 +764,7 @@ void ProjectStorageUpdater::updatePropertyEditorPaths(
NotUpdatedSourceIds &notUpdatedSourceIds) NotUpdatedSourceIds &notUpdatedSourceIds)
{ {
NanotraceHR::Tracer tracer{"update property editor paths", NanotraceHR::Tracer tracer{"update property editor paths",
projectStorageUpdaterCategory(), category(),
keyValue("property editor resources path", propertyEditorResourcesPath)}; keyValue("property editor resources path", propertyEditorResourcesPath)};
if (propertyEditorResourcesPath.isEmpty()) if (propertyEditorResourcesPath.isEmpty())
@@ -810,7 +808,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", projectStorageUpdaterCategory()); NanotraceHR::Tracer tracer("update type annotations", category());
std::map<DirectoryPathId, SmallSourceIds<16>> updatedSourceIdsDictonary; std::map<DirectoryPathId, SmallSourceIds<16>> updatedSourceIdsDictonary;
@@ -830,7 +828,7 @@ void ProjectStorageUpdater::updateTypeAnnotations(
std::map<DirectoryPathId, SmallSourceIds<16>> &updatedSourceIdsDictonary) std::map<DirectoryPathId, SmallSourceIds<16>> &updatedSourceIdsDictonary)
{ {
NanotraceHR::Tracer tracer("update type annotation directory", NanotraceHR::Tracer tracer("update type annotation directory",
projectStorageUpdaterCategory(), category(),
keyValue("path", rootDirectoryPath)); keyValue("path", rootDirectoryPath));
if (rootDirectoryPath.isEmpty()) if (rootDirectoryPath.isEmpty())
@@ -904,7 +902,7 @@ void ProjectStorageUpdater::updateTypeAnnotation(const QString &directoryPath,
Storage::Synchronization::SynchronizationPackage &package) Storage::Synchronization::SynchronizationPackage &package)
{ {
NanotraceHR::Tracer tracer{"update type annotation path", NanotraceHR::Tracer tracer{"update type annotation path",
projectStorageUpdaterCategory(), category(),
keyValue("path", filePath), keyValue("path", filePath),
keyValue("directory path", directoryPath)}; keyValue("directory path", directoryPath)};
@@ -927,7 +925,7 @@ void ProjectStorageUpdater::updatePropertyEditorPath(
long long pathOffset) long long pathOffset)
{ {
NanotraceHR::Tracer tracer{"update property editor path", NanotraceHR::Tracer tracer{"update property editor path",
projectStorageUpdaterCategory(), category(),
keyValue("directory path", directoryPath), keyValue("directory path", directoryPath),
keyValue("directory id", directoryId)}; keyValue("directory id", directoryId)};
@@ -947,7 +945,7 @@ void ProjectStorageUpdater::updatePropertyEditorFilePath(
long long pathOffset) long long pathOffset)
{ {
NanotraceHR::Tracer tracer{"update property editor file path", NanotraceHR::Tracer tracer{"update property editor file path",
projectStorageUpdaterCategory(), category(),
keyValue("directory path", path), keyValue("directory path", path),
keyValue("directory id", directoryId)}; keyValue("directory id", directoryId)};
@@ -1038,7 +1036,7 @@ void appendProjectChunkSourceIds(ProjectChunkSourceIds &ids,
void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &changedIdPaths) void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &changedIdPaths)
{ {
NanotraceHR::Tracer tracer{"paths with ids changed", NanotraceHR::Tracer tracer{"paths with ids changed",
projectStorageUpdaterCategory(), category(),
keyValue("id paths", changedIdPaths)}; keyValue("id paths", changedIdPaths)};
try { try {
@@ -1165,15 +1163,13 @@ void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
IsInsideProject isInsideProject) IsInsideProject isInsideProject)
{ {
NanotraceHR::Tracer tracer{"parse type infos", NanotraceHR::Tracer tracer{"parse type infos",
projectStorageUpdaterCategory(), category(),
keyValue("directory id", directoryId), keyValue("directory id", directoryId),
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", NanotraceHR::Tracer tracer{"parse type info", category(), keyValue("type info", typeInfo)};
projectStorageUpdaterCategory(),
keyValue("type info", typeInfo)};
Utils::PathString qmltypesFileName = typeInfo; Utils::PathString qmltypesFileName = typeInfo;
SourceId sourceId = m_pathCache.sourceId(directoryId, qmltypesFileName); SourceId sourceId = m_pathCache.sourceId(directoryId, qmltypesFileName);
@@ -1216,7 +1212,7 @@ void ProjectStorageUpdater::parseDirectoryInfos(
WatchedSourceIds &watchedSourceIds, WatchedSourceIds &watchedSourceIds,
IsInsideProject isInsideProject) IsInsideProject isInsideProject)
{ {
NanotraceHR::Tracer tracer{"parse project datas", projectStorageUpdaterCategory()}; 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) {
@@ -1245,9 +1241,7 @@ auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::Direct
NotUpdatedSourceIds &notUpdatedSourceIds, NotUpdatedSourceIds &notUpdatedSourceIds,
IsInsideProject isInsideProject) -> FileState IsInsideProject isInsideProject) -> FileState
{ {
NanotraceHR::Tracer tracer{"parse type info", NanotraceHR::Tracer tracer{"parse type info", category(), keyValue("qmltypes path", qmltypesPath)};
projectStorageUpdaterCategory(),
keyValue("qmltypes path", qmltypesPath)};
auto state = fileState(directoryInfo.sourceId, package, notUpdatedSourceIds); auto state = fileState(directoryInfo.sourceId, package, notUpdatedSourceIds);
switch (state) { switch (state) {
@@ -1293,7 +1287,7 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
IsInsideProject isInsideProject) IsInsideProject isInsideProject)
{ {
NanotraceHR::Tracer tracer{"parse qml component", NanotraceHR::Tracer tracer{"parse qml component",
projectStorageUpdaterCategory(), category(),
keyValue("relative file path", relativeFilePath), keyValue("relative file path", relativeFilePath),
keyValue("directory path", directoryPath), keyValue("directory path", directoryPath),
keyValue("exported types", exportedTypes), keyValue("exported types", exportedTypes),
@@ -1369,9 +1363,7 @@ void ProjectStorageUpdater::parseQmlComponent(SourceId sourceId,
NotUpdatedSourceIds &notUpdatedSourceIds, NotUpdatedSourceIds &notUpdatedSourceIds,
IsInsideProject isInsideProject) IsInsideProject isInsideProject)
{ {
NanotraceHR::Tracer tracer{"parse qml component", NanotraceHR::Tracer tracer{"parse qml component", category(), keyValue("source id", sourceId)};
projectStorageUpdaterCategory(),
keyValue("source id", sourceId)};
auto state = fileState(sourceId, package, notUpdatedSourceIds); auto state = fileState(sourceId, package, notUpdatedSourceIds);
if (isUnchanged(state)) if (isUnchanged(state))
@@ -1468,7 +1460,7 @@ void ProjectStorageUpdater::parseQmlComponents(Components components,
IsInsideProject isInsideProject) IsInsideProject isInsideProject)
{ {
NanotraceHR::Tracer tracer{"parse qml components", NanotraceHR::Tracer tracer{"parse qml components",
projectStorageUpdaterCategory(), category(),
keyValue("directory id", directoryId), keyValue("directory id", directoryId),
keyValue("qmldir state", qmldirState)}; keyValue("qmldir state", qmldirState)};
@@ -1502,7 +1494,7 @@ ProjectStorageUpdater::FileState ProjectStorageUpdater::fileState(
NotUpdatedSourceIds &notUpdatedSourceIds) const NotUpdatedSourceIds &notUpdatedSourceIds) const
{ {
NanotraceHR::Tracer tracer{"update property editor paths", NanotraceHR::Tracer tracer{"update property editor paths",
projectStorageUpdaterCategory(), category(),
keyValue("source id", sourceId)}; keyValue("source id", sourceId)};
auto currentFileStatus = m_fileStatusCache.find(sourceId); auto currentFileStatus = m_fileStatusCache.find(sourceId);

View File

@@ -8,14 +8,13 @@
#include "projectstorageids.h" #include "projectstorageids.h"
#include "projectstoragepathwatchernotifierinterface.h" #include "projectstoragepathwatchernotifierinterface.h"
#include "projectstoragepathwatchertypes.h" #include "projectstoragepathwatchertypes.h"
#include "projectstoragetracing.h"
#include "projectstoragetypes.h" #include "projectstoragetypes.h"
#include "sourcepathstorage/nonlockingmutex.h" #include "sourcepathstorage/nonlockingmutex.h"
#include "sourcepathstorage/sourcepath.h" #include "sourcepathstorage/sourcepath.h"
#include <modelfwd.h> #include <modelfwd.h>
#include <tracing/qmldesignertracing.h>
#include <QStringList> #include <QStringList>
#include <map> #include <map>

View File

@@ -6,11 +6,11 @@
#include "projectstorage.h" #include "projectstorage.h"
#include "projectstorageexceptions.h" #include "projectstorageexceptions.h"
#include "projectstoragetracing.h"
#include <sourcepathstorage/sourcepathcache.h> #include <sourcepathstorage/sourcepathcache.h>
#include <sqlitedatabase.h> #include <sqlitedatabase.h>
#include <tracing/qmldesignertracing.h>
#ifdef QDS_BUILD_QMLPARSER #ifdef QDS_BUILD_QMLPARSER
#include <private/qqmldomtop_p.h> #include <private/qqmldomtop_p.h>
@@ -23,8 +23,8 @@ namespace QmlDesigner {
#ifdef QDS_BUILD_QMLPARSER #ifdef QDS_BUILD_QMLPARSER
using ProjectStorageTracing::projectStorageUpdaterCategory;
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
using ProjectStorageTracing::category;
using Storage::IsInsideProject; using Storage::IsInsideProject;
using Tracer = NanotraceHR::Tracer<ProjectStorageTracing::Category>; using Tracer = NanotraceHR::Tracer<ProjectStorageTracing::Category>;
@@ -97,7 +97,7 @@ QualifiedImports createQualifiedImports(const QList<QmlDom::Import> &qmlImports,
ProjectStorageType &storage) ProjectStorageType &storage)
{ {
NanotraceHR::Tracer tracer{"create qualified imports", NanotraceHR::Tracer tracer{"create qualified imports",
projectStorageUpdaterCategory(), category(),
keyValue("sourceId", sourceId), keyValue("sourceId", sourceId),
keyValue("directoryPath", directoryPath)}; keyValue("directoryPath", directoryPath)};
@@ -331,7 +331,7 @@ Storage::Synchronization::Type QmlDocumentParser::parse(const QString &sourceCon
IsInsideProject isInsideProject) IsInsideProject isInsideProject)
{ {
NanotraceHR::Tracer tracer{"qml document parser parse", NanotraceHR::Tracer tracer{"qml document parser parse",
projectStorageUpdaterCategory(), category(),
keyValue("sourceId", sourceId), keyValue("sourceId", sourceId),
keyValue("directoryPath", directoryPath)}; keyValue("directoryPath", directoryPath)};

View File

@@ -4,8 +4,7 @@
#include "qmltypesparser.h" #include "qmltypesparser.h"
#include "projectstorage.h" #include "projectstorage.h"
#include "projectstoragetracing.h"
#include <tracing/qmldesignertracing.h>
#include <sqlitedatabase.h> #include <sqlitedatabase.h>
@@ -25,8 +24,8 @@ namespace QmlDesigner {
#ifdef QDS_BUILD_QMLPARSER #ifdef QDS_BUILD_QMLPARSER
using ProjectStorageTracing::projectStorageUpdaterCategory;
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
using ProjectStorageTracing::category;
using Storage::IsInsideProject; using Storage::IsInsideProject;
using Tracer = NanotraceHR::Tracer<ProjectStorageTracing::Category>; using Tracer = NanotraceHR::Tracer<ProjectStorageTracing::Category>;
using Storage::ModuleKind; using Storage::ModuleKind;
@@ -40,7 +39,7 @@ using Storage::TypeNameString;
ComponentWithoutNamespaces createComponentNameWithoutNamespaces(const QList<QQmlJSExportedScope> &objects) ComponentWithoutNamespaces createComponentNameWithoutNamespaces(const QList<QQmlJSExportedScope> &objects)
{ {
NanotraceHR::Tracer tracer{"parse qmltypes file", projectStorageUpdaterCategory()}; NanotraceHR::Tracer tracer{"parse qmltypes file", category()};
ComponentWithoutNamespaces componentWithoutNamespaces; ComponentWithoutNamespaces componentWithoutNamespaces;
@@ -83,7 +82,7 @@ void addImports(Storage::Imports &imports,
{ {
NanotraceHR::Tracer tracer{ NanotraceHR::Tracer tracer{
"add imports", "add imports",
projectStorageUpdaterCategory(), category(),
keyValue("source id", sourceId), keyValue("source id", sourceId),
keyValue("module id", cppModuleId), keyValue("module id", cppModuleId),
}; };
@@ -467,7 +466,7 @@ void addType(Storage::Synchronization::Types &types,
Internal::LastModule &lastQmlModule) Internal::LastModule &lastQmlModule)
{ {
NanotraceHR::Tracer tracer{"add type", NanotraceHR::Tracer tracer{"add type",
projectStorageUpdaterCategory(), category(),
keyValue("source id", sourceId), keyValue("source id", sourceId),
keyValue("module id", cppModuleId)}; keyValue("module id", cppModuleId)};
@@ -507,7 +506,7 @@ void addTypes(Storage::Synchronization::Types &types,
IsInsideProject isInsideProject, IsInsideProject isInsideProject,
Internal::LastModule &lastQmlModule) Internal::LastModule &lastQmlModule)
{ {
NanotraceHR::Tracer tracer{"add types", projectStorageUpdaterCategory()}; NanotraceHR::Tracer tracer{"add types", category()};
types.reserve(Utils::usize(objects) + types.size()); types.reserve(Utils::usize(objects) + types.size());
@@ -531,7 +530,7 @@ void QmlTypesParser::parse(const QString &sourceContent,
const Storage::Synchronization::DirectoryInfo &directoryInfo, const Storage::Synchronization::DirectoryInfo &directoryInfo,
IsInsideProject isInsideProject) IsInsideProject isInsideProject)
{ {
NanotraceHR::Tracer tracer{"qmltypes parser parse", projectStorageUpdaterCategory()}; NanotraceHR::Tracer tracer{"qmltypes parser parse", category()};
lastQmlModule.name.clear(); lastQmlModule.name.clear();
lastQmlModule.id = ModuleId{}; lastQmlModule.id = ModuleId{};

View File

@@ -68,34 +68,6 @@ Category &category()
} // namespace ModelTracing } // namespace ModelTracing
namespace ProjectStorageTracing {
#ifdef ENABLE_PROJECT_STORAGE_TRACING
Category &projectStorageCategory()
{
thread_local Category category{"project storage",
Tracing::eventQueueWithStringArguments(),
Tracing::eventQueueWithoutArguments(),
projectStorageCategory};
return category;
}
Category &projectStorageUpdaterCategory()
{
thread_local Category category{"project storage updater",
Tracing::eventQueueWithStringArguments(),
Tracing::eventQueueWithoutArguments(),
projectStorageCategory};
return category;
}
#endif
} // namespace ProjectStorageTracing
namespace SourcePathStorageTracing { namespace SourcePathStorageTracing {
#ifdef ENABLE_SOURCE_PATH_STORAGE_TRACING #ifdef ENABLE_SOURCE_PATH_STORAGE_TRACING

View File

@@ -48,34 +48,6 @@ inline Category category()
} // namespace ModelTracing } // namespace ModelTracing
namespace ProjectStorageTracing {
#ifdef ENABLE_PROJECT_STORAGE_TRACING
using Category = NanotraceHR::EnabledCategory;
[[gnu::pure]] Category &projectStorageCategory();
[[gnu::pure]] Category &projectStorageUpdaterCategory();
#else
using Category = NanotraceHR::DisabledCategory;
inline Category projectStorageCategory()
{
return {};
}
inline Category projectStorageUpdaterCategory()
{
return {};
}
#endif
} // namespace ProjectStorageTracing
namespace SourcePathStorageTracing { namespace SourcePathStorageTracing {
#ifdef ENABLE_SOURCE_PATH_STORAGE_TRACING #ifdef ENABLE_SOURCE_PATH_STORAGE_TRACING