forked from qt-creator/qt-creator
Nanotracer: Simplify templates
Change-Id: Iec6e80ec7622b9fc9162c6852d3736e505c8feff Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -50,12 +50,6 @@ constexpr bool isArgumentValid(const ArgumentsString &string)
|
|||||||
return string.isValid() && string.size();
|
return string.isValid() && string.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename String>
|
|
||||||
constexpr bool isArgumentValid(const String &string)
|
|
||||||
{
|
|
||||||
return string.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename TraceEvent>
|
template<typename TraceEvent>
|
||||||
void printEvent(std::ostream &out, const TraceEvent &event, qint64 processId, std::thread::id threadId)
|
void printEvent(std::ostream &out, const TraceEvent &event, qint64 processId, std::thread::id threadId)
|
||||||
{
|
{
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -543,10 +543,10 @@ public:
|
|||||||
using TracerCategory = std::decay_t<decltype(sqliteHighLevelCategory())>;
|
using TracerCategory = std::decay_t<decltype(sqliteHighLevelCategory())>;
|
||||||
StatementImplementation &m_statement;
|
StatementImplementation &m_statement;
|
||||||
const source_location &m_sourceLocation;
|
const source_location &m_sourceLocation;
|
||||||
NanotraceHR::Tracer<TracerCategory, typename TracerCategory::IsActive> tracer{
|
NanotraceHR::Tracer<TracerCategory> tracer{"range",
|
||||||
"range",
|
|
||||||
sqliteHighLevelCategory(),
|
sqliteHighLevelCategory(),
|
||||||
NanotraceHR::keyValue("sqlite statement", m_statement.handle())};
|
NanotraceHR::keyValue("sqlite statement",
|
||||||
|
m_statement.handle())};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename ResultType>
|
template<typename ResultType>
|
||||||
|
@@ -25,8 +25,8 @@ public:
|
|||||||
|
|
||||||
~TaskQueue() { destroy(); }
|
~TaskQueue() { destroy(); }
|
||||||
|
|
||||||
template<typename TraceEvent, NanotraceHR::Tracing isEnabled, typename... Arguments>
|
template<typename Category, typename... Arguments>
|
||||||
void addTask(NanotraceHR::Token<TraceEvent, isEnabled> traceToken, Arguments &&...arguments)
|
void addTask(NanotraceHR::Token<Category> traceToken, Arguments &&...arguments)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::unique_lock lock{m_mutex};
|
std::unique_lock lock{m_mutex};
|
||||||
|
@@ -20,17 +20,17 @@ namespace ImageCache {
|
|||||||
#ifdef ENABLE_IMAGE_CACHE_TRACING
|
#ifdef ENABLE_IMAGE_CACHE_TRACING
|
||||||
|
|
||||||
using Category = NanotraceHR::EnabledCategory;
|
using Category = NanotraceHR::EnabledCategory;
|
||||||
using TraceToken = Category::FlowTokenType;
|
using TraceToken = NanotraceHR::EnabledFlowToken;
|
||||||
using FlowToken = Category::FlowTokenType;
|
using FlowToken = NanotraceHR::EnabledFlowToken;
|
||||||
using Token = Category::TokenType;
|
using Token = NanotraceHR::EnabledToken;
|
||||||
[[gnu::pure]] QMLDESIGNERCORE_EXPORT Category &category();
|
[[gnu::pure]] QMLDESIGNERCORE_EXPORT Category &category();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
using Category = NanotraceHR::DisabledCategory;
|
using Category = NanotraceHR::DisabledCategory;
|
||||||
using TraceToken = Category::FlowTokenType;
|
using TraceToken = NanotraceHR::DisabledFlowToken;
|
||||||
using FlowToken = Category::FlowTokenType;
|
using FlowToken = NanotraceHR::DisabledFlowToken;
|
||||||
using Token = Category::TokenType;
|
using Token = NanotraceHR::DisabledToken;
|
||||||
|
|
||||||
inline Category category()
|
inline Category category()
|
||||||
{
|
{
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
int majorVersion,
|
int majorVersion,
|
||||||
int minorVersion,
|
int minorVersion,
|
||||||
qint32 internalId,
|
qint32 internalId,
|
||||||
ModelTracing::Category::FlowTokenType flowTraceToken)
|
ModelTracing::FlowToken flowTraceToken)
|
||||||
: typeName(typeName.toByteArray())
|
: typeName(typeName.toByteArray())
|
||||||
, majorVersion(majorVersion)
|
, majorVersion(majorVersion)
|
||||||
, minorVersion(minorVersion)
|
, minorVersion(minorVersion)
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
constexpr auto category = ProjectStorageTracing::projectStorageUpdaterCategory;
|
constexpr auto category = ProjectStorageTracing::projectStorageUpdaterCategory;
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
using Tracer = ProjectStorageTracing::Category::TracerType;
|
using Tracer = NanotraceHR::Tracer<ProjectStorageTracing::Category>;
|
||||||
|
|
||||||
template<typename String>
|
template<typename String>
|
||||||
void convertToString(String &string, const ProjectStorageUpdater::FileState &state)
|
void convertToString(String &string, const ProjectStorageUpdater::FileState &state)
|
||||||
|
@@ -168,7 +168,7 @@ private:
|
|||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIds &WatchedSourceIds,
|
WatchedSourceIds &WatchedSourceIds,
|
||||||
IsInsideProject isInsideProject,
|
IsInsideProject isInsideProject,
|
||||||
ProjectStorageTracing::Category::TracerType &tracer);
|
NanotraceHR::Tracer<ProjectStorageTracing::Category> &tracer);
|
||||||
void annotationDirectoryChanged(Utils::SmallStringView directoryPath,
|
void annotationDirectoryChanged(Utils::SmallStringView directoryPath,
|
||||||
DirectoryPathId directoryId,
|
DirectoryPathId directoryId,
|
||||||
DirectoryPathId annotationDirectoryId,
|
DirectoryPathId annotationDirectoryId,
|
||||||
|
@@ -26,7 +26,7 @@ namespace QmlDesigner {
|
|||||||
constexpr auto category = ProjectStorageTracing::projectStorageUpdaterCategory;
|
constexpr auto category = ProjectStorageTracing::projectStorageUpdaterCategory;
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
using Storage::IsInsideProject;
|
using Storage::IsInsideProject;
|
||||||
using Tracer = ProjectStorageTracing::Category::TracerType;
|
using Tracer = NanotraceHR::Tracer<ProjectStorageTracing::Category>;
|
||||||
|
|
||||||
namespace QmlDom = QQmlJS::Dom;
|
namespace QmlDom = QQmlJS::Dom;
|
||||||
namespace Synchronization = Storage::Synchronization;
|
namespace Synchronization = Storage::Synchronization;
|
||||||
|
@@ -28,7 +28,7 @@ namespace QmlDesigner {
|
|||||||
constexpr auto category = ProjectStorageTracing::projectStorageUpdaterCategory;
|
constexpr auto category = ProjectStorageTracing::projectStorageUpdaterCategory;
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
using Storage::IsInsideProject;
|
using Storage::IsInsideProject;
|
||||||
using Tracer = ProjectStorageTracing::Category::TracerType;
|
using Tracer = NanotraceHR::Tracer<ProjectStorageTracing::Category>;
|
||||||
using Storage::ModuleKind;
|
using Storage::ModuleKind;
|
||||||
namespace QmlDom = QQmlJS::Dom;
|
namespace QmlDom = QQmlJS::Dom;
|
||||||
|
|
||||||
|
@@ -9,10 +9,10 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
using namespace NanotraceHR::Literals;
|
using namespace NanotraceHR::Literals;
|
||||||
|
|
||||||
#ifdef ENABLE_QMLDESIGNER_TRACING
|
|
||||||
|
|
||||||
namespace Tracing {
|
namespace Tracing {
|
||||||
|
|
||||||
|
#ifdef ENABLE_QMLDESIGNER_TRACING
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using TraceFile = NanotraceHR::EnabledTraceFile;
|
using TraceFile = NanotraceHR::EnabledTraceFile;
|
||||||
@@ -42,11 +42,13 @@ EventQueueWithoutArguments &eventQueueWithoutArguments()
|
|||||||
return eventQueue;
|
return eventQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace Tracing
|
} // namespace Tracing
|
||||||
|
|
||||||
namespace ModelTracing {
|
namespace ModelTracing {
|
||||||
|
|
||||||
# ifdef ENABLE_MODEL_TRACING
|
#ifdef ENABLE_MODEL_TRACING
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -62,13 +64,13 @@ Category &category()
|
|||||||
return category_;
|
return category_;
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
} // namespace ModelTracing
|
} // namespace ModelTracing
|
||||||
|
|
||||||
namespace ProjectStorageTracing {
|
namespace ProjectStorageTracing {
|
||||||
|
|
||||||
# ifdef ENABLE_PROJECT_STORAGE_TRACING
|
#ifdef ENABLE_PROJECT_STORAGE_TRACING
|
||||||
|
|
||||||
Category &projectStorageCategory()
|
Category &projectStorageCategory()
|
||||||
{
|
{
|
||||||
@@ -90,13 +92,13 @@ Category &projectStorageUpdaterCategory()
|
|||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
} // namespace ProjectStorageTracing
|
} // namespace ProjectStorageTracing
|
||||||
|
|
||||||
namespace SourcePathStorageTracing {
|
namespace SourcePathStorageTracing {
|
||||||
|
|
||||||
# ifdef ENABLE_SOURCE_PATH_STORAGE_TRACING
|
#ifdef ENABLE_SOURCE_PATH_STORAGE_TRACING
|
||||||
|
|
||||||
Category &category()
|
Category &category()
|
||||||
{
|
{
|
||||||
@@ -108,10 +110,8 @@ Category &category()
|
|||||||
return category_;
|
return category_;
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
} // namespace SourcePathStorageTracing
|
} // namespace SourcePathStorageTracing
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -28,14 +28,16 @@ namespace ModelTracing {
|
|||||||
|
|
||||||
using Category = NanotraceHR::EnabledCategory;
|
using Category = NanotraceHR::EnabledCategory;
|
||||||
using SourceLocation = Category::SourceLocation;
|
using SourceLocation = Category::SourceLocation;
|
||||||
using AsynchronousToken = Category::AsynchronousTokenType;
|
using AsynchronousToken = NanotraceHR::EnabledAsynchronousToken;
|
||||||
|
using FlowToken = NanotraceHR::EnabledFlowToken;
|
||||||
[[gnu::pure]] QMLDESIGNERCORE_EXPORT Category &category();
|
[[gnu::pure]] QMLDESIGNERCORE_EXPORT Category &category();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
using Category = NanotraceHR::DisabledCategory;
|
using Category = NanotraceHR::DisabledCategory;
|
||||||
using SourceLocation = Category::SourceLocation;
|
using SourceLocation = Category::SourceLocation;
|
||||||
using AsynchronousToken = Category::AsynchronousTokenType;
|
using AsynchronousToken = NanotraceHR::DisabledAsynchronousToken;
|
||||||
|
using FlowToken = NanotraceHR::DisabledFlowToken;
|
||||||
|
|
||||||
inline Category category()
|
inline Category category()
|
||||||
{
|
{
|
||||||
|
@@ -26,8 +26,6 @@ auto IsTask(Matcher matcher)
|
|||||||
|
|
||||||
class TaskQueue : public testing::Test
|
class TaskQueue : public testing::Test
|
||||||
{
|
{
|
||||||
using Category = NanotraceHR::DisabledCategory;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Notification notification;
|
Notification notification;
|
||||||
Notification waitInThread;
|
Notification waitInThread;
|
||||||
@@ -36,7 +34,7 @@ protected:
|
|||||||
using Queue = QmlDesigner::TaskQueue<Task,
|
using Queue = QmlDesigner::TaskQueue<Task,
|
||||||
decltype(mockDispatchCallback.AsStdFunction()),
|
decltype(mockDispatchCallback.AsStdFunction()),
|
||||||
decltype(mockCleanCallback.AsStdFunction())>;
|
decltype(mockCleanCallback.AsStdFunction())>;
|
||||||
NanotraceHR::Token<Category, NanotraceHR::Tracing::IsDisabled> dummyToken;
|
NanotraceHR::DisabledToken dummyToken;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(TaskQueue, add_task_dispatches_task)
|
TEST_F(TaskQueue, add_task_dispatches_task)
|
||||||
|
Reference in New Issue
Block a user