Skip to content

Commit

Permalink
Improve unwind info code organisation
Browse files Browse the repository at this point in the history
Split it in different files. Docs, better error handling and and more tests coming later.
  • Loading branch information
javierhonduco committed Oct 16, 2024
1 parent b070aa3 commit b8dc4d2
Show file tree
Hide file tree
Showing 10 changed files with 592 additions and 597 deletions.
Binary file added perf.data
Binary file not shown.
2 changes: 1 addition & 1 deletion src/bpf/profiler_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use plain::Plain;
use std::ops::Add;

use crate::unwind_info::CompactUnwindRow;
use crate::unwind_info::types::CompactUnwindRow;

include!(concat!(env!("OUT_DIR"), "/profiler_bindings.rs"));

Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ use lightswitch::object::ObjectFile;
use lightswitch::profile::symbolize_profile;
use lightswitch::profile::{fold_profile, to_pprof};
use lightswitch::profiler::{Profiler, ProfilerConfig};
use lightswitch::unwind_info::in_memory_unwind_info;
use lightswitch::unwind_info::remove_redundant;
use lightswitch::unwind_info::remove_unnecesary_markers;
use lightswitch::unwind_info::UnwindInfoBuilder;
use lightswitch::unwind_info::convert::in_memory_unwind_info;
use lightswitch::unwind_info::convert::UnwindInfoBuilder;
use lightswitch::unwind_info::optimize::remove_redundant;
use lightswitch::unwind_info::optimize::remove_unnecesary_markers;

const SAMPLE_FREQ_RANGE: RangeInclusive<usize> = 1..=1009;
const PPROF_INGEST_URL: &str = "http://localhost:4567/pprof/new";
Expand Down
7 changes: 4 additions & 3 deletions src/profiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ use crate::collector::*;
use crate::object::ElfLoad;
use crate::object::{BuildId, ExecutableId, ObjectFile};
use crate::perf_events::setup_perf_event;
use crate::unwind_info::convert::in_memory_unwind_info;
use crate::unwind_info::log_unwind_info_sections;
use crate::unwind_info::CompactUnwindRow;
use crate::unwind_info::{in_memory_unwind_info, remove_redundant, remove_unnecesary_markers};
use crate::unwind_info::optimize::{remove_redundant, remove_unnecesary_markers};
use crate::unwind_info::types::CompactUnwindRow;
use crate::util::{get_online_cpus, summarize_address_range};

pub enum TracerEvent {
Expand Down Expand Up @@ -1140,7 +1141,7 @@ impl Profiler<'_> {
executable_id: u64,
bucket_id: u32,
) {
let pages = crate::unwind_info::to_pages(unwind_info);
let pages = crate::unwind_info::pages::to_pages(unwind_info);
for page in pages {
let page_key = page_key_t {
file_offset: page.address,
Expand Down
Loading

0 comments on commit b8dc4d2

Please sign in to comment.