Implements profiler for blocked recv

This commit is contained in:
Nakul Jindal 2018-02-26 09:07:08 -08:00
parent 563f0ec824
commit 7d4e2b11e9
27 changed files with 176 additions and 58 deletions

View file

@ -10,7 +10,7 @@ use influent::create_client;
use influent::measurement::{Measurement, Value};
use ipc_channel::ipc::{self, IpcReceiver};
use profile_traits::energy::{energy_interval_ms, read_energy_uj};
use profile_traits::time::{ProfilerCategory, ProfilerChan, ProfilerMsg, TimerMetadata};
use profile_traits::time::{ProfilerCategory, ProfilerChan, ProfilerMsg, ProfilerData, TimerMetadata};
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
use servo_config::opts::OutputOptions;
use std::{f64, thread, u32, u64};
@ -158,6 +158,7 @@ impl Formattable for ProfilerCategory {
ProfilerCategory::TimeToFirstPaint => "Time To First Paint",
ProfilerCategory::TimeToFirstContentfulPaint => "Time To First Contentful Paint",
ProfilerCategory::TimeToInteractive => "Time to Interactive",
ProfilerCategory::IpcReceiver => "Blocked at IPC Receive",
ProfilerCategory::ApplicationHeartbeat => "Application Heartbeat",
};
format!("{}{}", padding, name)
@ -316,6 +317,13 @@ impl Profiler {
// only print if more data has arrived since the last printout
self.print_buckets();
},
ProfilerMsg::Get(k, sender) => {
let vec_option = self.buckets.get(&k);
match vec_option {
Some(vec_entry) => sender.send(ProfilerData::Record(vec_entry.to_vec())).unwrap(),
None => sender.send(ProfilerData::NoRecords).unwrap(),
};
},
ProfilerMsg::Exit(chan) => {
heartbeats::cleanup();
self.print_buckets();