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