mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 12:13:22 +00:00
Bug 772630 - Deay JS profiling until we have a JSRuntime. r=ehsan,acrichton
This commit is contained in:
parent
67b19a9db9
commit
e25a726e82
@ -891,8 +891,9 @@ void mozilla_sampler_init()
|
||||
return;
|
||||
}
|
||||
|
||||
const char* features = "js";
|
||||
mozilla_sampler_start(PROFILE_DEFAULT_ENTRY, PROFILE_DEFAULT_INTERVAL,
|
||||
PROFILE_DEFAULT_FEATURES, PROFILE_DEFAULT_FEATURE_COUNT);
|
||||
&features, 1);
|
||||
}
|
||||
|
||||
void mozilla_sampler_deinit()
|
||||
|
@ -234,6 +234,7 @@ public:
|
||||
: mStackPointer(0)
|
||||
, mMarkerPointer(0)
|
||||
, mQueueClearMarker(false)
|
||||
, mStartJSSampling(false)
|
||||
{ }
|
||||
|
||||
void addMarker(const char *aMarker)
|
||||
@ -304,16 +305,25 @@ public:
|
||||
|
||||
void sampleRuntime(JSRuntime *runtime) {
|
||||
mRuntime = runtime;
|
||||
if (mStartJSSampling)
|
||||
installJSSampling();
|
||||
}
|
||||
void installJSSampling() {
|
||||
JS_STATIC_ASSERT(sizeof(mStack[0]) == sizeof(js::ProfileEntry));
|
||||
js::SetRuntimeProfilingStack(mRuntime,
|
||||
(js::ProfileEntry*) mStack,
|
||||
(uint32_t*) &mStackPointer,
|
||||
mozilla::ArrayLength(mStack));
|
||||
if (mRuntime) {
|
||||
js::SetRuntimeProfilingStack(mRuntime,
|
||||
(js::ProfileEntry*) mStack,
|
||||
(uint32_t*) &mStackPointer,
|
||||
mozilla::ArrayLength(mStack));
|
||||
mStartJSSampling = false;
|
||||
} else {
|
||||
mStartJSSampling = true;
|
||||
}
|
||||
}
|
||||
void uninstallJSSampling() {
|
||||
js::SetRuntimeProfilingStack(mRuntime, NULL, NULL, 0);
|
||||
mStartJSSampling = false;
|
||||
if (mRuntime)
|
||||
js::SetRuntimeProfilingStack(mRuntime, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
// Keep a list of active checkpoints
|
||||
@ -327,6 +337,8 @@ public:
|
||||
volatile mozilla::sig_safe_t mQueueClearMarker;
|
||||
// The runtime which is being sampled
|
||||
JSRuntime *mRuntime;
|
||||
// Start JS Profiling when possible
|
||||
bool mStartJSSampling;
|
||||
};
|
||||
|
||||
inline ProfileStack* mozilla_profile_stack(void)
|
||||
|
Loading…
x
Reference in New Issue
Block a user