diff options
author | Marco Bubke <marco.bubke@qt.io> | 2023-10-11 20:20:59 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2023-10-12 11:14:42 +0000 |
commit | c081c96bf0b99bc0c25943956a64014df65e7514 (patch) | |
tree | 06d92ec9d4b881f0b01f9ccf3ea11500801d8471 /src | |
parent | 14476ee6062e17e4160714d53e55a5fcb8e95a8d (diff) |
QmlDesigner: Add tracing to project storage
The tracing is by default disabled for the project storage category. So
there is no overhead because the tracer instance is a empty class in
that case.
Change-Id: I7d3e91527871a946cadbbad2e11f0b2ab2825c59
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Diffstat (limited to 'src')
3 files changed, 187 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 5b620323389..6e8df880782 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -15,6 +15,11 @@ env_with_default("QDS_USE_PROJECTSTORAGE" ENV_QDS_USE_PROJECTSTORAGE OFF) option(USE_PROJECTSTORAGE "Use ProjectStorage" ${ENV_QDS_USE_PROJECTSTORAGE}) add_feature_info("ProjectStorage" ${USE_PROJECTSTORAGE} "") +env_with_default("QTC_ENABLE_PROJECT_STORAGE_TRACING" ENV_QTC_ENABLE_PROJECT_STORAGE_TRACING OFF) +option(ENABLE_PROJECT_STORAGE_TRACING "Enable sqlite tarcing" ${ENV_QTC_ENABLE_PROJECT_STORAGE_TRACING}) +add_feature_info("Sqlite tracing" ${ENABLE_PROJECT_STORAGE_TRACING} "") + + add_qtc_library(QmlDesignerUtils STATIC DEPENDS Qt::Gui Utils Qt::QmlPrivate Core @@ -84,6 +89,13 @@ add_qtc_library(QmlDesignerCore STATIC ) extend_qtc_library(QmlDesignerCore + CONDITION TARGET Nanotrace + DEPENDS Nanotrace + DEFINES + $<$<BOOL:${ENABLE_PROJECT_STORAGE_TRACING}>:ENABLE_PROJECT_STORAGE_TRACING> +) + +extend_qtc_library(QmlDesignerCore CONDITION ENABLE_COMPILE_WARNING_AS_ERROR PROPERTIES COMPILE_WARNING_AS_ERROR ON ) diff --git a/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.cpp b/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.cpp index 2bef2244d70..9819c2adcc4 100644 --- a/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.cpp +++ b/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.cpp @@ -5,4 +5,20 @@ #include <sqlitedatabase.h> +namespace QmlDesigner { + +#ifdef ENABLE_PROJECT_STORAGE_TRACING +namespace { +NanotraceHR::TraceFile traceFile{"projectstorage.json"}; + +thread_local auto eventQueueData = NanotraceHR::makeEventQueueData<NanotraceHR::StringViewTraceEvent, 1000>( + traceFile); +thread_local NanotraceHR::EventQueue<NanotraceHR::StringViewTraceEvent> eventQueue = eventQueueData; +} // namespace + +NanotraceHR::Category<NanotraceHR::StringViewTraceEvent> projectStorageCategory{"project storage"_t, + eventQueue}; +#endif +} // namespace QmlDesigner + template class QmlDesigner::ProjectStorage<Sqlite::Database>; diff --git a/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.h b/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.h index f2bdaa4a26c..d3963019440 100644 --- a/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.h +++ b/src/plugins/qmldesigner/designercore/projectstorage/projectstorage.h @@ -26,6 +26,14 @@ namespace QmlDesigner { +using namespace NanotraceHR::Literals; + +#ifdef ENABLE_PROJECT_STORAGE_TRACING +extern NanotraceHR::Category<NanotraceHR::StringViewTraceEvent> projectStorageCategory; +#else +inline NanotraceHR::DisabledCategory projectStorageCategory; +#endif + template<typename Database> class ProjectStorage final : public ProjectStorageInterface { @@ -44,6 +52,8 @@ public: , exclusiveTransaction{database} , initializer{database, isInitialized} { + NanotraceHR::Tracer tracer{"initialize"_t, projectStorageCategory}; + exclusiveTransaction.commit(); database.walCheckpointFull(); @@ -53,6 +63,8 @@ public: void synchronize(Storage::Synchronization::SynchronizationPackage package) override { + NanotraceHR::Tracer tracer{"synchronize"_t, projectStorageCategory}; + TypeIds deletedTypeIds; Sqlite::withImmediateTransaction(database, [&] { AliasPropertyDeclarations insertedAliasPropertyDeclarations; @@ -118,6 +130,8 @@ public: void synchronizeDocumentImports(Storage::Imports imports, SourceId sourceId) override { + NanotraceHR::Tracer tracer{"synchronize document imports"_t, projectStorageCategory}; + Sqlite::withImmediateTransaction(database, [&] { synchronizeDocumentImports(imports, {sourceId}, @@ -134,11 +148,15 @@ public: ModuleId moduleId(Utils::SmallStringView moduleName) const override { + NanotraceHR::Tracer tracer{"get module id"_t, projectStorageCategory}; + return moduleCache.id(moduleName); } Utils::SmallString moduleName(ModuleId moduleId) const { + NanotraceHR::Tracer tracer{"get module name"_t, projectStorageCategory}; + if (!moduleId) throw ModuleDoesNotExists{}; @@ -149,6 +167,8 @@ public: Utils::SmallStringView exportedTypeName, Storage::Version version) const override { + NanotraceHR::Tracer tracer{"get type id by exported name"_t, projectStorageCategory}; + if (version.minor) return selectTypeIdByModuleIdAndExportedNameAndVersionStatement .template valueWithTransaction<TypeId>(moduleId, @@ -166,17 +186,23 @@ public: TypeId typeId(ImportedTypeNameId typeNameId) const override { + NanotraceHR::Tracer tracer{"get type id by imported type name"_t, projectStorageCategory}; + return Sqlite::withDeferredTransaction(database, [&] { return fetchTypeId(typeNameId); }); } QVarLengthArray<TypeId, 256> typeIds(ModuleId moduleId) const override { + NanotraceHR::Tracer tracer{"get type ids by module id"_t, projectStorageCategory}; + return selectTypeIdsByModuleIdStatement .template valuesWithTransaction<QVarLengthArray<TypeId, 256>>(moduleId); } Storage::Info::ExportedTypeNames exportedTypeNames(TypeId typeId) const override { + NanotraceHR::Tracer tracer{"get exported type names by type id"_t, projectStorageCategory}; + return selectExportedTypesByTypeIdStatement .template valuesWithTransaction<Storage::Info::ExportedTypeName, 4>(typeId); } @@ -184,12 +210,16 @@ public: Storage::Info::ExportedTypeNames exportedTypeNames(TypeId typeId, SourceId sourceId) const override { + NanotraceHR::Tracer tracer{"get exported type names by source id"_t, projectStorageCategory}; + return selectExportedTypesByTypeIdAndSourceIdStatement .template valuesWithTransaction<Storage::Info::ExportedTypeName, 4>(typeId, sourceId); } ImportId importId(const Storage::Import &import) const override { + NanotraceHR::Tracer tracer{"get import id by import"_t, projectStorageCategory}; + return Sqlite::withDeferredTransaction(database, [&] { return fetchImportId(import.sourceId, import); }); @@ -198,6 +228,8 @@ public: ImportedTypeNameId importedTypeNameId(ImportId importId, Utils::SmallStringView typeName) override { + NanotraceHR::Tracer tracer{"get imported type name id by import id"_t, projectStorageCategory}; + return Sqlite::withDeferredTransaction(database, [&] { return fetchImportedTypeNameId(Storage::Synchronization::TypeNameKind::QualifiedExported, importId, @@ -208,6 +240,8 @@ public: ImportedTypeNameId importedTypeNameId(SourceId sourceId, Utils::SmallStringView typeName) override { + NanotraceHR::Tracer tracer{"get imported type name id by source id"_t, projectStorageCategory}; + return Sqlite::withDeferredTransaction(database, [&] { return fetchImportedTypeNameId(Storage::Synchronization::TypeNameKind::Exported, sourceId, @@ -217,12 +251,16 @@ public: QVarLengthArray<PropertyDeclarationId, 128> propertyDeclarationIds(TypeId typeId) const override { + NanotraceHR::Tracer tracer{"get property declaration ids"_t, projectStorageCategory}; + return selectPropertyDeclarationIdsForTypeStatement .template valuesWithTransaction<QVarLengthArray<PropertyDeclarationId, 128>>(typeId); } QVarLengthArray<PropertyDeclarationId, 128> localPropertyDeclarationIds(TypeId typeId) const override { + NanotraceHR::Tracer tracer{"get local property declaration ids"_t, projectStorageCategory}; + return selectLocalPropertyDeclarationIdsForTypeStatement .template valuesWithTransaction<QVarLengthArray<PropertyDeclarationId, 128>>(typeId); } @@ -230,6 +268,8 @@ public: PropertyDeclarationId propertyDeclarationId(TypeId typeId, Utils::SmallStringView propertyName) const override { + NanotraceHR::Tracer tracer{"get property declaration id"_t, projectStorageCategory}; + return selectPropertyDeclarationIdForTypeAndPropertyNameStatement .template valueWithTransaction<PropertyDeclarationId>(typeId, propertyName); } @@ -237,6 +277,8 @@ public: PropertyDeclarationId localPropertyDeclarationId(TypeId typeId, Utils::SmallStringView propertyName) const { + NanotraceHR::Tracer tracer{"get local property declaration id"_t, projectStorageCategory}; + return selectLocalPropertyDeclarationIdForTypeAndPropertyNameStatement .template valueWithTransaction<PropertyDeclarationId>(typeId, propertyName); } @@ -244,6 +286,8 @@ public: std::optional<Storage::Info::PropertyDeclaration> propertyDeclaration( PropertyDeclarationId propertyDeclarationId) const override { + NanotraceHR::Tracer tracer{"get property declaration"_t, projectStorageCategory}; + return selectPropertyDeclarationForPropertyDeclarationIdStatement .template optionalValueWithTransaction<Storage::Info::PropertyDeclaration>( propertyDeclarationId); @@ -251,23 +295,31 @@ public: std::optional<Storage::Info::Type> type(TypeId typeId) const override { + NanotraceHR::Tracer tracer{"get type"_t, projectStorageCategory}; + return selectInfoTypeByTypeIdStatement.template optionalValueWithTransaction<Storage::Info::Type>( typeId); } Utils::PathString typeIconPath(TypeId typeId) const override { + NanotraceHR::Tracer tracer{"get type icon path"_t, projectStorageCategory}; + return selectTypeIconPathStatement.template valueWithTransaction<Utils::PathString>(typeId); } Storage::Info::TypeHints typeHints(TypeId typeId) const override { + NanotraceHR::Tracer tracer{"get type hints"_t, projectStorageCategory}; + return selectTypeHintsStatement.template valuesWithTransaction<Storage::Info::TypeHints, 4>( typeId); } Storage::Info::ItemLibraryEntries itemLibraryEntries(TypeId typeId) const override { + NanotraceHR::Tracer tracer{"get item library entries by type id"_t, projectStorageCategory}; + using Storage::Info::ItemLibraryProperties; Storage::Info::ItemLibraryEntries entries; @@ -295,6 +347,8 @@ public: Storage::Info::ItemLibraryEntries itemLibraryEntries(SourceId sourceId) const override { + NanotraceHR::Tracer tracer{"get item library entries by source id"_t, projectStorageCategory}; + using Storage::Info::ItemLibraryProperties; Storage::Info::ItemLibraryEntries entries; @@ -322,6 +376,8 @@ public: Storage::Info::ItemLibraryEntries allItemLibraryEntries() const override { + NanotraceHR::Tracer tracer{"get all item library entries"_t, projectStorageCategory}; + using Storage::Info::ItemLibraryProperties; Storage::Info::ItemLibraryEntries entries; @@ -349,18 +405,24 @@ public: std::vector<Utils::SmallString> signalDeclarationNames(TypeId typeId) const override { + NanotraceHR::Tracer tracer{"get signal names"_t, projectStorageCategory}; + return selectSignalDeclarationNamesForTypeStatement .template valuesWithTransaction<Utils::SmallString, 32>(typeId); } std::vector<Utils::SmallString> functionDeclarationNames(TypeId typeId) const override { + NanotraceHR::Tracer tracer{"get function names"_t, projectStorageCategory}; + return selectFuncionDeclarationNamesForTypeStatement .template valuesWithTransaction<Utils::SmallString, 32>(typeId); } std::optional<Utils::SmallString> propertyName(PropertyDeclarationId propertyDeclarationId) const override { + NanotraceHR::Tracer tracer{"get property name"_t, projectStorageCategory}; + return selectPropertyNameStatement.template optionalValueWithTransaction<Utils::SmallString>( propertyDeclarationId); } @@ -373,41 +435,57 @@ public: template<const char *moduleName, const char *typeName> TypeId commonTypeId() const { + NanotraceHR::Tracer tracer{"get type id from common type cache"_t, projectStorageCategory}; + return commonTypeCache_.template typeId<moduleName, typeName>(); } template<typename BuiltinType> TypeId builtinTypeId() const { + NanotraceHR::Tracer tracer{"get builtin type id from common type cache"_t, + projectStorageCategory}; + return commonTypeCache_.template builtinTypeId<BuiltinType>(); } template<const char *builtinType> TypeId builtinTypeId() const { + NanotraceHR::Tracer tracer{"get builtin type id from common type cache"_t, + projectStorageCategory}; + return commonTypeCache_.template builtinTypeId<builtinType>(); } TypeIds prototypeIds(TypeId type) const override { + NanotraceHR::Tracer tracer{"get prototypes"_t, projectStorageCategory}; + return selectPrototypeIdsForTypeIdInOrderStatement.template valuesWithTransaction<TypeId, 16>( type); } TypeIds prototypeAndSelfIds(TypeId type) const override { + NanotraceHR::Tracer tracer{"get prototypes and self"_t, projectStorageCategory}; + return selectPrototypeAndSelfIdsForTypeIdInOrderStatement .template valuesWithTransaction<TypeId, 16>(type); } TypeIds heirIds(TypeId typeId) const override { + NanotraceHR::Tracer tracer{"get heirs"_t, projectStorageCategory}; + return selectHeirTypeIdsStatement.template valuesWithTransaction<TypeId, 64>(typeId); } template<typename... TypeIds> bool isBasedOn_(TypeId typeId, TypeIds... baseTypeIds) const { + NanotraceHR::Tracer tracer{"is based on"_t, projectStorageCategory}; + static_assert(((std::is_same_v<TypeId, TypeIds>) &&...), "Parameter must be a TypeId!"); if (((typeId == baseTypeIds) || ...)) @@ -467,6 +545,8 @@ public: TypeId fetchTypeIdByExportedName(Utils::SmallStringView name) const { + NanotraceHR::Tracer tracer{"is based on"_t, projectStorageCategory}; + return selectTypeIdByExportedNameStatement.template valueWithTransaction<TypeId>(name); } @@ -527,6 +607,8 @@ public: SourceContextId fetchSourceContextIdUnguarded(Utils::SmallStringView sourceContextPath) { + NanotraceHR::Tracer tracer{"fetch source context id unguarded"_t, projectStorageCategory}; + auto sourceContextId = readSourceContextId(sourceContextPath); return sourceContextId ? sourceContextId : writeSourceContextId(sourceContextPath); @@ -534,6 +616,8 @@ public: SourceContextId fetchSourceContextId(Utils::SmallStringView sourceContextPath) { + NanotraceHR::Tracer tracer{"fetch source context id"_t, projectStorageCategory}; + try { return Sqlite::withDeferredTransaction(database, [&] { return fetchSourceContextIdUnguarded(sourceContextPath); @@ -545,6 +629,8 @@ public: Utils::PathString fetchSourceContextPath(SourceContextId sourceContextId) const { + NanotraceHR::Tracer tracer{"fetch source context path"_t, projectStorageCategory}; + return Sqlite::withDeferredTransaction(database, [&] { auto optionalSourceContextPath = selectSourceContextPathFromSourceContextsBySourceContextIdStatement .template optionalValue<Utils::PathString>( @@ -559,12 +645,16 @@ public: auto fetchAllSourceContexts() const { + NanotraceHR::Tracer tracer{"fetch all source contexts"_t, projectStorageCategory}; + return selectAllSourceContextsStatement .template valuesWithTransaction<Cache::SourceContext, 128>(); } SourceId fetchSourceId(SourceContextId sourceContextId, Utils::SmallStringView sourceName) { + NanotraceHR::Tracer tracer{"fetch source id"_t, projectStorageCategory}; + return Sqlite::withDeferredTransaction(database, [&] { return fetchSourceIdUnguarded(sourceContextId, sourceName); }); @@ -572,6 +662,9 @@ public: auto fetchSourceNameAndSourceContextId(SourceId sourceId) const { + NanotraceHR::Tracer tracer{"fetch source name and source context id"_t, + projectStorageCategory}; + auto value = selectSourceNameAndSourceContextIdFromSourcesBySourceIdStatement .template valueWithTransaction<Cache::SourceNameAndSourceContextId>(sourceId); @@ -591,6 +684,8 @@ public: SourceContextId fetchSourceContextId(SourceId sourceId) const { + NanotraceHR::Tracer tracer{"fetch source context id"_t, projectStorageCategory}; + auto sourceContextId = selectSourceContextIdFromSourcesBySourceIdStatement .template valueWithTransaction<SourceContextId>(sourceId); @@ -602,11 +697,15 @@ public: auto fetchAllSources() const { + NanotraceHR::Tracer tracer{"fetch all sources"_t, projectStorageCategory}; + return selectAllSourcesStatement.template valuesWithTransaction<Cache::Source, 1024>(); } SourceId fetchSourceIdUnguarded(SourceContextId sourceContextId, Utils::SmallStringView sourceName) { + NanotraceHR::Tracer tracer{"fetch source id unguarded"_t, projectStorageCategory}; + auto sourceId = readSourceId(sourceContextId, sourceName); if (sourceId) @@ -617,23 +716,31 @@ public: auto fetchAllFileStatuses() const { + NanotraceHR::Tracer tracer{"fetch all file statuses"_t, projectStorageCategory}; + return selectAllFileStatusesStatement.template rangeWithTransaction<FileStatus>(); } FileStatus fetchFileStatus(SourceId sourceId) const override { + NanotraceHR::Tracer tracer{"fetch file status"_t, projectStorageCategory}; + return selectFileStatusesForSourceIdStatement.template valueWithTransaction<FileStatus>( sourceId); } std::optional<Storage::Synchronization::ProjectData> fetchProjectData(SourceId sourceId) const override { + NanotraceHR::Tracer tracer{"fetch project data"_t, projectStorageCategory}; + return selectProjectDataForSourceIdStatement .template optionalValueWithTransaction<Storage::Synchronization::ProjectData>(sourceId); } Storage::Synchronization::ProjectDatas fetchProjectDatas(SourceId projectSourceId) const override { + NanotraceHR::Tracer tracer{"fetch project datas by source id"_t, projectStorageCategory}; + return selectProjectDatasForSourceIdStatement .template valuesWithTransaction<Storage::Synchronization::ProjectData, 1024>( projectSourceId); @@ -641,6 +748,8 @@ public: Storage::Synchronization::ProjectDatas fetchProjectDatas(const SourceIds &projectSourceIds) const { + NanotraceHR::Tracer tracer{"fetch project datas by source ids"_t, projectStorageCategory}; + return selectProjectDatasForSourceIdsStatement .template valuesWithTransaction<Storage::Synchronization::ProjectData, 64>( toIntegers(projectSourceIds)); @@ -662,6 +771,8 @@ public: Storage::Imports fetchDocumentImports() const { + NanotraceHR::Tracer tracer{"fetch document imports"_t, projectStorageCategory}; + return selectAllDocumentImportForSourceIdStatement .template valuesWithTransaction<Storage::Imports>(); } @@ -914,6 +1025,8 @@ private: void synchronizeTypeAnnotations(Storage::Synchronization::TypeAnnotations &typeAnnotations, const SourceIds &updatedTypeAnnotationSourceIds) { + NanotraceHR::Tracer tracer{"synchronize type annotations"_t, projectStorageCategory}; + using Storage::Synchronization::TypeAnnotation; updateTypeIdInTypeAnnotations(typeAnnotations); @@ -981,6 +1094,8 @@ private: Prototypes &relinkableExtensions, const SourceIds &updatedSourceIds) { + NanotraceHR::Tracer tracer{"synchronize types"_t, projectStorageCategory}; + Storage::Synchronization::ExportedTypes exportedTypes; exportedTypes.reserve(types.size() * 3); SourceIds sourceIdsOfTypes; @@ -1036,6 +1151,8 @@ private: void synchronizeProjectDatas(Storage::Synchronization::ProjectDatas &projectDatas, const SourceIds &updatedProjectSourceIds) { + NanotraceHR::Tracer tracer{"synchronize project datas"_t, projectStorageCategory}; + auto compareKey = [](auto &&first, auto &&second) { auto projectSourceIdDifference = first.projectSourceId - second.projectSourceId; if (projectSourceIdDifference != 0) @@ -1088,6 +1205,8 @@ private: void synchronizeFileStatuses(FileStatuses &fileStatuses, const SourceIds &updatedSourceIds) { + NanotraceHR::Tracer tracer{"synchronize file statuses"_t, projectStorageCategory}; + auto compareKey = [](auto &&first, auto &&second) { return first.sourceId - second.sourceId; }; @@ -1133,6 +1252,8 @@ private: Storage::Synchronization::ModuleExportedImports &moduleExportedImports, const ModuleIds &updatedModuleIds) { + NanotraceHR::Tracer tracer{"synchronize imports"_t, projectStorageCategory}; + synchromizeModuleExportedImports(moduleExportedImports, updatedModuleIds); synchronizeDocumentImports(imports, updatedSourceIds, @@ -1292,6 +1413,8 @@ private: void relinkAliasPropertyDeclarations(AliasPropertyDeclarations &aliasPropertyDeclarations, const TypeIds &deletedTypeIds) { + NanotraceHR::Tracer tracer{"relink alias properties"_t, projectStorageCategory}; + std::sort(aliasPropertyDeclarations.begin(), aliasPropertyDeclarations.end()); Utils::set_greedy_difference( @@ -1320,6 +1443,8 @@ private: void relinkPropertyDeclarations(PropertyDeclarations &relinkablePropertyDeclaration, const TypeIds &deletedTypeIds) { + NanotraceHR::Tracer tracer{"relink properties"_t, projectStorageCategory}; + std::sort(relinkablePropertyDeclaration.begin(), relinkablePropertyDeclaration.end()); Utils::set_greedy_difference( @@ -1344,6 +1469,8 @@ private: const TypeIds &deletedTypeIds, Callable updateStatement) { + NanotraceHR::Tracer tracer{"relink prototypes"_t, projectStorageCategory}; + std::sort(relinkablePrototypes.begin(), relinkablePrototypes.end()); Utils::set_greedy_difference( @@ -1372,6 +1499,8 @@ private: Prototypes &relinkableExtensions, TypeIds &deletedTypeIds) { + NanotraceHR::Tracer tracer{"delete not updated types"_t, projectStorageCategory}; + auto callback = [&](TypeId typeId) { deletedTypeIds.push_back(typeId); deleteType(typeId, @@ -1394,6 +1523,8 @@ private: Prototypes &relinkableExtensions, TypeIds &deletedTypeIds) { + NanotraceHR::Tracer tracer{"relink"_t, projectStorageCategory}; + std::sort(deletedTypeIds.begin(), deletedTypeIds.end()); relinkPrototypes(relinkablePrototypes, deletedTypeIds, [&](TypeId typeId, TypeId prototypeId) { @@ -1460,6 +1591,8 @@ private: void linkAliases(const AliasPropertyDeclarations &insertedAliasPropertyDeclarations, const AliasPropertyDeclarations &updatedAliasPropertyDeclarations) { + NanotraceHR::Tracer tracer{"link aliases"_t, projectStorageCategory}; + linkAliasPropertyDeclarationAliasIds(insertedAliasPropertyDeclarations); linkAliasPropertyDeclarationAliasIds(updatedAliasPropertyDeclarations); @@ -1477,6 +1610,8 @@ private: Prototypes &relinkablePrototypes, Prototypes &relinkableExtensions) { + NanotraceHR::Tracer tracer{"synchronize exported types"_t, projectStorageCategory}; + std::sort(exportedTypes.begin(), exportedTypes.end(), [](auto &&first, auto &&second) { if (first.moduleId < second.moduleId) return true; @@ -1660,6 +1795,8 @@ private: AliasPropertyDeclarations &updatedAliasPropertyDeclarations, PropertyDeclarationIds &propertyDeclarationIds) { + NanotraceHR::Tracer tracer{"synchronize property declaration"_t, projectStorageCategory}; + std::sort(propertyDeclarations.begin(), propertyDeclarations.end(), [](auto &&first, auto &&second) { @@ -1776,6 +1913,8 @@ private: Storage::Synchronization::Types &types, AliasPropertyDeclarations &relinkableAliasPropertyDeclarations) { + NanotraceHR::Tracer tracer{"reset removed alias properties to null"_t, projectStorageCategory}; + PropertyDeclarationIds propertyDeclarationIds; propertyDeclarationIds.reserve(types.size()); @@ -1973,6 +2112,8 @@ private: void synchronizePropertyEditorQmlPaths(Storage::Synchronization::PropertyEditorQmlPaths &paths, SourceIds updatedPropertyEditorQmlPathsSourceIds) { + NanotraceHR::Tracer tracer{"synchronize property editor qml paths"_t, projectStorageCategory}; + addTypeIdToPropertyEditorQmlPaths(paths); synchronizePropertyEditorPaths(paths, updatedPropertyEditorQmlPathsSourceIds); } @@ -1980,6 +2121,8 @@ private: void synchronizeFunctionDeclarations( TypeId typeId, Storage::Synchronization::FunctionDeclarations &functionsDeclarations) { + NanotraceHR::Tracer tracer{"synchronize function declaration"_t, projectStorageCategory}; + std::sort(functionsDeclarations.begin(), functionsDeclarations.end(), [](auto &&first, auto &&second) { @@ -2037,6 +2180,8 @@ private: void synchronizeSignalDeclarations(TypeId typeId, Storage::Synchronization::SignalDeclarations &signalDeclarations) { + NanotraceHR::Tracer tracer{"synchronize signal declaration"_t, projectStorageCategory}; + std::sort(signalDeclarations.begin(), signalDeclarations.end(), [](auto &&first, auto &&second) { auto compare = Sqlite::compare(first.name, second.name); @@ -2111,6 +2256,8 @@ private: void synchronizeEnumerationDeclarations( TypeId typeId, Storage::Synchronization::EnumerationDeclarations &enumerationDeclarations) { + NanotraceHR::Tracer tracer{"synchronize enumeation declaration"_t, projectStorageCategory}; + std::sort(enumerationDeclarations.begin(), enumerationDeclarations.end(), [](auto &&first, auto &&second) { @@ -2183,6 +2330,8 @@ private: AliasPropertyDeclarations &updatedAliasPropertyDeclarations, PropertyDeclarationIds &propertyDeclarationIds) { + NanotraceHR::Tracer tracer{"synchronize declaration per type"_t, projectStorageCategory}; + if (type.changeLevel == Storage::Synchronization::ChangeLevel::Minimal) return; @@ -2200,6 +2349,8 @@ private: template<typename Relinkable, typename Ids, typename Compare> void removeRelinkableEntries(std::vector<Relinkable> &relinkables, Ids &ids, Compare compare) { + NanotraceHR::Tracer tracer{"remove relinkable entries"_t, projectStorageCategory}; + std::vector<Relinkable> newRelinkables; newRelinkables.reserve(relinkables.size()); @@ -2222,6 +2373,8 @@ private: AliasPropertyDeclarations &updatedAliasPropertyDeclarations, PropertyDeclarations &relinkablePropertyDeclarations) { + NanotraceHR::Tracer tracer{"synchronize declaration"_t, projectStorageCategory}; + PropertyDeclarationIds propertyDeclarationIds; propertyDeclarationIds.reserve(types.size() * 10); @@ -2250,6 +2403,8 @@ private: void syncDefaultProperties(Storage::Synchronization::Types &types) { + NanotraceHR::Tracer tracer{"synchronize default properties"_t, projectStorageCategory}; + auto range = selectTypesWithDefaultPropertyStatement.template range<TypeWithDefaultPropertyView>(); auto compareKey = [](const TypeWithDefaultPropertyView &view, @@ -2284,6 +2439,8 @@ private: void resetDefaultPropertiesIfChanged(Storage::Synchronization::Types &types) { + NanotraceHR::Tracer tracer{"reset changed default properties"_t, projectStorageCategory}; + auto range = selectTypesWithDefaultPropertyStatement.template range<TypeWithDefaultPropertyView>(); auto compareKey = [](const TypeWithDefaultPropertyView &view, @@ -2382,6 +2539,8 @@ private: Prototypes &relinkablePrototypes, Prototypes &relinkableExtensions) { + NanotraceHR::Tracer tracer{"synchronize prototypes"_t, projectStorageCategory}; + TypeIds typeIds; typeIds.reserve(types.size()); |