Rename crate to NeXosim
This commit is contained in:
1 parent
84ad02a248
commit
5ab898ad79
94 files changed
+219
-218
No files matched your search
@@ -71,7 +71,7 @@ jobs:
|
||||
- name: Dry-run cargo test (Loom)
|
||||
run: cargo test --no-run --lib --all-features
|
||||
env:
|
||||
RUSTFLAGS: --cfg asynchronix_loom
|
||||
RUSTFLAGS: --cfg nexosim_loom
|
||||
|
||||
miri:
|
||||
name: Miri
|
||||
|
||||
+25
-25
@@ -4,33 +4,33 @@ on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'asynchronix/src/channel.rs'
|
||||
- 'asynchronix/src/channel/**'
|
||||
- 'asynchronix/src/executor/task.rs'
|
||||
- 'asynchronix/src/executor/task/**'
|
||||
- 'asynchronix/src/loom_exports.rs'
|
||||
- 'asynchronix/src/ports/output/broadcaster.rs'
|
||||
- 'asynchronix/src/ports/output/broadcaster/**'
|
||||
- 'asynchronix/src/ports/source/broadcaster.rs'
|
||||
- 'asynchronix/src/ports/source/broadcaster/**'
|
||||
- 'asynchronix/src/util/cached_rw_lock.rs'
|
||||
- 'asynchronix/src/util/slot.rs'
|
||||
- 'asynchronix/src/util/sync_cell.rs'
|
||||
- 'nexosim/src/channel.rs'
|
||||
- 'nexosim/src/channel/**'
|
||||
- 'nexosim/src/executor/task.rs'
|
||||
- 'nexosim/src/executor/task/**'
|
||||
- 'nexosim/src/loom_exports.rs'
|
||||
- 'nexosim/src/ports/output/broadcaster.rs'
|
||||
- 'nexosim/src/ports/output/broadcaster/**'
|
||||
- 'nexosim/src/ports/source/broadcaster.rs'
|
||||
- 'nexosim/src/ports/source/broadcaster/**'
|
||||
- 'nexosim/src/util/cached_rw_lock.rs'
|
||||
- 'nexosim/src/util/slot.rs'
|
||||
- 'nexosim/src/util/sync_cell.rs'
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- 'asynchronix/src/channel.rs'
|
||||
- 'asynchronix/src/channel/**'
|
||||
- 'asynchronix/src/executor/task.rs'
|
||||
- 'asynchronix/src/executor/task/**'
|
||||
- 'asynchronix/src/loom_exports.rs'
|
||||
- 'asynchronix/src/ports/output/broadcaster.rs'
|
||||
- 'asynchronix/src/ports/output/broadcaster/**'
|
||||
- 'asynchronix/src/ports/source/broadcaster.rs'
|
||||
- 'asynchronix/src/ports/source/broadcaster/**'
|
||||
- 'asynchronix/src/util/cached_rw_lock.rs'
|
||||
- 'asynchronix/src/util/slot.rs'
|
||||
- 'asynchronix/src/util/sync_cell.rs'
|
||||
- 'nexosim/src/channel.rs'
|
||||
- 'nexosim/src/channel/**'
|
||||
- 'nexosim/src/executor/task.rs'
|
||||
- 'nexosim/src/executor/task/**'
|
||||
- 'nexosim/src/loom_exports.rs'
|
||||
- 'nexosim/src/ports/output/broadcaster.rs'
|
||||
- 'nexosim/src/ports/output/broadcaster/**'
|
||||
- 'nexosim/src/ports/source/broadcaster.rs'
|
||||
- 'nexosim/src/ports/source/broadcaster/**'
|
||||
- 'nexosim/src/util/cached_rw_lock.rs'
|
||||
- 'nexosim/src/util/slot.rs'
|
||||
- 'nexosim/src/util/sync_cell.rs'
|
||||
|
||||
jobs:
|
||||
loom:
|
||||
@@ -46,4 +46,4 @@ jobs:
|
||||
- name: Run cargo test (Loom)
|
||||
run: cargo test --lib --release
|
||||
env:
|
||||
RUSTFLAGS: --cfg asynchronix_loom
|
||||
RUSTFLAGS: --cfg nexosim_loom
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
[workspace]
|
||||
members = ["asynchronix", "asynchronix-util"]
|
||||
members = ["nexosim", "nexosim-util"]
|
||||
resolver = "2"
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2024 Asynchronics sp. z o.o. and Asynchronix Contributors
|
||||
Copyright (c) 2024 Asynchronics sp. z o.o. and NeXosim Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
# Asynchronix
|
||||
# NeXosim
|
||||
|
||||
Asynchronix is a developer-friendly, highly optimized discrete-event simulation
|
||||
framework written in Rust. It is meant to scale from small, simple simulations
|
||||
to very large simulation benches with complex time-driven state machines.
|
||||
NeXosim (né Asynchronix) is a developer-friendly, highly optimized
|
||||
discrete-event simulation framework written in Rust. It is meant to scale from
|
||||
small, simple simulations to very large simulation benches with complex
|
||||
time-driven state machines.
|
||||
|
||||
[](https://crates.io/crates/asynchronix)
|
||||
[](https://docs.rs/asynchronix)
|
||||
[](https://github.com/asynchronics/asynchronix#license)
|
||||
[](https://crates.io/crates/nexosim)
|
||||
[](https://docs.rs/nexosim)
|
||||
[](https://github.com/asynchronics/nexosim#license)
|
||||
|
||||
|
||||
## Overview
|
||||
|
||||
Asynchronix is a simulator that leverages asynchronous programming to
|
||||
NeXosim is a simulator that leverages asynchronous programming to
|
||||
transparently and efficiently auto-parallelize simulations by means of a custom
|
||||
multi-threaded executor.
|
||||
|
||||
@@ -22,7 +23,7 @@ communicating with other models through message passing via connections defined
|
||||
during bench assembly.
|
||||
|
||||
Although the main impetus for its development was the need for simulators able
|
||||
to handle large cyberphysical systems, Asynchronix is a general-purpose
|
||||
to handle large cyberphysical systems, NeXosim is a general-purpose
|
||||
discrete-event simulator expected to be suitable for a wide range of simulation
|
||||
activities. It draws from experience on spacecraft real-time simulators but
|
||||
differs from existing tools in the space industry in a number of respects,
|
||||
@@ -35,7 +36,7 @@ including:
|
||||
2) *developer-friendliness*: an ergonomic API and Rust's support for algebraic
|
||||
types make it ideal for the "cyber" part in cyberphysical, i.e. for modelling
|
||||
digital devices with even very complex state machines,
|
||||
3) *open-source*: last but not least, Asynchronix is distributed under the very
|
||||
3) *open-source*: last but not least, NeXosim is distributed under the very
|
||||
permissive MIT and Apache 2 licenses, with the explicit intent to foster an
|
||||
ecosystem where models can be easily exchanged without reliance on
|
||||
proprietary APIs.
|
||||
@@ -49,10 +50,10 @@ The [API] documentation is relatively exhaustive and includes a practical
|
||||
overview which should provide all necessary information to get started.
|
||||
|
||||
More fleshed out examples can also be found in the dedicated
|
||||
[simulator](asynchronix/examples) and [utilities](asynchronix-util/examples)
|
||||
[simulator](nexosim/examples) and [utilities](nexosim-util/examples)
|
||||
directories.
|
||||
|
||||
[API]: https://docs.rs/asynchronix
|
||||
[API]: https://docs.rs/nexosim
|
||||
|
||||
|
||||
## Usage
|
||||
@@ -61,7 +62,7 @@ Add this to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
asynchronix = "0.2.2"
|
||||
nexosim = "0.2.2"
|
||||
```
|
||||
|
||||
|
||||
@@ -76,9 +77,9 @@ asynchronix = "0.2.2"
|
||||
// Input ●─────►│ multiplier 1 ├─────►│ multiplier 2 ├─────► Output
|
||||
// │ │ │ │
|
||||
// └──────────────┘ └──────────────┘
|
||||
use asynchronix::model::{Model, Output};
|
||||
use asynchronix::simulation::{Mailbox, SimInit};
|
||||
use asynchronix::time::{MonotonicTime, Scheduler};
|
||||
use nexosim::model::{Model, Output};
|
||||
use nexosim::simulation::{Mailbox, SimInit};
|
||||
use nexosim::time::{MonotonicTime, Scheduler};
|
||||
use std::time::Duration;
|
||||
|
||||
// A model that doubles its input and forwards it with a 1s delay.
|
||||
@@ -136,7 +137,7 @@ assert_eq!(output_slot.take(), Some(14.0));
|
||||
|
||||
# Implementation notes
|
||||
|
||||
Under the hood, Asynchronix is based on an asynchronous implementation of the
|
||||
Under the hood, NeXosim is based on an asynchronous implementation of the
|
||||
[actor model][actor_model], where each simulation model is an actor. The
|
||||
messages actually exchanged between models are `async` closures which capture
|
||||
the event's or request's value and take the model as `&mut self` argument. The
|
||||
@@ -154,13 +155,13 @@ asynchronous runtimes such as [Tokio][tokio], because the end of a set of
|
||||
computations is technically a deadlock: the computation completes when all model
|
||||
have nothing left to do and are blocked on an empty mailbox. Also, instead of
|
||||
managing a conventional reactor, the runtime manages a priority queue containing
|
||||
the posted events. For these reasons, Asynchronix relies on a fully custom
|
||||
the posted events. For these reasons, NeXosim relies on a fully custom
|
||||
runtime.
|
||||
|
||||
Even though the runtime was largely influenced by Tokio, it features additional
|
||||
optimizations that make its faster than any other multi-threaded Rust executor
|
||||
on the typically message-passing-heavy workloads seen in discrete-event
|
||||
simulation (see [benchmark]). Asynchronix also improves over the state of the
|
||||
simulation (see [benchmark]). NeXosim also improves over the state of the
|
||||
art with a very fast custom MPSC channel, which performance has been
|
||||
demonstrated through [Tachyonix][tachyonix], a general-purpose offshoot of this
|
||||
channel.
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
[package]
|
||||
name = "asynchronix-util"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
asynchronix = {version = "0.2.2", path = "../asynchronix"}
|
||||
@@ -1,7 +0,0 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(not(asynchronix_loom))]
|
||||
mod general;
|
||||
|
||||
#[cfg(asynchronix_loom)]
|
||||
mod loom;
|
||||
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "nexosim-util"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
nexosim = {version = "0.2.2", path = "../nexosim"}
|
||||
File renamed without changes.
@@ -17,11 +17,11 @@
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use asynchronix::model::{Context, InitializedModel, Model};
|
||||
use asynchronix::ports::{EventBuffer, Output};
|
||||
use asynchronix::simulation::{AutoActionKey, Mailbox, SimInit, SimulationError};
|
||||
use asynchronix::time::MonotonicTime;
|
||||
use asynchronix_util::observables::{Observable, ObservableState, ObservableValue};
|
||||
use nexosim::model::{Context, InitializedModel, Model};
|
||||
use nexosim::ports::{EventBuffer, Output};
|
||||
use nexosim::simulation::{AutoActionKey, Mailbox, SimInit, SimulationError};
|
||||
use nexosim::time::MonotonicTime;
|
||||
use nexosim_util::observables::{Observable, ObservableState, ObservableValue};
|
||||
|
||||
/// House keeping TM.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
File renamed without changes.
@@ -6,7 +6,7 @@
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
use asynchronix::ports::Output;
|
||||
use nexosim::ports::Output;
|
||||
|
||||
/// Observability trait.
|
||||
pub trait Observable<T> {
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "asynchronix"
|
||||
name = "nexosim"
|
||||
# When incrementing version and releasing to crates.io:
|
||||
# - Update crate version in this Cargo.toml
|
||||
# - Update crate version in README.md
|
||||
@@ -14,7 +14,7 @@ version = "0.2.2"
|
||||
edition = "2021"
|
||||
rust-version = "1.77.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/asynchronics/asynchronix"
|
||||
repository = "https://github.com/asynchronics/nexosim"
|
||||
readme = "../README.md"
|
||||
description = """
|
||||
A high performance asychronous compute framework for system simulation.
|
||||
@@ -64,17 +64,17 @@ futures-util = "0.3"
|
||||
futures-executor = "0.3"
|
||||
tracing-subscriber = { version= "0.3.18", features=["env-filter"] }
|
||||
|
||||
[target.'cfg(asynchronix_loom)'.dev-dependencies]
|
||||
[target.'cfg(nexosim_loom)'.dev-dependencies]
|
||||
loom = "0.7"
|
||||
waker-fn = "1.1"
|
||||
|
||||
[target.'cfg(asynchronix_grpc_codegen)'.build-dependencies]
|
||||
[target.'cfg(nexosim_grpc_codegen)'.build-dependencies]
|
||||
tonic-build = { version = "0.12" }
|
||||
|
||||
[lints.rust]
|
||||
# `asynchronix_loom` flag: run loom-based tests.
|
||||
# `asynchronix_grpc_codegen` flag: regenerate gRPC code from .proto definitions.
|
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(asynchronix_loom)', 'cfg(asynchronix_grpc_codegen)'] }
|
||||
# `nexosim_loom` flag: run loom-based tests.
|
||||
# `nexosim_grpc_codegen` flag: regenerate gRPC code from .proto definitions.
|
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(nexosim_loom)', 'cfg(nexosim_grpc_codegen)'] }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
@@ -1,5 +1,5 @@
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
#[cfg(asynchronix_grpc_codegen)]
|
||||
#[cfg(nexosim_grpc_codegen)]
|
||||
tonic_build::configure()
|
||||
.build_client(false)
|
||||
.out_dir("src/grpc/codegen/")
|
||||
@@ -25,10 +25,10 @@
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use asynchronix::model::{BuildContext, Model, ProtoModel};
|
||||
use asynchronix::ports::{EventBuffer, Output};
|
||||
use asynchronix::simulation::{Mailbox, SimInit, SimulationError};
|
||||
use asynchronix::time::MonotonicTime;
|
||||
use nexosim::model::{BuildContext, Model, ProtoModel};
|
||||
use nexosim::ports::{EventBuffer, Output};
|
||||
use nexosim::simulation::{Mailbox, SimInit, SimulationError};
|
||||
use nexosim::time::MonotonicTime;
|
||||
|
||||
mod stepper_motor;
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use asynchronix::model::{Context, InitializedModel, Model};
|
||||
use asynchronix::ports::{EventSlot, Output};
|
||||
use asynchronix::simulation::{ActionKey, Mailbox, SimInit, SimulationError};
|
||||
use asynchronix::time::MonotonicTime;
|
||||
use nexosim::model::{Context, InitializedModel, Model};
|
||||
use nexosim::ports::{EventSlot, Output};
|
||||
use nexosim::simulation::{ActionKey, Mailbox, SimInit, SimulationError};
|
||||
use nexosim::time::MonotonicTime;
|
||||
|
||||
/// Water pump.
|
||||
pub struct Pump {
|
||||
@@ -24,10 +24,10 @@ use std::sync::{Arc, Condvar, Mutex};
|
||||
use std::thread::{self, sleep, JoinHandle};
|
||||
use std::time::Duration;
|
||||
|
||||
use asynchronix::model::{BuildContext, Context, InitializedModel, Model, ProtoModel};
|
||||
use asynchronix::ports::{EventBuffer, Output};
|
||||
use asynchronix::simulation::{Mailbox, SimInit, SimulationError};
|
||||
use asynchronix::time::{AutoSystemClock, MonotonicTime};
|
||||
use nexosim::model::{BuildContext, Context, InitializedModel, Model, ProtoModel};
|
||||
use nexosim::ports::{EventBuffer, Output};
|
||||
use nexosim::simulation::{Mailbox, SimInit, SimulationError};
|
||||
use nexosim::time::{AutoSystemClock, MonotonicTime};
|
||||
|
||||
const DELTA: Duration = Duration::from_millis(2);
|
||||
const PERIOD: Duration = Duration::from_millis(20);
|
||||
@@ -26,10 +26,10 @@
|
||||
//! │ ├───────────────────────────────► Total power
|
||||
//! └──────────┘
|
||||
//! ```
|
||||
use asynchronix::model::Model;
|
||||
use asynchronix::ports::{EventSlot, Output, Requestor};
|
||||
use asynchronix::simulation::{Mailbox, SimInit, SimulationError};
|
||||
use asynchronix::time::MonotonicTime;
|
||||
use nexosim::model::Model;
|
||||
use nexosim::ports::{EventSlot, Output, Requestor};
|
||||
use nexosim::simulation::{Mailbox, SimInit, SimulationError};
|
||||
use nexosim::time::MonotonicTime;
|
||||
|
||||
/// Power supply.
|
||||
pub struct PowerSupply {
|
||||
@@ -20,10 +20,10 @@
|
||||
use std::future::Future;
|
||||
use std::time::Duration;
|
||||
|
||||
use asynchronix::model::{Context, InitializedModel, Model};
|
||||
use asynchronix::ports::{EventBuffer, Output};
|
||||
use asynchronix::simulation::{Mailbox, SimInit};
|
||||
use asynchronix::time::MonotonicTime;
|
||||
use nexosim::model::{Context, InitializedModel, Model};
|
||||
use nexosim::ports::{EventBuffer, Output};
|
||||
use nexosim::simulation::{Mailbox, SimInit};
|
||||
use nexosim::time::MonotonicTime;
|
||||
|
||||
/// Stepper motor.
|
||||
pub struct Motor {
|
||||
@@ -179,7 +179,7 @@ impl Driver {
|
||||
impl Model for Driver {}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() -> Result<(), asynchronix::simulation::SimulationError> {
|
||||
fn main() -> Result<(), nexosim::simulation::SimulationError> {
|
||||
// ---------------
|
||||
// Bench assembly.
|
||||
// ---------------
|
||||
File renamed without changes.
@@ -413,7 +413,7 @@ impl<T: ?Sized> Producer<T> {
|
||||
}
|
||||
|
||||
/// Checks if the queue is closed.
|
||||
#[cfg(not(asynchronix_loom))]
|
||||
#[cfg(not(nexosim_loom))]
|
||||
fn is_closed(&self) -> bool {
|
||||
self.inner.is_closed()
|
||||
}
|
||||
@@ -449,7 +449,7 @@ impl<T: ?Sized> Consumer<T> {
|
||||
}
|
||||
|
||||
/// Returns the number of items.
|
||||
#[cfg(not(asynchronix_loom))]
|
||||
#[cfg(not(nexosim_loom))]
|
||||
fn len(&self) -> usize {
|
||||
self.inner.len()
|
||||
}
|
||||
@@ -470,7 +470,7 @@ fn queue<T: ?Sized>(capacity: usize) -> (Producer<T>, Consumer<T>) {
|
||||
}
|
||||
|
||||
/// Regular tests.
|
||||
#[cfg(all(test, not(asynchronix_loom)))]
|
||||
#[cfg(all(test, not(nexosim_loom)))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -648,7 +648,7 @@ mod tests {
|
||||
}
|
||||
|
||||
/// Loom tests.
|
||||
#[cfg(all(test, asynchronix_loom))]
|
||||
#[cfg(all(test, nexosim_loom))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
File renamed without changes.
@@ -139,7 +139,7 @@ impl Signal {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, not(asynchronix_loom)))]
|
||||
#[cfg(all(test, not(nexosim_loom)))]
|
||||
mod tests {
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,7 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(not(nexosim_loom))]
|
||||
mod general;
|
||||
|
||||
#[cfg(nexosim_loom)]
|
||||
mod loom;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,9 +1,9 @@
|
||||
//! A high-performance, discrete-event computation framework for system
|
||||
//! simulation.
|
||||
//!
|
||||
//! Asynchronix is a developer-friendly, yet highly optimized software simulator
|
||||
//! able to scale to very large simulation with complex time-driven state
|
||||
//! machines.
|
||||
//! NeXosim (né Asynchronix) is a developer-friendly, yet highly optimized
|
||||
//! software simulator able to scale to very large simulation with complex
|
||||
//! time-driven state machines.
|
||||
//!
|
||||
//! It promotes a component-oriented architecture that is familiar to system
|
||||
//! engineers and closely resembles [flow-based programming][FBP]: a model is
|
||||
@@ -12,10 +12,10 @@
|
||||
//! defined during bench assembly. Unlike in conventional flow-based
|
||||
//! programming, request-reply patterns are also possible.
|
||||
//!
|
||||
//! Asynchronix leverages asynchronous programming to perform
|
||||
//! auto-parallelization in a manner that is fully transparent to model authors
|
||||
//! and users, achieving high computational throughput on large simulation
|
||||
//! benches by means of a custom multi-threaded executor.
|
||||
//! NeXosim leverages asynchronous programming to perform auto-parallelization
|
||||
//! in a manner that is fully transparent to model authors and users, achieving
|
||||
//! high computational throughput on large simulation benches by means of a
|
||||
//! custom multi-threaded executor.
|
||||
//!
|
||||
//!
|
||||
//! [FBP]: https://en.wikipedia.org/wiki/Flow-based_programming
|
||||
@@ -83,8 +83,8 @@
|
||||
//! `Multiplier` could be implemented as follows:
|
||||
//!
|
||||
//! ```
|
||||
//! use asynchronix::model::Model;
|
||||
//! use asynchronix::ports::Output;
|
||||
//! use nexosim::model::Model;
|
||||
//! use nexosim::ports::Output;
|
||||
//!
|
||||
//! #[derive(Default)]
|
||||
//! pub struct Multiplier {
|
||||
@@ -110,8 +110,8 @@
|
||||
//!
|
||||
//! ```
|
||||
//! use std::time::Duration;
|
||||
//! use asynchronix::model::{Context, Model};
|
||||
//! use asynchronix::ports::Output;
|
||||
//! use nexosim::model::{Context, Model};
|
||||
//! use nexosim::ports::Output;
|
||||
//!
|
||||
//! #[derive(Default)]
|
||||
//! pub struct Delay {
|
||||
@@ -172,8 +172,8 @@
|
||||
//! ```
|
||||
//! # mod models {
|
||||
//! # use std::time::Duration;
|
||||
//! # use asynchronix::model::{Context, Model};
|
||||
//! # use asynchronix::ports::Output;
|
||||
//! # use nexosim::model::{Context, Model};
|
||||
//! # use nexosim::ports::Output;
|
||||
//! # #[derive(Default)]
|
||||
//! # pub struct Multiplier {
|
||||
//! # pub output: Output<f64>,
|
||||
@@ -199,9 +199,9 @@
|
||||
//! # impl Model for Delay {}
|
||||
//! # }
|
||||
//! use std::time::Duration;
|
||||
//! use asynchronix::ports::EventSlot;
|
||||
//! use asynchronix::simulation::{Mailbox, SimInit};
|
||||
//! use asynchronix::time::MonotonicTime;
|
||||
//! use nexosim::ports::EventSlot;
|
||||
//! use nexosim::simulation::{Mailbox, SimInit};
|
||||
//! use nexosim::time::MonotonicTime;
|
||||
//!
|
||||
//! use models::{Delay, Multiplier};
|
||||
//!
|
||||
@@ -237,7 +237,7 @@
|
||||
//! .add_model(delay2, delay2_mbox, "delay2")
|
||||
//! .init(t0)?;
|
||||
//!
|
||||
//! # Ok::<(), asynchronix::simulation::SimulationError>(())
|
||||
//! # Ok::<(), nexosim::simulation::SimulationError>(())
|
||||
//! ```
|
||||
//!
|
||||
//! ## Running simulations
|
||||
@@ -273,8 +273,8 @@
|
||||
//! ```
|
||||
//! # mod models {
|
||||
//! # use std::time::Duration;
|
||||
//! # use asynchronix::model::{Context, Model};
|
||||
//! # use asynchronix::ports::Output;
|
||||
//! # use nexosim::model::{Context, Model};
|
||||
//! # use nexosim::ports::Output;
|
||||
//! # #[derive(Default)]
|
||||
//! # pub struct Multiplier {
|
||||
//! # pub output: Output<f64>,
|
||||
@@ -300,9 +300,9 @@
|
||||
//! # impl Model for Delay {}
|
||||
//! # }
|
||||
//! # use std::time::Duration;
|
||||
//! # use asynchronix::ports::EventSlot;
|
||||
//! # use asynchronix::simulation::{Mailbox, SimInit};
|
||||
//! # use asynchronix::time::MonotonicTime;
|
||||
//! # use nexosim::ports::EventSlot;
|
||||
//! # use nexosim::simulation::{Mailbox, SimInit};
|
||||
//! # use nexosim::time::MonotonicTime;
|
||||
//! # use models::{Delay, Multiplier};
|
||||
//! # let mut multiplier1 = Multiplier::default();
|
||||
//! # let mut multiplier2 = Multiplier::default();
|
||||
@@ -344,23 +344,23 @@
|
||||
//! assert_eq!(simu.time(), t0 + Duration::from_secs(2));
|
||||
//! assert_eq!(output_slot.next(), Some(42.0));
|
||||
//!
|
||||
//! # Ok::<(), asynchronix::simulation::SimulationError>(())
|
||||
//! # Ok::<(), nexosim::simulation::SimulationError>(())
|
||||
//! ```
|
||||
//!
|
||||
//! # Message ordering guarantees
|
||||
//!
|
||||
//! The Asynchronix runtime is based on the [actor model][actor_model], meaning
|
||||
//! that every simulation model can be thought of as an isolated entity running
|
||||
//! in its own thread. While in practice the runtime will actually multiplex and
|
||||
//! The NeXosim runtime is based on the [actor model][actor_model], meaning that
|
||||
//! every simulation model can be thought of as an isolated entity running in
|
||||
//! its own thread. While in practice the runtime will actually multiplex and
|
||||
//! migrate models over a fixed set of kernel threads, models will indeed run in
|
||||
//! parallel whenever possible.
|
||||
//!
|
||||
//! Since Asynchronix is a time-based simulator, the runtime will always execute
|
||||
//! Since NeXosim is a time-based simulator, the runtime will always execute
|
||||
//! tasks in chronological order, thus eliminating most ordering ambiguities
|
||||
//! that could result from parallel execution. Nevertheless, it is sometimes
|
||||
//! possible for events and queries generated in the same time slice to lead to
|
||||
//! ambiguous execution orders. In order to make it easier to reason about such
|
||||
//! situations, Asynchronix provides a set of guarantees about message delivery
|
||||
//! situations, NeXosim provides a set of guarantees about message delivery
|
||||
//! order. Borrowing from the [Pony][pony] programming language, we refer to
|
||||
//! this contract as *causal messaging*, a property that can be summarized by
|
||||
//! these two rules:
|
||||
@@ -394,7 +394,7 @@
|
||||
//!
|
||||
//! ```toml
|
||||
//! [dependencies]
|
||||
//! asynchronix = { version = "0.3", features = ["tracing"] }
|
||||
//! nexosim = { version = "0.3", features = ["tracing"] }
|
||||
//! ```
|
||||
//!
|
||||
//! See the [`tracing`] module for more information.
|
||||
@@ -409,7 +409,7 @@
|
||||
//! framework.
|
||||
//!
|
||||
//! [gh_examples]:
|
||||
//! https://github.com/asynchronics/asynchronix/tree/main/asynchronix/examples
|
||||
//! https://github.com/asynchronics/nexosim/tree/main/nexosim/examples
|
||||
//!
|
||||
//! ## Modules documentation
|
||||
//!
|
||||
@@ -1,4 +1,4 @@
|
||||
#[cfg(all(test, asynchronix_loom))]
|
||||
#[cfg(all(test, nexosim_loom))]
|
||||
#[allow(unused_imports)]
|
||||
pub(crate) mod sync {
|
||||
pub(crate) use loom::sync::{Arc, LockResult, Mutex, MutexGuard};
|
||||
@@ -10,7 +10,7 @@ pub(crate) mod sync {
|
||||
};
|
||||
}
|
||||
}
|
||||
#[cfg(not(all(test, asynchronix_loom)))]
|
||||
#[cfg(not(all(test, nexosim_loom)))]
|
||||
#[allow(unused_imports)]
|
||||
pub(crate) mod sync {
|
||||
pub(crate) use std::sync::{Arc, LockResult, Mutex, MutexGuard, PoisonError};
|
||||
@@ -22,11 +22,11 @@ pub(crate) mod sync {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, asynchronix_loom))]
|
||||
#[cfg(all(test, nexosim_loom))]
|
||||
pub(crate) mod cell {
|
||||
pub(crate) use loom::cell::UnsafeCell;
|
||||
}
|
||||
#[cfg(not(all(test, asynchronix_loom)))]
|
||||
#[cfg(not(all(test, nexosim_loom)))]
|
||||
pub(crate) mod cell {
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct UnsafeCell<T>(std::cell::UnsafeCell<T>);
|
||||
@@ -50,11 +50,11 @@ pub(crate) mod cell {
|
||||
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! debug_or_loom_assert {
|
||||
($($arg:tt)*) => (if cfg!(any(debug_assertions, asynchronix_loom)) { assert!($($arg)*); })
|
||||
($($arg:tt)*) => (if cfg!(any(debug_assertions, nexosim_loom)) { assert!($($arg)*); })
|
||||
}
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! debug_or_loom_assert_eq {
|
||||
($($arg:tt)*) => (if cfg!(any(debug_assertions, asynchronix_loom)) { assert_eq!($($arg)*); })
|
||||
($($arg:tt)*) => (if cfg!(any(debug_assertions, nexosim_loom)) { assert_eq!($($arg)*); })
|
||||
}
|
||||
#[allow(unused_imports)]
|
||||
pub(crate) use debug_or_loom_assert;
|
||||
File renamed without changes.
+1
-1
@@ -123,7 +123,7 @@ impl<T> ScopedLocalKey<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, not(asynchronix_loom)))]
|
||||
#[cfg(all(test, not(nexosim_loom)))]
|
||||
mod tests {
|
||||
use std::cell::Cell;
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
@@ -36,7 +36,7 @@
|
||||
//! default implementation of the [`Model`] trait:
|
||||
//!
|
||||
//! ```
|
||||
//! use asynchronix::model::Model;
|
||||
//! use nexosim::model::Model;
|
||||
//!
|
||||
//! pub struct MyModel {
|
||||
//! // ...
|
||||
@@ -48,7 +48,7 @@
|
||||
//! methods can be explicitly implemented:
|
||||
//!
|
||||
//! ```
|
||||
//! use asynchronix::model::{Context, InitializedModel, Model};
|
||||
//! use nexosim::model::{Context, InitializedModel, Model};
|
||||
//!
|
||||
//! pub struct MyModel {
|
||||
//! // ...
|
||||
@@ -69,8 +69,8 @@
|
||||
//! explicitly implemented:
|
||||
//!
|
||||
//! ```
|
||||
//! use asynchronix::model::{BuildContext, InitializedModel, Model, ProtoModel};
|
||||
//! use asynchronix::ports::Output;
|
||||
//! use nexosim::model::{BuildContext, InitializedModel, Model, ProtoModel};
|
||||
//! use nexosim::ports::Output;
|
||||
//!
|
||||
//! /// The final model.
|
||||
//! pub struct Multiplier {
|
||||
@@ -146,8 +146,8 @@
|
||||
//! #### Example
|
||||
//!
|
||||
//! ```
|
||||
//! use asynchronix::model::Model;
|
||||
//! use asynchronix::ports::{Output, Requestor};
|
||||
//! use nexosim::model::Model;
|
||||
//! use nexosim::ports::{Output, Requestor};
|
||||
//!
|
||||
//! pub struct MyModel {
|
||||
//! pub my_output: Output<String>,
|
||||
@@ -213,7 +213,7 @@
|
||||
//! #### Example
|
||||
//!
|
||||
//! ```
|
||||
//! use asynchronix::model::{Context, Model};
|
||||
//! use nexosim::model::{Context, Model};
|
||||
//!
|
||||
//! pub struct MyModel {
|
||||
//! // ...
|
||||
@@ -264,7 +264,7 @@ pub trait Model: Sized + Send + 'static {
|
||||
/// use std::future::Future;
|
||||
/// use std::pin::Pin;
|
||||
///
|
||||
/// use asynchronix::model::{Context, InitializedModel, Model};
|
||||
/// use nexosim::model::{Context, InitializedModel, Model};
|
||||
///
|
||||
/// pub struct MyModel {
|
||||
/// // ...
|
||||
@@ -42,8 +42,8 @@ use super::{Model, ProtoModel};
|
||||
///
|
||||
/// ```
|
||||
/// use std::time::Duration;
|
||||
/// use asynchronix::model::{Context, Model};
|
||||
/// use asynchronix::ports::Output;
|
||||
/// use nexosim::model::{Context, Model};
|
||||
/// use nexosim::ports::Output;
|
||||
///
|
||||
/// #[derive(Default)]
|
||||
/// pub struct DelayedGreeter {
|
||||
@@ -120,7 +120,7 @@ impl<M: Model> Context<M> {
|
||||
/// ```
|
||||
/// use std::time::Duration;
|
||||
///
|
||||
/// use asynchronix::model::{Context, Model};
|
||||
/// use nexosim::model::{Context, Model};
|
||||
///
|
||||
/// // A timer.
|
||||
/// pub struct Timer {}
|
||||
@@ -165,9 +165,9 @@ impl<M: Model> Context<M> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use asynchronix::model::{Context, Model};
|
||||
/// use asynchronix::simulation::ActionKey;
|
||||
/// use asynchronix::time::MonotonicTime;
|
||||
/// use nexosim::model::{Context, Model};
|
||||
/// use nexosim::simulation::ActionKey;
|
||||
/// use nexosim::time::MonotonicTime;
|
||||
///
|
||||
/// // An alarm clock that can be cancelled.
|
||||
/// #[derive(Default)]
|
||||
@@ -230,8 +230,8 @@ impl<M: Model> Context<M> {
|
||||
/// ```
|
||||
/// use std::time::Duration;
|
||||
///
|
||||
/// use asynchronix::model::{Context, Model};
|
||||
/// use asynchronix::time::MonotonicTime;
|
||||
/// use nexosim::model::{Context, Model};
|
||||
/// use nexosim::time::MonotonicTime;
|
||||
///
|
||||
/// // An alarm clock beeping at 1Hz.
|
||||
/// pub struct BeepingAlarmClock {}
|
||||
@@ -290,9 +290,9 @@ impl<M: Model> Context<M> {
|
||||
/// ```
|
||||
/// use std::time::Duration;
|
||||
///
|
||||
/// use asynchronix::model::{Context, Model};
|
||||
/// use asynchronix::simulation::ActionKey;
|
||||
/// use asynchronix::time::MonotonicTime;
|
||||
/// use nexosim::model::{Context, Model};
|
||||
/// use nexosim::simulation::ActionKey;
|
||||
/// use nexosim::time::MonotonicTime;
|
||||
///
|
||||
/// // An alarm clock beeping at 1Hz that can be cancelled before it sets off, or
|
||||
/// // stopped after it sets off.
|
||||
@@ -389,9 +389,9 @@ impl<M: Model> fmt::Debug for Context<M> {
|
||||
///
|
||||
/// ```
|
||||
/// use std::time::Duration;
|
||||
/// use asynchronix::model::{BuildContext, Model, ProtoModel};
|
||||
/// use asynchronix::ports::Output;
|
||||
/// use asynchronix::simulation::Mailbox;
|
||||
/// use nexosim::model::{BuildContext, Model, ProtoModel};
|
||||
/// use nexosim::ports::Output;
|
||||
/// use nexosim::simulation::Mailbox;
|
||||
///
|
||||
/// #[derive(Default)]
|
||||
/// struct MultiplyBy2 {
|
||||
@@ -27,12 +27,12 @@
|
||||
//! assemblies, see the [`assembly example`][assembly].
|
||||
//!
|
||||
//! [assembly]:
|
||||
//! https://github.com/asynchronics/asynchronix/tree/main/asynchronix/examples/assembly.rs
|
||||
//! https://github.com/asynchronics/nexosim/tree/main/nexosim/examples/assembly.rs
|
||||
//!
|
||||
//! ```
|
||||
//! use asynchronix::model::{BuildContext, Model, ProtoModel};
|
||||
//! use asynchronix::ports::Output;
|
||||
//! use asynchronix::simulation::Mailbox;
|
||||
//! use nexosim::model::{BuildContext, Model, ProtoModel};
|
||||
//! use nexosim::ports::Output;
|
||||
//! use nexosim::simulation::Mailbox;
|
||||
//!
|
||||
//! pub struct ChildModel {
|
||||
//! pub output: Output<u64>,
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -504,7 +504,7 @@ fn recycle_vec<T, U>(mut v: Vec<T>) -> Vec<U> {
|
||||
v_out
|
||||
}
|
||||
|
||||
#[cfg(all(test, not(asynchronix_loom)))]
|
||||
#[cfg(all(test, not(nexosim_loom)))]
|
||||
mod tests {
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, Mutex};
|
||||
@@ -834,7 +834,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, asynchronix_loom))]
|
||||
#[cfg(all(test, nexosim_loom))]
|
||||
mod tests {
|
||||
use futures_channel::mpsc;
|
||||
use futures_util::StreamExt;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -408,7 +408,7 @@ impl<R> Iterator for ReplyIterator<R> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, not(asynchronix_loom)))]
|
||||
#[cfg(all(test, not(nexosim_loom)))]
|
||||
mod tests {
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, Mutex};
|
||||
@@ -738,7 +738,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, asynchronix_loom))]
|
||||
#[cfg(all(test, nexosim_loom))]
|
||||
mod tests {
|
||||
use futures_channel::mpsc;
|
||||
use futures_util::StreamExt;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -47,10 +47,10 @@
|
||||
//!
|
||||
//! ## Avoiding deadlocks
|
||||
//!
|
||||
//! While the underlying architecture of Asynchronix—the actor model—should
|
||||
//! prevent most race conditions (including obviously data races which are not
|
||||
//! possible in safe Rust) it is still possible in theory to generate deadlocks.
|
||||
//! Though rare in practice, these may occur due to one of the below:
|
||||
//! While the underlying architecture of NeXosim—the actor model—should prevent
|
||||
//! most race conditions (including obviously data races which are not possible
|
||||
//! in safe Rust) it is still possible in theory to generate deadlocks. Though
|
||||
//! rare in practice, these may occur due to one of the below:
|
||||
//!
|
||||
//! 1. *query loopback*: if a model sends a query which loops back to itself
|
||||
//! (either directly or transitively via other models), that model
|
||||
File renamed without changes.
@@ -36,8 +36,8 @@ impl Scheduler {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use asynchronix::simulation::Scheduler;
|
||||
/// use asynchronix::time::MonotonicTime;
|
||||
/// use nexosim::simulation::Scheduler;
|
||||
/// use nexosim::time::MonotonicTime;
|
||||
///
|
||||
/// fn is_third_millenium(scheduler: &Scheduler) -> bool {
|
||||
/// let time = scheduler.time();
|
||||
File renamed without changes.
@@ -15,8 +15,8 @@
|
||||
//! the specified timestamp.
|
||||
//!
|
||||
//! ```
|
||||
//! use asynchronix::model::{Context, Model};
|
||||
//! use asynchronix::time::MonotonicTime;
|
||||
//! use nexosim::model::{Context, Model};
|
||||
//! use nexosim::time::MonotonicTime;
|
||||
//!
|
||||
//! // An alarm clock model.
|
||||
//! pub struct AlarmClock {
|
||||
@@ -66,8 +66,8 @@ impl SystemClock {
|
||||
/// ```
|
||||
/// use std::time::{Duration, Instant};
|
||||
///
|
||||
/// use asynchronix::simulation::SimInit;
|
||||
/// use asynchronix::time::{MonotonicTime, SystemClock};
|
||||
/// use nexosim::simulation::SimInit;
|
||||
/// use nexosim::time::{MonotonicTime, SystemClock};
|
||||
///
|
||||
/// let t0 = MonotonicTime::new(1_234_567_890, 0).unwrap();
|
||||
///
|
||||
@@ -107,8 +107,8 @@ impl SystemClock {
|
||||
/// ```
|
||||
/// use std::time::{Duration, UNIX_EPOCH};
|
||||
///
|
||||
/// use asynchronix::simulation::SimInit;
|
||||
/// use asynchronix::time::{MonotonicTime, SystemClock};
|
||||
/// use nexosim::simulation::SimInit;
|
||||
/// use nexosim::time::{MonotonicTime, SystemClock};
|
||||
///
|
||||
/// let t0 = MonotonicTime::new(1_234_567_890, 0).unwrap();
|
||||
///
|
||||
File renamed without changes.
@@ -6,7 +6,7 @@
|
||||
//! by a model is wrapped in a [`tracing::Span`] with the following metadata:
|
||||
//!
|
||||
//! - name: `model`,
|
||||
//! - target: `asynchronix`,
|
||||
//! - target: `nexosim`,
|
||||
//! - verbosity level: [`Level::INFO`](tracing::Level::INFO),
|
||||
//! - a unique field called `name`, associated to the model name provided in
|
||||
//! [`SimInit::add_model`](crate::simulation::SimInit::add_model).
|
||||
@@ -53,7 +53,7 @@
|
||||
//! configured:
|
||||
//!
|
||||
//! ```
|
||||
//! use asynchronix::tracing::SimulationTime;
|
||||
//! use nexosim::tracing::SimulationTime;
|
||||
//!
|
||||
//! tracing_subscriber::fmt()
|
||||
//! .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
||||
@@ -105,8 +105,8 @@
|
||||
//! ```
|
||||
//!
|
||||
//! If the `model` span name collides with that of spans defined outside
|
||||
//! `asynchronix`, the above filters can be made more specific using
|
||||
//! `asynchronix[model]` instead of just `[model]`.
|
||||
//! `nexosim`, the above filters can be made more specific using
|
||||
//! `nexosim[model]` instead of just `[model]`.
|
||||
//!
|
||||
//!
|
||||
//! # Customization
|
||||
File renamed without changes.
@@ -121,7 +121,7 @@ const fn sum_masks() -> [usize; usize::BITS.trailing_zeros() as usize] {
|
||||
m
|
||||
}
|
||||
|
||||
#[cfg(all(test, not(asynchronix_loom), not(miri)))]
|
||||
#[cfg(all(test, not(nexosim_loom), not(miri)))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::util::rng;
|
||||
@@ -119,7 +119,7 @@ impl<T: Clone> DerefMut for CachedRwLockWriteGuard<'_, T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, asynchronix_loom))]
|
||||
#[cfg(all(test, nexosim_loom))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
+1
-1
@@ -423,7 +423,7 @@ struct UniqueKey<K: Copy + Clone> {
|
||||
epoch: u64,
|
||||
}
|
||||
|
||||
#[cfg(all(test, not(asynchronix_loom)))]
|
||||
#[cfg(all(test, not(nexosim_loom)))]
|
||||
mod tests {
|
||||
use std::fmt::Debug;
|
||||
|
||||
@@ -109,7 +109,7 @@ impl<K: Copy + Ord, V> PriorityQueue<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, not(asynchronix_loom)))]
|
||||
#[cfg(all(test, not(nexosim_loom)))]
|
||||
mod tests {
|
||||
use super::PriorityQueue;
|
||||
|
||||
@@ -36,7 +36,7 @@ impl Rng {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, not(asynchronix_loom), not(miri)))]
|
||||
#[cfg(all(test, not(nexosim_loom), not(miri)))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
File renamed without changes.
@@ -321,7 +321,7 @@ pub(crate) fn slot<T>() -> (SlotWriter<T>, SlotReader<T>) {
|
||||
(writer, reader)
|
||||
}
|
||||
|
||||
#[cfg(all(test, not(asynchronix_loom)))]
|
||||
#[cfg(all(test, not(nexosim_loom)))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -386,7 +386,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, asynchronix_loom))]
|
||||
#[cfg(all(test, nexosim_loom))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -208,7 +208,7 @@ impl<T: TearableAtomic> Clone for SyncCellReader<T> {
|
||||
pub(crate) struct SyncCellReadError {}
|
||||
|
||||
/// Loom tests.
|
||||
#[cfg(all(test, asynchronix_loom))]
|
||||
#[cfg(all(test, nexosim_loom))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
File renamed without changes.
File renamed without changes.
+4
-4
@@ -2,10 +2,10 @@
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use asynchronix::model::{Context, Model};
|
||||
use asynchronix::ports::{EventBuffer, Output};
|
||||
use asynchronix::simulation::{ActionKey, Mailbox, SimInit};
|
||||
use asynchronix::time::MonotonicTime;
|
||||
use nexosim::model::{Context, Model};
|
||||
use nexosim::ports::{EventBuffer, Output};
|
||||
use nexosim::simulation::{ActionKey, Mailbox, SimInit};
|
||||
use nexosim::time::MonotonicTime;
|
||||
|
||||
const MT_NUM_THREADS: usize = 4;
|
||||
|
||||
+3
-3
@@ -3,9 +3,9 @@
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use asynchronix::model::Model;
|
||||
use asynchronix::simulation::{ExecutionError, Mailbox, SimInit};
|
||||
use asynchronix::time::{AutoSystemClock, MonotonicTime};
|
||||
use nexosim::model::Model;
|
||||
use nexosim::simulation::{ExecutionError, Mailbox, SimInit};
|
||||
use nexosim::time::{AutoSystemClock, MonotonicTime};
|
||||
|
||||
const MT_NUM_THREADS: usize = 4;
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
//! Deadlock-detection for model loops.
|
||||
|
||||
use asynchronix::model::Model;
|
||||
use asynchronix::ports::{Output, Requestor};
|
||||
use asynchronix::simulation::{DeadlockInfo, ExecutionError, Mailbox, SimInit};
|
||||
use asynchronix::time::MonotonicTime;
|
||||
use nexosim::model::Model;
|
||||
use nexosim::ports::{Output, Requestor};
|
||||
use nexosim::simulation::{DeadlockInfo, ExecutionError, Mailbox, SimInit};
|
||||
use nexosim::time::MonotonicTime;
|
||||
|
||||
const MT_NUM_THREADS: usize = 4;
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
//! Model panic reporting.
|
||||
|
||||
use asynchronix::model::Model;
|
||||
use asynchronix::ports::Output;
|
||||
use asynchronix::simulation::{ExecutionError, Mailbox, SimInit};
|
||||
use asynchronix::time::MonotonicTime;
|
||||
use nexosim::model::Model;
|
||||
use nexosim::ports::Output;
|
||||
use nexosim::simulation::{ExecutionError, Mailbox, SimInit};
|
||||
use nexosim::time::MonotonicTime;
|
||||
|
||||
const MT_NUM_THREADS: usize = 4;
|
||||
|
||||
+7
-7
@@ -3,11 +3,11 @@
|
||||
use std::time::Duration;
|
||||
|
||||
#[cfg(not(miri))]
|
||||
use asynchronix::model::Context;
|
||||
use asynchronix::model::Model;
|
||||
use asynchronix::ports::{EventBuffer, Output};
|
||||
use asynchronix::simulation::{Address, Mailbox, Scheduler, SimInit, Simulation};
|
||||
use asynchronix::time::MonotonicTime;
|
||||
use nexosim::model::Context;
|
||||
use nexosim::model::Model;
|
||||
use nexosim::ports::{EventBuffer, Output};
|
||||
use nexosim::simulation::{Address, Mailbox, Scheduler, SimInit, Simulation};
|
||||
use nexosim::time::MonotonicTime;
|
||||
|
||||
const MT_NUM_THREADS: usize = 4;
|
||||
|
||||
@@ -259,7 +259,7 @@ fn schedule_periodic_keyed_events_mt() {
|
||||
use std::time::{Instant, SystemTime};
|
||||
|
||||
#[cfg(not(miri))]
|
||||
use asynchronix::time::{AutoSystemClock, Clock, SystemClock};
|
||||
use nexosim::time::{AutoSystemClock, Clock, SystemClock};
|
||||
|
||||
// Model that outputs timestamps at init and each time its input is triggered.
|
||||
#[cfg(not(miri))]
|
||||
@@ -275,7 +275,7 @@ impl TimestampModel {
|
||||
}
|
||||
#[cfg(not(miri))]
|
||||
impl Model for TimestampModel {
|
||||
async fn init(mut self, _: &mut Context<Self>) -> asynchronix::model::InitializedModel<Self> {
|
||||
async fn init(mut self, _: &mut Context<Self>) -> nexosim::model::InitializedModel<Self> {
|
||||
self.stamp.send((Instant::now(), SystemTime::now())).await;
|
||||
self.into()
|
||||
}
|
||||
+4
-4
@@ -5,10 +5,10 @@ use std::sync::Arc;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use asynchronix::model::Model;
|
||||
use asynchronix::ports::Output;
|
||||
use asynchronix::simulation::{ExecutionError, Mailbox, SimInit};
|
||||
use asynchronix::time::MonotonicTime;
|
||||
use nexosim::model::Model;
|
||||
use nexosim::ports::Output;
|
||||
use nexosim::simulation::{ExecutionError, Mailbox, SimInit};
|
||||
use nexosim::time::MonotonicTime;
|
||||
|
||||
const MT_NUM_THREADS: usize = 4;
|
||||
|
||||
Reference in new issue
Block a user