Skip to content

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
piotmag769 committed Jun 5, 2024
1 parent 69e0c41 commit f44c595
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/cairo-profiler/src/profile_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl ProfilerContext {
};
let location_data = pprof_locations
.last_mut()
.expect("Inlined function was on top of the stack trace, but shouldn't");
.expect("Inlined function was on top of the call trace, but shouldn't");

location_data.line.push(line);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cairo-profiler/src/trace_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ fn collect_samples<'a>(
.iter()
.map(|entry_point_id| NonInlined(FunctionName::from(entry_point_id)))
.collect_vec(),
function_trace.stack_trace
function_trace.call_trace
)
.collect();

Expand Down
12 changes: 6 additions & 6 deletions crates/cairo-profiler/src/trace_reader/function_trace_builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::profiler_config::FunctionLevelConfig;
use crate::sierra_loader::StatementsFunctionsMap;
use crate::trace_reader::function_trace_builder::function_stack_trace::{
use crate::trace_reader::function_trace_builder::function_call_trace::{
FunctionStack, FunctionType,
};
use crate::trace_reader::function_trace_builder::inlining::add_inlined_functions_info;
Expand All @@ -15,7 +15,7 @@ use std::collections::HashMap;
use std::ops::{AddAssign, SubAssign};
use trace_data::TraceEntry;

mod function_stack_trace;
mod function_call_trace;
mod inlining;

pub struct FunctionLevelProfilingInfo {
Expand All @@ -24,7 +24,7 @@ pub struct FunctionLevelProfilingInfo {
}

pub struct FunctionCallTrace {
pub stack_trace: Vec<Function>,
pub call_trace: Vec<Function>,
pub steps: Steps,
}

Expand Down Expand Up @@ -81,8 +81,8 @@ pub fn collect_function_level_profiling_info(

let mut function_stack = FunctionStack::new(function_level_config.max_function_trace_depth);

// The value is the steps of the stack trace so far, not including the pending steps being
// tracked at the time. The key is a function stack trace.
// The value is the steps of the call trace so far, not including the pending steps being
// tracked at the time. The key is a function call trace.
let mut functions_traces: HashMap<Vec<Function>, Steps> = HashMap::new();

// Header steps are counted separately and then displayed as steps of the entrypoint in the
Expand Down Expand Up @@ -183,7 +183,7 @@ pub fn collect_function_level_profiling_info(

let functions_traces = functions_traces
.into_iter()
.map(|(stack_trace, steps)| FunctionCallTrace { stack_trace, steps })
.map(|(call_trace, steps)| FunctionCallTrace { call_trace, steps })
.collect_vec();

FunctionLevelProfilingInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub(super) struct FunctionOnStack {
recursive_calls_count: usize,
}

/// The function stack trace of the current function, excluding the current function.
/// The function call stack of the current function, excluding the current function.
pub(super) struct FunctionStack {
stack: Vec<FunctionOnStack>,
/// Tracks the depth of the function stack, without limit. This is usually equal to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::sierra_loader::StatementsFunctionsMap;
use crate::trace_reader::function_trace_builder::function_stack_trace::FunctionStack;
use crate::trace_reader::function_trace_builder::function_call_trace::FunctionStack;
use crate::trace_reader::function_trace_builder::{Function, Steps};
use crate::trace_reader::functions::FunctionName;
use crate::trace_reader::Function::{Inlined, NonInlined};
Expand Down

0 comments on commit f44c595

Please sign in to comment.