forked from qt-creator/qt-creator
QmlDesigner: Merge tracing categories
Meta info tracing is merged to model tracing category. Change-Id: Ib6f0f5338b18b4d14e6fd63786e81f7a0b89ce79 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -28,10 +28,6 @@ env_with_default("QTC_ENABLE_MODEL_TRACING" ENV_QTC_ENABLE_MODEL_TRACING OFF)
|
|||||||
option(ENABLE_MODEL_TRACING "Enable model tracing" ${ENV_QTC_ENABLE_MODEL_TRACING})
|
option(ENABLE_MODEL_TRACING "Enable model tracing" ${ENV_QTC_ENABLE_MODEL_TRACING})
|
||||||
add_feature_info("Model tracing" ${ENABLE_MODEL_TRACING} "")
|
add_feature_info("Model tracing" ${ENABLE_MODEL_TRACING} "")
|
||||||
|
|
||||||
env_with_default("QTC_ENABLE_METAINFO_TRACING" ENV_QTC_ENABLE_METAINFO_TRACING OFF)
|
|
||||||
option(ENABLE_METAINFO_TRACING "Enable meta info tracing" ${ENV_QTC_ENABLE_METAINFO_TRACING})
|
|
||||||
add_feature_info("Meta info tracing" ${ENABLE_METAINFO_TRACING} "")
|
|
||||||
|
|
||||||
env_with_default("QDS_DESIGNVIEWER_USE_STAGING" ENV_QDS_DESIGNVIEWER_USE_STAGING OFF)
|
env_with_default("QDS_DESIGNVIEWER_USE_STAGING" ENV_QDS_DESIGNVIEWER_USE_STAGING OFF)
|
||||||
option(QDS_DESIGNVIEWER_USE_STAGING "Use staging API URL for Design Viewer" ${ENV_QDS_DESIGNVIEWER_USE_STAGING})
|
option(QDS_DESIGNVIEWER_USE_STAGING "Use staging API URL for Design Viewer" ${ENV_QDS_DESIGNVIEWER_USE_STAGING})
|
||||||
add_feature_info("Use staging API URL for Design Viewer" ${QDS_DESIGNVIEWER_USE_STAGING} "")
|
add_feature_info("Use staging API URL for Design Viewer" ${QDS_DESIGNVIEWER_USE_STAGING} "")
|
||||||
|
@@ -49,16 +49,14 @@ extend_qtc_library(QmlDesignerCore
|
|||||||
)
|
)
|
||||||
|
|
||||||
extend_qtc_library(QmlDesignerCore
|
extend_qtc_library(QmlDesignerCore
|
||||||
CONDITION ENABLE_PROJECT_STORAGE_TRACING OR ENABLE_SOURCE_PATH_STORAGE_TRACING OR ENABLE_IMAGE_CACHE_TRACING OR ENABLE_MODEL_TRACING OR ENABLE_METAINFO_TRACING
|
CONDITION ENABLE_PROJECT_STORAGE_TRACING OR ENABLE_SOURCE_PATH_STORAGE_TRACING OR ENABLE_IMAGE_CACHE_TRACING OR ENABLE_MODEL_TRACING
|
||||||
PUBLIC_DEPENDS Nanotrace
|
PUBLIC_DEPENDS Nanotrace
|
||||||
PUBLIC_DEFINES
|
PUBLIC_DEFINES
|
||||||
ENABLE_QMLDESIGNER_TRACING
|
ENABLE_QMLDESIGNER_TRACING
|
||||||
DEFINES
|
|
||||||
$<$<BOOL:${ENABLE_PROJECT_STORAGE_TRACING}>:ENABLE_PROJECT_STORAGE_TRACING>
|
$<$<BOOL:${ENABLE_PROJECT_STORAGE_TRACING}>:ENABLE_PROJECT_STORAGE_TRACING>
|
||||||
$<$<BOOL:${ENABLE_SOURCE_PATH_STORAGE_TRACING}>:ENABLE_SOURCE_PATH_STORAGE_TRACING>
|
$<$<BOOL:${ENABLE_SOURCE_PATH_STORAGE_TRACING}>:ENABLE_SOURCE_PATH_STORAGE_TRACING>
|
||||||
$<$<BOOL:${ENABLE_IMAGE_CACHE_TRACING}>:ENABLE_IMAGE_CACHE_TRACING>
|
$<$<BOOL:${ENABLE_IMAGE_CACHE_TRACING}>:ENABLE_IMAGE_CACHE_TRACING>
|
||||||
$<$<BOOL:${ENABLE_MODEL_TRACING}>:ENABLE_MODEL_TRACING>
|
$<$<BOOL:${ENABLE_MODEL_TRACING}>:ENABLE_MODEL_TRACING>
|
||||||
$<$<BOOL:${ENABLE_METAINFO_TRACING}>:ENABLE_METAINFO_TRACING>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
extend_qtc_library(QmlDesignerCore
|
extend_qtc_library(QmlDesignerCore
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#include <projectstorage/projectstorageinterface.h>
|
#include <projectstorage/projectstorageinterface.h>
|
||||||
#include <projectstorage/projectstoragetypes.h>
|
#include <projectstorage/projectstoragetypes.h>
|
||||||
#include <projectstorageids.h>
|
#include <projectstorageids.h>
|
||||||
#include <sqlite/sourcelocation.h>
|
#include <tracing/qmldesignertracingsourcelocation.h>
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -35,38 +35,7 @@ enum class MetaInfoType { None, Reference, Value, Sequence };
|
|||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT NodeMetaInfo
|
class QMLDESIGNERCORE_EXPORT NodeMetaInfo
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_PROJECT_STORAGE_TRACING
|
using SL = ModelTracing::SourceLocation;
|
||||||
class SL : public Sqlite::source_location
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
consteval SL(const char *fileName = __builtin_FILE(),
|
|
||||||
const char *functionName = __builtin_FUNCTION(),
|
|
||||||
const uint_least32_t line = __builtin_LINE())
|
|
||||||
: Sqlite::source_location(Sqlite::source_location::current(fileName, functionName, line))
|
|
||||||
{}
|
|
||||||
|
|
||||||
template<typename String>
|
|
||||||
friend void convertToString(String &string, SL sourceLocation)
|
|
||||||
{
|
|
||||||
using NanotraceHR::dictonary;
|
|
||||||
using NanotraceHR::keyValue;
|
|
||||||
auto dict = dictonary(keyValue("file", sourceLocation.file_name()),
|
|
||||||
keyValue("function", sourceLocation.function_name()),
|
|
||||||
keyValue("line", sourceLocation.line()));
|
|
||||||
convertToString(string, dict);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#else
|
|
||||||
class SL
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template<typename String>
|
|
||||||
friend void convertToString(String &, SL)
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using NodeMetaInfos = std::vector<NodeMetaInfo>;
|
using NodeMetaInfos = std::vector<NodeMetaInfo>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -38,7 +38,7 @@ namespace {
|
|||||||
|
|
||||||
using Storage::ModuleKind;
|
using Storage::ModuleKind;
|
||||||
|
|
||||||
auto category = MetaInfoTracing::category;
|
auto category = ModelTracing::category;
|
||||||
|
|
||||||
struct TypeDescription
|
struct TypeDescription
|
||||||
{
|
{
|
||||||
@@ -2537,7 +2537,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo, [[maybe_unused]] SL s
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"is based on",
|
NanotraceHR::Tracer tracer{"is based on 1 node meta info",
|
||||||
category(),
|
category(),
|
||||||
keyValue("type id", m_typeId),
|
keyValue("type id", m_typeId),
|
||||||
keyValue("meta info type id", metaInfo.m_typeId),
|
keyValue("meta info type id", metaInfo.m_typeId),
|
||||||
@@ -2562,7 +2562,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"is based on",
|
NanotraceHR::Tracer tracer{"is based on 2 node meta infos",
|
||||||
category(),
|
category(),
|
||||||
keyValue("type id", m_typeId),
|
keyValue("type id", m_typeId),
|
||||||
keyValue("caller location", sl)};
|
keyValue("caller location", sl)};
|
||||||
@@ -2589,7 +2589,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"is based on",
|
NanotraceHR::Tracer tracer{"is based on 3 node meta infos",
|
||||||
category(),
|
category(),
|
||||||
keyValue("type id", m_typeId),
|
keyValue("type id", m_typeId),
|
||||||
keyValue("caller location", sl)};
|
keyValue("caller location", sl)};
|
||||||
@@ -2622,7 +2622,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"is based on",
|
NanotraceHR::Tracer tracer{"is based on 4 node meta infos",
|
||||||
category(),
|
category(),
|
||||||
keyValue("type id", m_typeId),
|
keyValue("type id", m_typeId),
|
||||||
keyValue("caller location", sl)};
|
keyValue("caller location", sl)};
|
||||||
@@ -2655,7 +2655,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"is based on",
|
NanotraceHR::Tracer tracer{"is based on 5 node meta infos",
|
||||||
category(),
|
category(),
|
||||||
keyValue("type id", m_typeId),
|
keyValue("type id", m_typeId),
|
||||||
keyValue("caller location", sl)};
|
keyValue("caller location", sl)};
|
||||||
@@ -2691,7 +2691,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"is based on",
|
NanotraceHR::Tracer tracer{"is based on 6 node meta infos",
|
||||||
category(),
|
category(),
|
||||||
keyValue("type id", m_typeId),
|
keyValue("type id", m_typeId),
|
||||||
keyValue("caller location", sl)};
|
keyValue("caller location", sl)};
|
||||||
@@ -2730,7 +2730,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"is based on",
|
NanotraceHR::Tracer tracer{"is based on 7 node meta infos",
|
||||||
category(),
|
category(),
|
||||||
keyValue("type id", m_typeId),
|
keyValue("type id", m_typeId),
|
||||||
keyValue("caller location", sl)};
|
keyValue("caller location", sl)};
|
||||||
|
@@ -98,14 +98,4 @@ Category &category()
|
|||||||
return category_;
|
return category_;
|
||||||
}
|
}
|
||||||
} // namespace SourcePathStorageTracing
|
} // namespace SourcePathStorageTracing
|
||||||
|
|
||||||
namespace MetaInfoTracing {
|
|
||||||
Category &category()
|
|
||||||
{
|
|
||||||
thread_local Category category_{"meta info", Tracing::eventQueueWithStringArguments(), category};
|
|
||||||
|
|
||||||
return category_;
|
|
||||||
}
|
|
||||||
} // namespace MetaInfoTracing
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -78,20 +78,4 @@ using Category = NanotraceHR::StringViewWithStringArgumentsCategory<tracingStatu
|
|||||||
[[gnu::pure]] Category &category();
|
[[gnu::pure]] Category &category();
|
||||||
|
|
||||||
} // namespace SourcePathStorageTracing
|
} // namespace SourcePathStorageTracing
|
||||||
|
|
||||||
namespace MetaInfoTracing {
|
|
||||||
constexpr NanotraceHR::Tracing tracingStatus()
|
|
||||||
{
|
|
||||||
#ifdef ENABLE_METAINFO_TRACING
|
|
||||||
return NanotraceHR::Tracing::IsEnabled;
|
|
||||||
#else
|
|
||||||
return NanotraceHR::Tracing::IsDisabled;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
using Category = NanotraceHR::StringViewWithStringArgumentsCategory<tracingStatus()>;
|
|
||||||
|
|
||||||
[[gnu::pure]] Category &category();
|
|
||||||
|
|
||||||
} // namespace MetaInfoTracing
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -0,0 +1,56 @@
|
|||||||
|
// Copyright (C) 2025 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <nanotrace/nanotracehr.h>
|
||||||
|
#include <sqlite/sourcelocation.h>
|
||||||
|
|
||||||
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
namespace ModelTracing {
|
||||||
|
|
||||||
|
#ifdef ENABLE_MODEL_TRACING
|
||||||
|
class SourceLocation : public Sqlite::source_location
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
consteval SourceLocation(const char *fileName = __builtin_FILE(),
|
||||||
|
const char *functionName = __builtin_FUNCTION(),
|
||||||
|
const uint_least32_t line = __builtin_LINE())
|
||||||
|
: Sqlite::source_location(Sqlite::source_location::current(fileName, functionName, line))
|
||||||
|
{}
|
||||||
|
|
||||||
|
template<typename String>
|
||||||
|
friend void convertToString(String &string, SourceLocation sourceLocation)
|
||||||
|
{
|
||||||
|
using NanotraceHR::dictonary;
|
||||||
|
using NanotraceHR::keyValue;
|
||||||
|
auto dict = dictonary(keyValue("file", sourceLocation.file_name()),
|
||||||
|
keyValue("function", sourceLocation.function_name()),
|
||||||
|
keyValue("line", sourceLocation.line()));
|
||||||
|
convertToString(string, dict);
|
||||||
|
|
||||||
|
string.append(',');
|
||||||
|
convertToString(string, "id");
|
||||||
|
string.append(':');
|
||||||
|
string.append('\"');
|
||||||
|
string.append(sourceLocation.file_name());
|
||||||
|
string.append(':');
|
||||||
|
string.append(sourceLocation.line());
|
||||||
|
string.append('\"');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class SourceLocation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
template<typename String>
|
||||||
|
friend void convertToString(String &, SourceLocation)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace ModelTracing
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
Reference in New Issue
Block a user