Esempio n. 1
0
void EventHook::onFunctionEnter(const ActRec* ar, int funcType) {
  CheckSurprise();
  RunUserProfiler(ar, ProfileEnter);
#ifdef HOTPROFILER
  Profiler* profiler = ThreadInfo::s_threadInfo->m_profiler;
  if (profiler != nullptr) {
    const char* name;
    switch (funcType) {
      case NormalFunc:
        name = ar->m_func->fullName()->data();
        if (name[0] == '\0') {
          // We're evaling some code for internal purposes, most
          // likely getting the default value for a function parameter
          name = "{internal}";
        }
        break;
      case PseudoMain:
        name = StringData::GetStaticString(
          std::string("run_init::") + ar->m_func->unit()->filepath()->data())
          ->data();
        break;
      case Eval:
        name = "_";
        break;
      default:
        not_reached();
    }
    begin_profiler_frame(profiler, name);
  }
#endif
}
Esempio n. 2
0
bool EventHook::onFunctionEnter(const ActRec* ar, int funcType) {
  ssize_t flags = CheckSurprise();
  if (flags & RequestInjectionData::InterceptFlag &&
      !RunInterceptHandler(const_cast<ActRec*>(ar))) {
    return false;
  }
  if (flags & RequestInjectionData::EventHookFlag) {
    RunUserProfiler(ar, ProfileEnter);
#ifdef HOTPROFILER
    Profiler* profiler = ThreadInfo::s_threadInfo->m_profiler;
    if (profiler != nullptr) {
      begin_profiler_frame(profiler, GetFunctionNameForProfiler(ar, funcType));
    }
#endif
  }
  return true;
}
Esempio n. 3
0
void EventHook::onFunctionEnter(const ActRec* ar, int funcType, ssize_t flags) {
  // Xenon
  if (flags & RequestInjectionData::XenonSignalFlag) {
    Xenon::getInstance().log(Xenon::EnterSample);
  }

  // User profiler
  if (flags & RequestInjectionData::EventHookFlag) {
    if (shouldRunUserProfiler(ar->func())) {
      runUserProfilerOnFunctionEnter(ar);
    }
    Profiler* profiler = ThreadInfo::s_threadInfo->m_profiler;
    if (profiler != nullptr) {
      begin_profiler_frame(profiler,
                           GetFunctionNameForProfiler(ar->func(), funcType));
    }
  }
}
Esempio n. 4
0
void EventHook::onFunctionEnter(const ActRec* ar, int funcType, ssize_t flags) {
  // User profiler
  if (flags & EventHookFlag) {
    if (shouldRunUserProfiler(ar->func())) {
      runUserProfilerOnFunctionEnter(ar);
    }
    auto profiler = ThreadInfo::s_threadInfo->m_profiler;
    if (profiler != nullptr &&
        !(profiler->shouldSkipBuiltins() && ar->func()->isBuiltin())) {
      begin_profiler_frame(profiler,
                           GetFunctionNameForProfiler(ar->func(), funcType));
    }
  }

  // Debugger hook
  if (flags & DebuggerHookFlag) {
    DEBUGGER_ATTACHED_ONLY(phpDebuggerFuncEntryHook(ar));
  }
}
Esempio n. 5
0
bool EventHook::onFunctionEnter(const ActRec* ar, int funcType) {
  ssize_t flags = CheckSurprise();
  if (flags & RequestInjectionData::InterceptFlag &&
      !RunInterceptHandler(const_cast<ActRec*>(ar))) {
    return false;
  }
  if (flags & RequestInjectionData::EventHookFlag) {
    RunUserProfiler(ar, ProfileEnter);
#ifdef HOTPROFILER
    Profiler* profiler = ThreadInfo::s_threadInfo->m_profiler;
    if (profiler != nullptr) {
      const char* name;
      switch (funcType) {
        case NormalFunc:
          name = ar->m_func->fullName()->data();
          if (name[0] == '\0') {
            // We're evaling some code for internal purposes, most
            // likely getting the default value for a function parameter
            name = "{internal}";
          }
          break;
        case PseudoMain:
          name = StringData::GetStaticString(
            std::string("run_init::") + ar->m_func->unit()->filepath()->data())
            ->data();
          break;
        case Eval:
          name = "_";
          break;
        default:
          not_reached();
      }
      begin_profiler_frame(profiler, name);
    }
#endif
  }
  return true;
}
Esempio n. 6
0
void EventHook::onFunctionEnter(const ActRec* ar, int funcType, ssize_t flags) {
  // Xenon
  if (flags & RequestInjectionData::XenonSignalFlag) {
    Xenon::getInstance().log(Xenon::EnterSample);
  }

  // User profiler
  if (flags & RequestInjectionData::EventHookFlag) {
    if (shouldRunUserProfiler(ar->func())) {
      runUserProfilerOnFunctionEnter(ar);
    }
    Profiler* profiler = ThreadInfo::s_threadInfo->m_profiler;
    if (profiler != nullptr &&
        !(profiler->shouldSkipBuiltins() && ar->func()->isBuiltin())) {
      begin_profiler_frame(profiler,
                           GetFunctionNameForProfiler(ar->func(), funcType));
    }
  }

  // Debugger hook
  if (flags & RequestInjectionData::DebuggerHookFlag) {
    DEBUGGER_ATTACHED_ONLY(phpDebuggerFuncEntryHook(ar));
  }
}