Esempio n. 1
0
static VALUE
cpuprofiler_flush(VALUE self)
{
  if (!bProfilerRunning)
    return Qfalse;
  if (bProfilerPaused)
    ProfilerResume();
  ProfilerFlush();
  if (bProfilerPaused)
    ProfilerPause();
  return Qtrue;
}
Esempio n. 2
0
static VALUE
cpuprofiler_stop(VALUE self)
{
  if (!bProfilerRunning)
    return Qfalse;

  bProfilerRunning = Qfalse;
  objprofiler_teardown();
  methprofiler_teardown();
  ProfilerStop();
  ProfilerFlush();

  return Qtrue;
}
bool AdminRequestHandler::handleCPUProfilerRequest(const std::string &cmd,
                                                   Transport *transport) {
  string file = RuntimeOption::ProfilerOutputDir + "/" +
    Process::HostName + "/hphp.prof";

  if (cmd == "prof-cpu-on") {
    if (Util::mkdir(file)) {
      ProfilerStart(file.c_str());
      transport->sendString("OK\n");
    } else {
      transport->sendString("Unable to mkdir for profile data.\n");
    }
    return true;
  }
  if (cmd == "prof-cpu-off") {
    ProfilerStop();
    ProfilerFlush();
    transport->sendString("OK\n");
    return true;
  }
  return false;
}
Esempio n. 4
0
void sig_profiler_flush_handler(int sig)
{
  ProfilerFlush();
}