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
3 changes: 3 additions & 0 deletions applications/rd_gen_to_dags/src/build_dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ macro_rules! register_source {
pub_topics,
$sched_type,
convert_duration($node_data.get_period().expect("Source node's period should always be Some.")),
Some(convert_duration(execution_time)),
).await;
Ok(())
}
Expand Down Expand Up @@ -153,6 +154,7 @@ macro_rules! register_sink {
sub_topics,
$sched_type,
convert_duration($node_data.get_end_to_end_deadline().expect("Sink node's relative_deadline should always be Some.")),
Some(convert_duration(execution_time)),
).await;
Ok(())
}
Expand Down Expand Up @@ -215,6 +217,7 @@ macro_rules! register_intermediate {
sub_topics,
pub_topics,
$sched_type,
Some(convert_duration(execution_time)),
).await;
Ok(())
}
Expand Down
26 changes: 16 additions & 10 deletions applications/tests/test_dag/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#![no_std]
extern crate alloc;

use alloc::{borrow::Cow, vec};
use awkernel_async_lib::dag::{create_dag, finish_create_dags};
use alloc::{borrow::Cow, vec, vec::Vec};
use awkernel_async_lib::dag::{create_dag, finish_create_dags, DagError};
use awkernel_async_lib::scheduler::SchedulerType;
use awkernel_lib::{cpu::CpuSet, delay::wait_microsec};
use core::time::Duration;

const LOG_ENABLE: bool = true;
const SOURCE_EXECUTION_TIME_US: u64 = 100_000;

pub async fn run() {
wait_microsec(1000000);

let period = Duration::from_nanos(1000000000);
let exe_time = (period.as_micros() as f64 * 0.1) as u64;
let period = Duration::from_secs(1);
let exe_time = SOURCE_EXECUTION_TIME_US;

log::debug!("period is {} [ns]", period.as_nanos());

Expand All @@ -32,6 +33,7 @@ pub async fn run() {
vec![Cow::from("topic0")],
SchedulerType::EDF(5, CpuSet::all()),
period,
Some(Duration::from_micros(SOURCE_EXECUTION_TIME_US)),
)
.await;

Expand All @@ -48,6 +50,7 @@ pub async fn run() {
vec![Cow::from("topic0")],
vec![Cow::from("topic1"), Cow::from("topic2")],
SchedulerType::EDF(10, CpuSet::all()),
Some(Duration::from_millis(100)),
)
.await;

Expand All @@ -63,6 +66,7 @@ pub async fn run() {
vec![Cow::from("topic1")],
vec![Cow::from("topic3")],
SchedulerType::EDF(10, CpuSet::all()),
Some(Duration::from_millis(50)),
)
.await;

Expand All @@ -78,6 +82,7 @@ pub async fn run() {
vec![Cow::from("topic2")],
vec![Cow::from("topic4")],
SchedulerType::EDF(10, CpuSet::all()),
Some(Duration::from_millis(50)),
)
.await;

Expand All @@ -92,21 +97,22 @@ pub async fn run() {
vec![Cow::from("topic3"), Cow::from("topic4")],
SchedulerType::EDF(10, CpuSet::all()),
Duration::from_secs(1),
Some(Duration::from_millis(100)),
)
.await;

let result = finish_create_dags(&[dag.clone()]).await;

match result {
match finish_create_dags(core::slice::from_ref(&dag)).await {
Ok(_) => {
if LOG_ENABLE {
log::info!("DAG created successfully");
}
}
Err(errors) => {
log::error!("Failed to create DAGs");
for error in errors {
log::error!("- {error}");
if LOG_ENABLE {
log::error!("DAG creation failed:");
for error in errors {
log::error!("- {error}");
}
}
}
}
Expand Down
Loading
Loading