зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #11096 - Profile time spent saving the screenshot image (from mbrubeck:profile-image-saving); r=metajack
I did this to see if it was a significant factor in automated test runs. (Spoiler: it isn't.) Source-Repo: https://github.com/servo/servo Source-Revision: 7b8bb0c2485eb46303d97918d91fce73bd98fea9
This commit is contained in:
Родитель
dd4a5e5242
Коммит
b33763b392
|
@ -2166,19 +2166,21 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
})
|
||||
}
|
||||
CompositeTarget::PngFile => {
|
||||
let img = self.draw_img(render_target_info,
|
||||
width,
|
||||
height);
|
||||
match opts::get().output_file.as_ref() {
|
||||
Some(path) => match File::create(path) {
|
||||
Ok(mut file) => match DynamicImage::ImageRgb8(img).save(&mut file, ImageFormat::PNG) {
|
||||
Ok(()) => (),
|
||||
Err(e) => error!("Failed to save {} ({}).", path, e),
|
||||
profile(ProfilerCategory::ImageSaving, None, self.time_profiler_chan.clone(), || {
|
||||
match opts::get().output_file.as_ref() {
|
||||
Some(path) => match File::create(path) {
|
||||
Ok(mut file) => {
|
||||
let img = self.draw_img(render_target_info, width, height);
|
||||
let dynamic_image = DynamicImage::ImageRgb8(img);
|
||||
if let Err(e) = dynamic_image.save(&mut file, ImageFormat::PNG) {
|
||||
error!("Failed to save {} ({}).", path, e);
|
||||
}
|
||||
},
|
||||
Err(e) => error!("Failed to create {} ({}).", path, e),
|
||||
},
|
||||
Err(e) => error!("Failed to create {} ({}).", path, e),
|
||||
},
|
||||
None => error!("No file specified."),
|
||||
}
|
||||
None => error!("No file specified."),
|
||||
}
|
||||
});
|
||||
None
|
||||
}
|
||||
};
|
||||
|
|
|
@ -37,6 +37,7 @@ pub fn init() {
|
|||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::PaintingPrepBuff);
|
||||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::Painting);
|
||||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ImageDecoding);
|
||||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ImageSaving);
|
||||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptAttachLayout);
|
||||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptConstellationMsg);
|
||||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptDevtoolsMsg);
|
||||
|
|
|
@ -97,6 +97,7 @@ impl Formattable for ProfilerCategory {
|
|||
ProfilerCategory::PaintingPrepBuff => "Buffer Prep",
|
||||
ProfilerCategory::Painting => "Painting",
|
||||
ProfilerCategory::ImageDecoding => "Image Decoding",
|
||||
ProfilerCategory::ImageSaving => "Image Saving",
|
||||
ProfilerCategory::ScriptAttachLayout => "Script Attach Layout",
|
||||
ProfilerCategory::ScriptConstellationMsg => "Script Constellation Msg",
|
||||
ProfilerCategory::ScriptDevtoolsMsg => "Script Devtools Msg",
|
||||
|
|
|
@ -57,6 +57,7 @@ pub enum ProfilerCategory {
|
|||
PaintingPrepBuff,
|
||||
Painting,
|
||||
ImageDecoding,
|
||||
ImageSaving,
|
||||
ScriptAttachLayout,
|
||||
ScriptConstellationMsg,
|
||||
ScriptDevtoolsMsg,
|
||||
|
|
|
@ -37,6 +37,7 @@ HEARTBEAT_PROFILER_CATEGORIES = [
|
|||
("PaintingPrepBuff", HEARTBEAT_DEFAULT_WINDOW_SIZE),
|
||||
("Painting", HEARTBEAT_DEFAULT_WINDOW_SIZE),
|
||||
("ImageDecoding", HEARTBEAT_DEFAULT_WINDOW_SIZE),
|
||||
("ImageSaving", HEARTBEAT_DEFAULT_WINDOW_SIZE),
|
||||
("ScriptAttachLayout", HEARTBEAT_DEFAULT_WINDOW_SIZE),
|
||||
("ScriptConstellationMsg", HEARTBEAT_DEFAULT_WINDOW_SIZE),
|
||||
("ScriptDevtoolsMsg", HEARTBEAT_DEFAULT_WINDOW_SIZE),
|
||||
|
|
Загрузка…
Ссылка в новой задаче