mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 17:00:13 +02:00
Fix build error on MacOS
This commit is contained in:
parent
7a84f7ee4d
commit
716a02495e
3 changed files with 25 additions and 25 deletions
|
@ -48,15 +48,15 @@ static bool tracingEnabled() {
|
||||||
return (tracer && tracer->isEnabled());
|
return (tracer && tracer->isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
DurationBase::DurationBase(const QLoggingCategory& category, const QString& name) : _name(name), _category(category) {
|
ProfileDurationBase::ProfileDurationBase(const QLoggingCategory& category, const QString& name) : _name(name), _category(category) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Duration::Duration(const QLoggingCategory& category,
|
ProfileDuration::ProfileDuration(const QLoggingCategory& category,
|
||||||
const QString& name,
|
const QString& name,
|
||||||
uint32_t argbColor,
|
uint32_t argbColor,
|
||||||
uint64_t payload,
|
uint64_t payload,
|
||||||
const QVariantMap& baseArgs) :
|
const QVariantMap& baseArgs) :
|
||||||
DurationBase(category, name) {
|
ProfileDurationBase(category, name) {
|
||||||
if (tracingEnabled() && category.isDebugEnabled()) {
|
if (tracingEnabled() && category.isDebugEnabled()) {
|
||||||
QVariantMap args = baseArgs;
|
QVariantMap args = baseArgs;
|
||||||
args["nv_payload"] = QVariant::fromValue(payload);
|
args["nv_payload"] = QVariant::fromValue(payload);
|
||||||
|
@ -78,7 +78,7 @@ Duration::Duration(const QLoggingCategory& category,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Duration::~Duration() {
|
ProfileDuration::~ProfileDuration() {
|
||||||
if (tracingEnabled() && _category.isDebugEnabled()) {
|
if (tracingEnabled() && _category.isDebugEnabled()) {
|
||||||
tracing::traceEvent(_category, _name, tracing::DurationEnd);
|
tracing::traceEvent(_category, _name, tracing::DurationEnd);
|
||||||
#ifdef NSIGHT_TRACING
|
#ifdef NSIGHT_TRACING
|
||||||
|
@ -88,7 +88,7 @@ Duration::~Duration() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
uint64_t Duration::beginRange(const QLoggingCategory& category, const char* name, uint32_t argbColor) {
|
uint64_t ProfileDuration::beginRange(const QLoggingCategory& category, const char* name, uint32_t argbColor) {
|
||||||
#ifdef NSIGHT_TRACING
|
#ifdef NSIGHT_TRACING
|
||||||
if (tracingEnabled() && category.isDebugEnabled()) {
|
if (tracingEnabled() && category.isDebugEnabled()) {
|
||||||
nvtxEventAttributes_t eventAttrib = { 0 };
|
nvtxEventAttributes_t eventAttrib = { 0 };
|
||||||
|
@ -105,7 +105,7 @@ uint64_t Duration::beginRange(const QLoggingCategory& category, const char* name
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
void Duration::endRange(const QLoggingCategory& category, uint64_t rangeId) {
|
void ProfileDuration::endRange(const QLoggingCategory& category, uint64_t rangeId) {
|
||||||
#ifdef NSIGHT_TRACING
|
#ifdef NSIGHT_TRACING
|
||||||
if (tracingEnabled() && category.isDebugEnabled()) {
|
if (tracingEnabled() && category.isDebugEnabled()) {
|
||||||
nvtxRangeEnd(rangeId);
|
nvtxRangeEnd(rangeId);
|
||||||
|
@ -113,11 +113,11 @@ void Duration::endRange(const QLoggingCategory& category, uint64_t rangeId) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ConditionalDuration::ConditionalDuration(const QLoggingCategory& category, const QString& name, uint32_t minTime) :
|
ConditionalProfileDuration::ConditionalProfileDuration(const QLoggingCategory& category, const QString& name, uint32_t minTime) :
|
||||||
DurationBase(category, name), _startTime(tracing::Tracer::now()), _minTime(minTime * USECS_PER_MSEC) {
|
ProfileDurationBase(category, name), _startTime(tracing::Tracer::now()), _minTime(minTime * USECS_PER_MSEC) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ConditionalDuration::~ConditionalDuration() {
|
ConditionalProfileDuration::~ConditionalProfileDuration() {
|
||||||
if (tracingEnabled() && _category.isDebugEnabled()) {
|
if (tracingEnabled() && _category.isDebugEnabled()) {
|
||||||
auto endTime = tracing::Tracer::now();
|
auto endTime = tracing::Tracer::now();
|
||||||
auto duration = endTime - _startTime;
|
auto duration = endTime - _startTime;
|
||||||
|
|
|
@ -37,27 +37,27 @@ Q_DECLARE_LOGGING_CATEGORY(trace_startup)
|
||||||
Q_DECLARE_LOGGING_CATEGORY(trace_workload)
|
Q_DECLARE_LOGGING_CATEGORY(trace_workload)
|
||||||
Q_DECLARE_LOGGING_CATEGORY(trace_baker)
|
Q_DECLARE_LOGGING_CATEGORY(trace_baker)
|
||||||
|
|
||||||
class DurationBase {
|
class ProfileDurationBase {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DurationBase(const QLoggingCategory& category, const QString& name);
|
ProfileDurationBase(const QLoggingCategory& category, const QString& name);
|
||||||
const QString _name;
|
const QString _name;
|
||||||
const QLoggingCategory& _category;
|
const QLoggingCategory& _category;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Duration : public DurationBase {
|
class ProfileDuration : public ProfileDurationBase {
|
||||||
public:
|
public:
|
||||||
Duration(const QLoggingCategory& category, const QString& name, uint32_t argbColor = 0xff0000ff, uint64_t payload = 0, const QVariantMap& args = QVariantMap());
|
ProfileDuration(const QLoggingCategory& category, const QString& name, uint32_t argbColor = 0xff0000ff, uint64_t payload = 0, const QVariantMap& args = QVariantMap());
|
||||||
~Duration();
|
~ProfileDuration();
|
||||||
|
|
||||||
static uint64_t beginRange(const QLoggingCategory& category, const char* name, uint32_t argbColor);
|
static uint64_t beginRange(const QLoggingCategory& category, const char* name, uint32_t argbColor);
|
||||||
static void endRange(const QLoggingCategory& category, uint64_t rangeId);
|
static void endRange(const QLoggingCategory& category, uint64_t rangeId);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConditionalDuration : public DurationBase {
|
class ConditionalProfileDuration : public ProfileDurationBase {
|
||||||
public:
|
public:
|
||||||
ConditionalDuration(const QLoggingCategory& category, const QString& name, uint32_t minTime);
|
ConditionalProfileDuration(const QLoggingCategory& category, const QString& name, uint32_t minTime);
|
||||||
~ConditionalDuration();
|
~ConditionalProfileDuration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int64_t _startTime;
|
const int64_t _startTime;
|
||||||
|
@ -108,11 +108,11 @@ inline void metadata(const QString& metadataType, const QVariantMap& args) {
|
||||||
tracing::traceEvent(trace_metadata(), metadataType, tracing::Metadata, "", args);
|
tracing::traceEvent(trace_metadata(), metadataType, tracing::Metadata, "", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PROFILE_RANGE(category, name) Duration profileRangeThis(trace_##category(), name);
|
#define PROFILE_RANGE(category, name) ProfileDuration profileRangeThis(trace_##category(), name);
|
||||||
#define PROFILE_RANGE_IF_LONGER(category, name, ms) ConditionalDuration profileRangeThis(trace_##category(), name, ms);
|
#define PROFILE_RANGE_IF_LONGER(category, name, ms) ConditionalProfileDuration profileRangeThis(trace_##category(), name, ms);
|
||||||
#define PROFILE_RANGE_EX(category, name, argbColor, payload, ...) Duration profileRangeThis(trace_##category(), name, argbColor, (uint64_t)payload, ##__VA_ARGS__);
|
#define PROFILE_RANGE_EX(category, name, argbColor, payload, ...) ProfileDuration profileRangeThis(trace_##category(), name, argbColor, (uint64_t)payload, ##__VA_ARGS__);
|
||||||
#define PROFILE_RANGE_BEGIN(category, rangeId, name, argbColor) rangeId = Duration::beginRange(trace_##category(), name, argbColor)
|
#define PROFILE_RANGE_BEGIN(category, rangeId, name, argbColor) rangeId = ProfileDuration::beginRange(trace_##category(), name, argbColor)
|
||||||
#define PROFILE_RANGE_END(category, rangeId) Duration::endRange(trace_##category(), rangeId)
|
#define PROFILE_RANGE_END(category, rangeId) ProfileDuration::endRange(trace_##category(), rangeId)
|
||||||
#define PROFILE_SYNC_BEGIN(category, name, id, ...) syncBegin(trace_##category(), name, id, ##__VA_ARGS__);
|
#define PROFILE_SYNC_BEGIN(category, name, id, ...) syncBegin(trace_##category(), name, id, ##__VA_ARGS__);
|
||||||
#define PROFILE_SYNC_END(category, name, id, ...) syncEnd(trace_##category(), name, id, ##__VA_ARGS__);
|
#define PROFILE_SYNC_END(category, name, id, ...) syncEnd(trace_##category(), name, id, ##__VA_ARGS__);
|
||||||
#define PROFILE_ASYNC_BEGIN(category, name, id, ...) asyncBegin(trace_##category(), name, id, ##__VA_ARGS__);
|
#define PROFILE_ASYNC_BEGIN(category, name, id, ...) asyncBegin(trace_##category(), name, id, ##__VA_ARGS__);
|
||||||
|
@ -130,8 +130,8 @@ inline void metadata(const QString& metadataType, const QVariantMap& args) {
|
||||||
// uncomment WANT_DETAILED_PROFILING definition to enable profiling in high-frequency contexts
|
// uncomment WANT_DETAILED_PROFILING definition to enable profiling in high-frequency contexts
|
||||||
//#define WANT_DETAILED_PROFILING
|
//#define WANT_DETAILED_PROFILING
|
||||||
#ifdef WANT_DETAILED_PROFILING
|
#ifdef WANT_DETAILED_PROFILING
|
||||||
#define DETAILED_PROFILE_RANGE(category, name) Duration profileRangeThis(trace_##category(), name);
|
#define DETAILED_PROFILE_RANGE(category, name) ProfileDuration profileRangeThis(trace_##category(), name);
|
||||||
#define DETAILED_PROFILE_RANGE_EX(category, name, argbColor, payload, ...) Duration profileRangeThis(trace_##category(), name, argbColor, (uint64_t)payload, ##__VA_ARGS__);
|
#define DETAILED_PROFILE_RANGE_EX(category, name, argbColor, payload, ...) ProfileDuration profileRangeThis(trace_##category(), name, argbColor, (uint64_t)payload, ##__VA_ARGS__);
|
||||||
#else // WANT_DETAILED_PROFILING
|
#else // WANT_DETAILED_PROFILING
|
||||||
#define DETAILED_PROFILE_RANGE(category, name) ; // no-op
|
#define DETAILED_PROFILE_RANGE(category, name) ; // no-op
|
||||||
#define DETAILED_PROFILE_RANGE_EX(category, name, argbColor, payload, ...) ; // no-op
|
#define DETAILED_PROFILE_RANGE_EX(category, name, argbColor, payload, ...) ; // no-op
|
||||||
|
|
|
@ -559,7 +559,7 @@ protected:
|
||||||
class className : public PerformanceTimer { \
|
class className : public PerformanceTimer { \
|
||||||
public: \
|
public: \
|
||||||
className(const std::string& label) : PerformanceTimer(label.c_str()), profileRange(category(), label.c_str()) {} \
|
className(const std::string& label) : PerformanceTimer(label.c_str()), profileRange(category(), label.c_str()) {} \
|
||||||
Duration profileRange; \
|
ProfileDuration profileRange; \
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_task_Task_h
|
#endif // hifi_task_Task_h
|
||||||
|
|
Loading…
Reference in a new issue