Class: PerfTools::CpuProfiler
- Inherits:
-
Object
- Object
- PerfTools::CpuProfiler
- Defined in:
- ext/perftools.c
Class Method Summary collapse
Class Method Details
.running? ⇒ Boolean
228 229 230 231 232 |
# File 'ext/perftools.c', line 228
static VALUE
cpuprofiler_running_p(VALUE self)
{
return bProfilerRunning;
}
|
.start(filename) ⇒ Object
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'ext/perftools.c', line 249
static VALUE
cpuprofiler_start(VALUE self, VALUE filename)
{
StringValue(filename);
if (bProfilerRunning)
rb_raise(eError, "profiler is already running");
if (getenv("CPUPROFILE_OBJECTS"))
objprofiler_setup();
else if (getenv("CPUPROFILE_METHODS"))
methprofiler_setup();
if (ProfilerStart(RSTRING_PTR(filename))) {
bProfilerRunning = Qtrue;
} else {
rb_raise(eError, "profiler could not be started");
}
if (rb_block_given_p()) {
rb_yield(Qnil);
cpuprofiler_stop(self);
}
return Qtrue;
}
|
.stop ⇒ Object
234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'ext/perftools.c', line 234
static VALUE
cpuprofiler_stop(VALUE self)
{
if (!bProfilerRunning)
return Qfalse;
bProfilerRunning = Qfalse;
objprofiler_teardown();
methprofiler_teardown();
ProfilerStop();
ProfilerFlush();
return Qtrue;
}
|