/usr/include/obs/util/profiler.hpp is in libobs-dev 21.0.2+dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #pragma once
#include "profiler.h"
struct ScopeProfiler {
const char *name;
bool enabled = true;
ScopeProfiler(const char *name)
: name(name)
{
profile_start(name);
}
~ScopeProfiler() { Stop(); }
ScopeProfiler(const ScopeProfiler &) = delete;
ScopeProfiler(ScopeProfiler &&other)
: name(other.name),
enabled(other.enabled)
{
other.enabled = false;
}
ScopeProfiler &operator=(const ScopeProfiler &) = delete;
ScopeProfiler &operator=(ScopeProfiler &&other) = delete;
void Stop()
{
if (!enabled)
return;
profile_end(name);
enabled = false;
}
};
#ifndef NO_PROFILER_MACROS
#define ScopeProfiler_NameConcatImpl(x, y) x ## y
#define ScopeProfiler_NameConcat(x, y) ScopeProfiler_NameConcatImpl(x, y)
#ifdef __COUNTER__
#define ScopeProfiler_Name(x) ScopeProfiler_NameConcat(x, __COUNTER__)
#else
#define ScopeProfiler_Name(x) ScopeProfiler_NameConcat(x, __LINE__)
#endif
#define ProfileScope(x) ScopeProfiler \
ScopeProfiler_Name(SCOPE_PROFILE){x}
#endif
|