Fix build error on MacOS

This commit is contained in:
ksuprynowicz 2022-08-20 20:02:55 +02:00
parent 7a84f7ee4d
commit 716a02495e
3 changed files with 25 additions and 25 deletions

View file

@ -48,15 +48,15 @@ static bool tracingEnabled() {
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,
uint32_t argbColor,
uint64_t payload,
const QVariantMap& baseArgs) :
DurationBase(category, name) {
ProfileDurationBase(category, name) {
if (tracingEnabled() && category.isDebugEnabled()) {
QVariantMap args = baseArgs;
args["nv_payload"] = QVariant::fromValue(payload);
@ -78,7 +78,7 @@ Duration::Duration(const QLoggingCategory& category,
}
}
Duration::~Duration() {
ProfileDuration::~ProfileDuration() {
if (tracingEnabled() && _category.isDebugEnabled()) {
tracing::traceEvent(_category, _name, tracing::DurationEnd);
#ifdef NSIGHT_TRACING
@ -88,7 +88,7 @@ Duration::~Duration() {
}
// 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
if (tracingEnabled() && category.isDebugEnabled()) {
nvtxEventAttributes_t eventAttrib = { 0 };
@ -105,7 +105,7 @@ uint64_t Duration::beginRange(const QLoggingCategory& category, const char* name
}
// FIXME
void Duration::endRange(const QLoggingCategory& category, uint64_t rangeId) {
void ProfileDuration::endRange(const QLoggingCategory& category, uint64_t rangeId) {
#ifdef NSIGHT_TRACING
if (tracingEnabled() && category.isDebugEnabled()) {
nvtxRangeEnd(rangeId);
@ -113,11 +113,11 @@ void Duration::endRange(const QLoggingCategory& category, uint64_t rangeId) {
#endif
}
ConditionalDuration::ConditionalDuration(const QLoggingCategory& category, const QString& name, uint32_t minTime) :
DurationBase(category, name), _startTime(tracing::Tracer::now()), _minTime(minTime * USECS_PER_MSEC) {
ConditionalProfileDuration::ConditionalProfileDuration(const QLoggingCategory& category, const QString& name, uint32_t minTime) :
ProfileDurationBase(category, name), _startTime(tracing::Tracer::now()), _minTime(minTime * USECS_PER_MSEC) {
}
ConditionalDuration::~ConditionalDuration() {
ConditionalProfileDuration::~ConditionalProfileDuration() {
if (tracingEnabled() && _category.isDebugEnabled()) {
auto endTime = tracing::Tracer::now();
auto duration = endTime - _startTime;

View file

@ -37,27 +37,27 @@ Q_DECLARE_LOGGING_CATEGORY(trace_startup)
Q_DECLARE_LOGGING_CATEGORY(trace_workload)
Q_DECLARE_LOGGING_CATEGORY(trace_baker)
class DurationBase {
class ProfileDurationBase {
protected:
DurationBase(const QLoggingCategory& category, const QString& name);
ProfileDurationBase(const QLoggingCategory& category, const QString& name);
const QString _name;
const QLoggingCategory& _category;
};
class Duration : public DurationBase {
class ProfileDuration : public ProfileDurationBase {
public:
Duration(const QLoggingCategory& category, const QString& name, uint32_t argbColor = 0xff0000ff, uint64_t payload = 0, const QVariantMap& args = QVariantMap());
~Duration();
ProfileDuration(const QLoggingCategory& category, const QString& name, uint32_t argbColor = 0xff0000ff, uint64_t payload = 0, const QVariantMap& args = QVariantMap());
~ProfileDuration();
static uint64_t beginRange(const QLoggingCategory& category, const char* name, uint32_t argbColor);
static void endRange(const QLoggingCategory& category, uint64_t rangeId);
};
class ConditionalDuration : public DurationBase {
class ConditionalProfileDuration : public ProfileDurationBase {
public:
ConditionalDuration(const QLoggingCategory& category, const QString& name, uint32_t minTime);
~ConditionalDuration();
ConditionalProfileDuration(const QLoggingCategory& category, const QString& name, uint32_t minTime);
~ConditionalProfileDuration();
private:
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);
}
#define PROFILE_RANGE(category, name) Duration profileRangeThis(trace_##category(), name);
#define PROFILE_RANGE_IF_LONGER(category, name, ms) ConditionalDuration 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_BEGIN(category, rangeId, name, argbColor) rangeId = Duration::beginRange(trace_##category(), name, argbColor)
#define PROFILE_RANGE_END(category, rangeId) Duration::endRange(trace_##category(), rangeId)
#define PROFILE_RANGE(category, name) ProfileDuration profileRangeThis(trace_##category(), name);
#define PROFILE_RANGE_IF_LONGER(category, name, ms) ConditionalProfileDuration profileRangeThis(trace_##category(), name, ms);
#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 = ProfileDuration::beginRange(trace_##category(), name, argbColor)
#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_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__);
@ -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
//#define WANT_DETAILED_PROFILING
#ifdef WANT_DETAILED_PROFILING
#define DETAILED_PROFILE_RANGE(category, name) Duration 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(category, name) ProfileDuration profileRangeThis(trace_##category(), name);
#define DETAILED_PROFILE_RANGE_EX(category, name, argbColor, payload, ...) ProfileDuration profileRangeThis(trace_##category(), name, argbColor, (uint64_t)payload, ##__VA_ARGS__);
#else // WANT_DETAILED_PROFILING
#define DETAILED_PROFILE_RANGE(category, name) ; // no-op
#define DETAILED_PROFILE_RANGE_EX(category, name, argbColor, payload, ...) ; // no-op

View file

@ -559,7 +559,7 @@ protected:
class className : public PerformanceTimer { \
public: \
className(const std::string& label) : PerformanceTimer(label.c_str()), profileRange(category(), label.c_str()) {} \
Duration profileRange; \
ProfileDuration profileRange; \
};
#endif // hifi_task_Task_h