Function: profiler-cpu-start

profiler-cpu-start is a function defined in profiler.c.

Signature

(profiler-cpu-start SAMPLING-INTERVAL)

Documentation

Start or restart the cpu profiler.

It takes call-stack samples each SAMPLING-INTERVAL nanoseconds, approximately. See also profiler-log-size and profiler-max-stack-depth.

Source Code

// Defined in /usr/src/emacs/src/profiler.c
{
  if (profiler_cpu_running)
    error ("CPU profiler is already running");

  if (cpu.log == NULL)
    cpu = make_profiler_log ();

  int status = setup_cpu_timer (sampling_interval);
  if (status < 0)
    {
      profiler_cpu_running = NOT_RUNNING;
      error ("Invalid sampling interval");
    }
  else
    {
      profiler_cpu_interval = sampling_interval;
      profiler_cpu_running = status;
      if (! profiler_cpu_running)
	error ("Unable to start profiler timer");
    }

  return Qt;
}