| 452 | } |
| 453 | |
| 454 | void processMonitorCycle(const u64 wall_time) { |
| 455 | if (!_process_sampler.shouldSample(wall_time)) return; |
| 456 | |
| 457 | const u64 deadline_ns = OS::nanotime() + MAX_TIME_NS; |
| 458 | const int process_count = _process_sampler.sample(wall_time); |
| 459 | for (int pid_index = 0; pid_index < process_count; pid_index++) { |
| 460 | const u64 current_time = OS::nanotime(); |
| 461 | if (current_time > deadline_ns) { |
| 462 | Log::debug("Sampled %d of %d processes due to time limit", pid_index, process_count); |
| 463 | break; |
| 464 | } |
| 465 | |
| 466 | ProcessInfo info; |
| 467 | if (_process_sampler.getProcessInfo(pid_index, current_time, info)) { |
| 468 | flushIfNeeded(&_proc_buf, RECORDING_BUFFER_LIMIT - MAX_PROCESS_SAMPLE_JFR_EVENT_LENGTH); |
| 469 | recordProcessSample(&_proc_buf, &info); |
| 470 | } |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | bool hasMasterRecording() const { |
| 475 | return _master_recording_file != NULL; |
no test coverage detected