Skip to content

Commit

Permalink
[#483] Add --send-copy flag to pub/sub benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Oct 21, 2024
1 parent cd27eee commit cc08d77
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
25 changes: 21 additions & 4 deletions benchmarks/publish-subscribe/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,18 @@ fn perform_benchmark<T: Service>(args: &Args) -> Result<(), Box<dyn std::error::

barrier.wait();

let mut sample = unsafe {
let mut sample = if args.send_copy {
sender_a2b
.loan_slice_uninit(args.payload_size)
.unwrap()
.assume_init()
.write_from_fn(|_| 0)
} else {
unsafe {
sender_a2b
.loan_slice_uninit(args.payload_size)
.unwrap()
.assume_init()
}
};

for _ in 0..args.iterations {
Expand Down Expand Up @@ -93,12 +100,20 @@ fn perform_benchmark<T: Service>(args: &Args) -> Result<(), Box<dyn std::error::
barrier.wait();

for _ in 0..args.iterations {
let sample = unsafe {
let sample = if args.send_copy {
sender_b2a
.loan_slice_uninit(args.payload_size)
.unwrap()
.assume_init()
.write_from_fn(|_| 0)
} else {
unsafe {
sender_b2a
.loan_slice_uninit(args.payload_size)
.unwrap()
.assume_init()
}
};

while receiver_a2b.receive().unwrap().is_none() {}

sample.send().unwrap();
Expand Down Expand Up @@ -152,6 +167,8 @@ struct Args {
/// The size in bytes of the payload that shall be used
#[clap(short, long, default_value_t = 8192)]
payload_size: usize,
#[clap(long)]
send_copy: bool,
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down
5 changes: 3 additions & 2 deletions doc/release-notes/iceoryx2-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

* Add Event-Multiplexer `WaitSet` [#390](https://github.com/eclipse-iceoryx/iceoryx2/issues/390)
* Add `PeriodicTimer` into POSIX building blocks [#425](https://github.com/eclipse-iceoryx/iceoryx2/issues/425)
* Add `--send-copy` flag to Benchmark to consider mem operations [#483](https://github.com/eclipse-iceoryx/iceoryx2/issues/483)

### Bugfixes

Expand Down Expand Up @@ -57,7 +58,7 @@

### API Breaking Changes

1. Renamed `NodeEvent` into `WaitEvent`
1. Removed `NodeEvent`. `Node::wait` returns now `Result<(), NodeWaitFailure>`

```rust
// old
Expand All @@ -66,7 +67,7 @@
}

// new
while node.wait(CYCLE_TIME) != WaitEvent::TerminationRequest {
while node.wait(CYCLE_TIME).is_ok() {
// ...
}
```

0 comments on commit cc08d77

Please sign in to comment.