Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Check no_std build
run: |
cargo build --locked --no-default-features --features "libm, scheduled_events, musical_transport, all_nodes_no_std, pool, glam-29, glam-30, glam-31"
cargo build --locked --no-default-features --features "libm, scheduled_events, musical_transport, all_nodes_no_std, pool, node_profiling, glam-29, glam-30, glam-31"
# Check formatting.
format:
Expand Down
7 changes: 1 addition & 6 deletions crates/firewheel-graph/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,7 @@ impl FirewheelContext {

let (logger, logger_rx) = firewheel_core::log::realtime_logger(config.logger_config);
let (profiler_tx, profiler_rx) = crate::processor::profiling::profiler_channel(
#[cfg(feature = "node_profiling")]
{
config.initial_node_capacity as usize
},
#[cfg(feature = "node_profiling")]
config.buffer_out_of_space_mode,
config.initial_node_capacity as usize,
#[cfg(feature = "node_profiling")]
graph.graph_out_node(),
);
Expand Down
16 changes: 11 additions & 5 deletions crates/firewheel-graph/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use thunderdome::Arena;
use crate::FirewheelConfig;
use crate::error::{AddEdgeError, CompileGraphError, RemoveNodeError};
use crate::graph::dummy_node::{DummyNode, DummyNodeConfig};
use crate::processor::profiling::ProfilerHeapData;
use firewheel_core::node::{
AudioNode, AudioNodeInfo, AudioNodeInfoInner, Constructor, DynAudioNode, NodeID,
};
Expand Down Expand Up @@ -712,18 +713,23 @@ impl AudioGraph {
&mut nodes_to_remove,
);

let new_arena = if self.nodes.capacity() > self.prev_node_arena_capacity {
Some(Arena::with_capacity(self.nodes.capacity()))
} else {
None
};
let (new_arena, new_profiler_heap_data) =
if self.nodes.capacity() > self.prev_node_arena_capacity {
(
Some(Arena::with_capacity(self.nodes.capacity())),
Some(ProfilerHeapData::new(self.nodes.capacity(), true)),
)
} else {
(None, None)
};
self.prev_node_arena_capacity = self.nodes.capacity();

let schedule_data = Box::new(ScheduleHeapData::new(
schedule,
nodes_to_remove,
new_node_processors,
new_arena,
new_profiler_heap_data,
));

self.needs_compile = false;
Expand Down
10 changes: 5 additions & 5 deletions crates/firewheel-graph/src/graph/compiler/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use firewheel_core::{
node::{AudioNodeProcessor, ProcBuffers, ProcessStatus},
};

use crate::processor::profiling::ProfilerHeapData;

use super::{InsertedSum, NodeID};

#[cfg(not(feature = "std"))]
Expand Down Expand Up @@ -183,6 +185,7 @@ pub struct ScheduleHeapData {
pub(crate) removed_nodes: Vec<NodeHeapData>,
pub(crate) new_node_processors: Vec<NodeHeapData>,
pub(crate) new_node_arena: Option<Arena<crate::processor::NodeEntry>>,
pub(crate) new_profiler_heap_data: Option<ProfilerHeapData>,
}

impl ScheduleHeapData {
Expand All @@ -191,6 +194,7 @@ impl ScheduleHeapData {
nodes_to_remove: Vec<NodeID>,
new_node_processors: Vec<NodeHeapData>,
new_node_arena: Option<Arena<crate::processor::NodeEntry>>,
new_profiler_heap_data: Option<ProfilerHeapData>,
) -> Self {
let num_nodes_to_remove = nodes_to_remove.len();

Expand All @@ -200,6 +204,7 @@ impl ScheduleHeapData {
removed_nodes: Vec::with_capacity(num_nodes_to_remove),
new_node_processors,
new_node_arena,
new_profiler_heap_data,
}
}
}
Expand Down Expand Up @@ -358,11 +363,6 @@ impl CompiledSchedule {
}
}

#[cfg(feature = "node_profiling")]
pub(crate) fn num_nodes(&self) -> usize {
self.pre_proc_nodes.len() + self.schedule.len()
}

pub(crate) fn buffer_capacity(&self) -> usize {
self.buffer_capacity
}
Expand Down
6 changes: 4 additions & 2 deletions crates/firewheel-graph/src/processor/handle_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ impl FirewheelProcessorInner {
.remove_events_from_removed_nodes(&self.nodes);
}

self.profiler_tx
.new_schedule(&new_schedule_data.schedule, &mut self.extra.logger);
self.profiler_tx.new_schedule(
&new_schedule_data.schedule,
&mut new_schedule_data.new_profiler_heap_data,
);

self.schedule_data = Some(new_schedule_data);
}
Expand Down
Loading
Loading