aboutsummaryrefslogtreecommitdiff
path: root/src/lj_profile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_profile.c')
-rw-r--r--src/lj_profile.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lj_profile.c b/src/lj_profile.c
index 1984a676..b4bab7f8 100644
--- a/src/lj_profile.c
+++ b/src/lj_profile.c
@@ -87,6 +87,34 @@ static ProfileState profile_state;
87/* Default sample interval in milliseconds. */ 87/* Default sample interval in milliseconds. */
88#define LJ_PROFILE_INTERVAL_DEFAULT 10 88#define LJ_PROFILE_INTERVAL_DEFAULT 10
89 89
90/* -- Profiler/hook interaction ------------------------------------------- */
91
92#if !LJ_PROFILE_SIGPROF
93void LJ_FASTCALL lj_profile_hook_enter(global_State *g)
94{
95 ProfileState *ps = &profile_state;
96 if (ps->g) {
97 profile_lock(ps);
98 hook_enter(g);
99 profile_unlock(ps);
100 } else {
101 hook_enter(g);
102 }
103}
104
105void LJ_FASTCALL lj_profile_hook_leave(global_State *g)
106{
107 ProfileState *ps = &profile_state;
108 if (ps->g) {
109 profile_lock(ps);
110 hook_leave(g);
111 profile_unlock(ps);
112 } else {
113 hook_leave(g);
114 }
115}
116#endif
117
90/* -- Profile callbacks --------------------------------------------------- */ 118/* -- Profile callbacks --------------------------------------------------- */
91 119
92/* Callback from profile hook (HOOK_PROFILE already cleared). */ 120/* Callback from profile hook (HOOK_PROFILE already cleared). */