mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:38:02 +02:00
clean up
This commit is contained in:
parent
b7b520a6e8
commit
c0e8b6c8bc
3 changed files with 18 additions and 9 deletions
|
@ -1283,7 +1283,6 @@ void ScriptEngine::timerFired() {
|
||||||
// call the associated JS function, if it exists
|
// call the associated JS function, if it exists
|
||||||
if (timerData.function.isValid()) {
|
if (timerData.function.isValid()) {
|
||||||
PROFILE_RANGE(script, __FUNCTION__);
|
PROFILE_RANGE(script, __FUNCTION__);
|
||||||
// PROFILE_RANGE(script, timerData.function.toString().toStdString().c_str());
|
|
||||||
auto preTimer = p_high_resolution_clock::now();
|
auto preTimer = p_high_resolution_clock::now();
|
||||||
callWithEnvironment(timerData.definingEntityIdentifier, timerData.definingSandboxURL, timerData.function, timerData.function, QScriptValueList());
|
callWithEnvironment(timerData.definingEntityIdentifier, timerData.definingSandboxURL, timerData.function, timerData.function, QScriptValueList());
|
||||||
auto postTimer = p_high_resolution_clock::now();
|
auto postTimer = p_high_resolution_clock::now();
|
||||||
|
@ -1396,15 +1395,11 @@ void ScriptEngine::print(const QString& message) {
|
||||||
|
|
||||||
|
|
||||||
void ScriptEngine::beginProfileRange(const QString& label) const {
|
void ScriptEngine::beginProfileRange(const QString& label) const {
|
||||||
if (trace_script().isDebugEnabled()) {
|
PROFILE_SYNC_BEGIN(script, label.toStdString().c_str(), label.toStdString().c_str());
|
||||||
tracing::traceEvent(trace_script(), label.toStdString().c_str(), tracing::DurationBegin);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::endProfileRange(const QString& label) const {
|
void ScriptEngine::endProfileRange(const QString& label) const {
|
||||||
if (trace_script().isDebugEnabled()) {
|
PROFILE_SYNC_END(script, label.toStdString().c_str(), label.toStdString().c_str());
|
||||||
tracing::traceEvent(trace_script(), label.toStdString().c_str(), tracing::DurationEnd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Script.require.resolve -- like resolvePath, but performs more validation and throws exceptions on invalid module identifiers (for consistency with Node.js)
|
// Script.require.resolve -- like resolvePath, but performs more validation and throws exceptions on invalid module identifiers (for consistency with Node.js)
|
||||||
|
|
|
@ -46,6 +46,20 @@ private:
|
||||||
const QLoggingCategory& _category;
|
const QLoggingCategory& _category;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline void syncBegin(const QLoggingCategory& category, const QString& name, const QString& id, const QVariantMap& args = QVariantMap(), const QVariantMap& extra = QVariantMap()) {
|
||||||
|
if (category.isDebugEnabled()) {
|
||||||
|
tracing::traceEvent(category, name, tracing::DurationBegin, id, args, extra);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void syncEnd(const QLoggingCategory& category, const QString& name, const QString& id, const QVariantMap& args = QVariantMap(), const QVariantMap& extra = QVariantMap()) {
|
||||||
|
if (category.isDebugEnabled()) {
|
||||||
|
tracing::traceEvent(category, name, tracing::DurationEnd, id, args, extra);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline void asyncBegin(const QLoggingCategory& category, const QString& name, const QString& id, const QVariantMap& args = QVariantMap(), const QVariantMap& extra = QVariantMap()) {
|
inline void asyncBegin(const QLoggingCategory& category, const QString& name, const QString& id, const QVariantMap& args = QVariantMap(), const QVariantMap& extra = QVariantMap()) {
|
||||||
if (category.isDebugEnabled()) {
|
if (category.isDebugEnabled()) {
|
||||||
tracing::traceEvent(category, name, tracing::AsyncNestableStart, id, args, extra);
|
tracing::traceEvent(category, name, tracing::AsyncNestableStart, id, args, extra);
|
||||||
|
@ -80,6 +94,8 @@ inline void metadata(const QString& metadataType, const QVariantMap& args) {
|
||||||
#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, ...) 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_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_END(category, rangeId) Duration::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__);
|
#define PROFILE_ASYNC_BEGIN(category, name, id, ...) asyncBegin(trace_##category(), name, id, ##__VA_ARGS__);
|
||||||
#define PROFILE_ASYNC_END(category, name, id, ...) asyncEnd(trace_##category(), name, id, ##__VA_ARGS__);
|
#define PROFILE_ASYNC_END(category, name, id, ...) asyncEnd(trace_##category(), name, id, ##__VA_ARGS__);
|
||||||
#define PROFILE_COUNTER_IF_CHANGED(category, name, type, value) { static type lastValue = 0; type newValue = value; if (newValue != lastValue) { counter(trace_##category(), name, { { name, newValue }}); lastValue = newValue; } }
|
#define PROFILE_COUNTER_IF_CHANGED(category, name, type, value) { static type lastValue = 0; type newValue = value; if (newValue != lastValue) { counter(trace_##category(), name, { { name, newValue }}); lastValue = newValue; } }
|
||||||
|
|
|
@ -1173,7 +1173,6 @@ function MyController(hand) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.update = function(deltaTime, timestamp) {
|
this.update = function(deltaTime, timestamp) {
|
||||||
Script.beginProfileRange("handControllerGrab:MyController:update")
|
|
||||||
this.updateSmoothedTrigger();
|
this.updateSmoothedTrigger();
|
||||||
this.maybeScaleMyAvatar();
|
this.maybeScaleMyAvatar();
|
||||||
|
|
||||||
|
@ -1210,7 +1209,6 @@ function MyController(hand) {
|
||||||
} else {
|
} else {
|
||||||
print("WARNING: could not find state " + this.state + " in state machine");
|
print("WARNING: could not find state " + this.state + " in state machine");
|
||||||
}
|
}
|
||||||
Script.endProfileRange("handControllerGrab:MyController:update")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.callEntityMethodOnGrabbed = function(entityMethodName) {
|
this.callEntityMethodOnGrabbed = function(entityMethodName) {
|
||||||
|
|
Loading…
Reference in a new issue