mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 14:28:39 +09:00
parent
64602172c2
commit
8d1e73fc3c
25 changed files with 0 additions and 3212 deletions
|
|
@ -1006,110 +1006,6 @@ nsJSContext::AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_JPROF
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
inline bool
|
||||
IsJProfAction(struct sigaction *action)
|
||||
{
|
||||
return (action->sa_sigaction &&
|
||||
(action->sa_flags & (SA_RESTART | SA_SIGINFO)) == (SA_RESTART | SA_SIGINFO));
|
||||
}
|
||||
|
||||
void NS_JProfStartProfiling();
|
||||
void NS_JProfStopProfiling();
|
||||
void NS_JProfClearCircular();
|
||||
|
||||
static bool
|
||||
JProfStartProfilingJS(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
{
|
||||
NS_JProfStartProfiling();
|
||||
return true;
|
||||
}
|
||||
|
||||
void NS_JProfStartProfiling()
|
||||
{
|
||||
// Figure out whether we're dealing with SIGPROF, SIGALRM, or
|
||||
// SIGPOLL profiling (SIGALRM for JP_REALTIME, SIGPOLL for
|
||||
// JP_RTC_HZ)
|
||||
struct sigaction action;
|
||||
|
||||
// Must check ALRM before PROF since both are enabled for real-time
|
||||
sigaction(SIGALRM, nullptr, &action);
|
||||
//printf("SIGALRM: %p, flags = %x\n",action.sa_sigaction,action.sa_flags);
|
||||
if (IsJProfAction(&action)) {
|
||||
//printf("Beginning real-time jprof profiling.\n");
|
||||
raise(SIGALRM);
|
||||
return;
|
||||
}
|
||||
|
||||
sigaction(SIGPROF, nullptr, &action);
|
||||
//printf("SIGPROF: %p, flags = %x\n",action.sa_sigaction,action.sa_flags);
|
||||
if (IsJProfAction(&action)) {
|
||||
//printf("Beginning process-time jprof profiling.\n");
|
||||
raise(SIGPROF);
|
||||
return;
|
||||
}
|
||||
|
||||
sigaction(SIGPOLL, nullptr, &action);
|
||||
//printf("SIGPOLL: %p, flags = %x\n",action.sa_sigaction,action.sa_flags);
|
||||
if (IsJProfAction(&action)) {
|
||||
//printf("Beginning rtc-based jprof profiling.\n");
|
||||
raise(SIGPOLL);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Could not start jprof-profiling since JPROF_FLAGS was not set.\n");
|
||||
}
|
||||
|
||||
static bool
|
||||
JProfStopProfilingJS(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
{
|
||||
NS_JProfStopProfiling();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
NS_JProfStopProfiling()
|
||||
{
|
||||
raise(SIGUSR1);
|
||||
//printf("Stopped jprof profiling.\n");
|
||||
}
|
||||
|
||||
static bool
|
||||
JProfClearCircularJS(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
{
|
||||
NS_JProfClearCircular();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
NS_JProfClearCircular()
|
||||
{
|
||||
raise(SIGUSR2);
|
||||
//printf("cleared jprof buffer\n");
|
||||
}
|
||||
|
||||
static bool
|
||||
JProfSaveCircularJS(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
{
|
||||
// Not ideal...
|
||||
NS_JProfStopProfiling();
|
||||
NS_JProfStartProfiling();
|
||||
return true;
|
||||
}
|
||||
|
||||
static const JSFunctionSpec JProfFunctions[] = {
|
||||
JS_FS("JProfStartProfiling", JProfStartProfilingJS, 0, 0),
|
||||
JS_FS("JProfStopProfiling", JProfStopProfilingJS, 0, 0),
|
||||
JS_FS("JProfClearCircular", JProfClearCircularJS, 0, 0),
|
||||
JS_FS("JProfSaveCircular", JProfSaveCircularJS, 0, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
#endif /* defined(MOZ_JPROF) */
|
||||
|
||||
nsresult
|
||||
nsJSContext::InitClasses(JS::Handle<JSObject*> aGlobalObj)
|
||||
{
|
||||
|
|
@ -1121,11 +1017,6 @@ nsJSContext::InitClasses(JS::Handle<JSObject*> aGlobalObj)
|
|||
// Attempt to initialize profiling functions
|
||||
::JS_DefineProfilingFunctions(cx, aGlobalObj);
|
||||
|
||||
#ifdef MOZ_JPROF
|
||||
// Attempt to initialize JProf functions
|
||||
::JS_DefineFunctions(cx, aGlobalObj, JProfFunctions);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue