MCPcopy Create free account
hub / github.com/elastic/devfiler / draw_tooltip

Method draw_tooltip

src/ui/tabs/flamegraph.rs:692–736  ·  view source on GitHub ↗

Populates the on-hover tooltip UI.

(
        &self,
        ui: &mut Ui,
        cfg: &DevfilerConfig,
        root: &FlameGraphNode,
        flame: &FlameGraphNode,
    )

Source from the content-addressed store, hash-verified

690
691 /// Populates the on-hover tooltip UI.
692 fn draw_tooltip(
693 &self,
694 ui: &mut Ui,
695 cfg: &DevfilerConfig,
696 root: &FlameGraphNode,
697 flame: &FlameGraphNode,
698 ) {
699 ui.vertical(|ui| {
700 if cfg.dev_mode {
701 ui.horizontal(|ui| {
702 ui.strong("File ID:");
703 ui.monospace(flame.id.file_id.format_hex());
704 });
705 ui.horizontal(|ui| {
706 ui.strong("Address || Line:");
707 ui.monospace(format!("{:#x}", flame.id.addr_or_line));
708 });
709
710 let mut es_frame_id = [0; 16 + 8];
711 es_frame_id[0..16].copy_from_slice(&u128::from(flame.id.file_id).to_be_bytes());
712 es_frame_id[16..24].copy_from_slice(&flame.id.addr_or_line.to_be_bytes());
713 ui.horizontal(|ui| {
714 ui.strong("ES Frame ID:");
715 ui.monospace(ES_B64_ENGINE.encode(&es_frame_id));
716 });
717
718 ui.separator();
719 }
720 ui.horizontal(|ui| {
721 ui.strong("Samples (self):");
722 let weight_self = flame.weight_self();
723 let perc = weight_self as f32 / root.weight as f32 * 100.0;
724 ui.label(format!("{} ({:.02}%)", humanize_count(weight_self), perc));
725 });
726 ui.horizontal(|ui| {
727 ui.strong("Samples (w/ children):");
728 let perc = flame.weight as f32 / root.weight as f32 * 100.0;
729 ui.label(format!("{} ({:.02}%)", humanize_count(flame.weight), perc));
730 });
731 ui.horizontal(|ui| {
732 ui.strong("Location:");
733 ui.add(Label::new(&flame.text).wrap());
734 });
735 });
736 }
737}
738
739static ES_B64_ENGINE: base64::engine::GeneralPurpose = base64::engine::GeneralPurpose::new(

Callers 1

draw_levelMethod · 0.80

Calls 1

weight_selfMethod · 0.80

Tested by

no test coverage detected