Skip to content

Commit 52cd270

Browse files
committed
samples: bench: Remove the 'basesem' prototype
This was an experiment to see if using an atomic to manage semaphore initialization was workable. Now that the main Semaphore implementation works this way, this can just be removed. Signed-off-by: David Brown <[email protected]>
1 parent 234379e commit 52cd270

File tree

2 files changed

+0
-153
lines changed

2 files changed

+0
-153
lines changed

samples/bench/src/basesem.rs

Lines changed: 0 additions & 117 deletions
This file was deleted.

samples/bench/src/lib.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ use zephyr::{
3333
work::{WorkQueue, WorkQueueBuilder},
3434
};
3535

36-
mod basesem;
37-
3836
/// How many threads to run in the tests.
3937
const NUM_THREADS: usize = 6;
4038

@@ -61,7 +59,6 @@ extern "C" fn rust_main() {
6159
}
6260

6361
tester.run(Command::Empty);
64-
tester.run(Command::BaseSemPingPong(NUM_THREADS, 10_000));
6562
tester.run(Command::SimpleSem(10_000));
6663
tester.run(Command::SimpleSemAsync(10_000));
6764
tester.run(Command::SimpleSemYield(10_000));
@@ -121,10 +118,6 @@ struct ThreadTests {
121118
/// The test also all return their result to the main. The threads Send, the main running
122119
/// receives.
123120
results: ChanPair<Result>,
124-
125-
/// For the base sem test, just use these, which are just shared by reference.
126-
forward: basesem::Semaphore,
127-
reverse: basesem::Semaphore,
128121
}
129122

130123
impl ThreadTests {
@@ -155,8 +148,6 @@ impl ThreadTests {
155148
low_command: low_send,
156149
high_command: high_send,
157150
workq,
158-
forward: basesem::Semaphore::new(0, 1),
159-
reverse: basesem::Semaphore::new(0, 1),
160151
};
161152

162153
let mut thread_commands = Vec::new();
@@ -449,11 +440,6 @@ impl ThreadTests {
449440
continue;
450441
}
451442
}
452-
453-
Command::BaseSemPingPong(_nthread, count) => {
454-
this.base_worker(count);
455-
total = count;
456-
}
457443
}
458444

459445
this.results
@@ -639,23 +625,6 @@ impl ThreadTests {
639625
let _ = this;
640626
}
641627

642-
fn base_worker(&self, count: usize) {
643-
for _ in 0..count {
644-
self.forward.take(Forever).unwrap();
645-
self.reverse.give();
646-
}
647-
}
648-
649-
// In the low runner, does the ping-pong with each.
650-
fn base_replier(&self, nthread: usize, count: usize) {
651-
for _ in 0..count {
652-
for _ in 0..nthread {
653-
self.forward.give();
654-
self.reverse.take(Forever).unwrap();
655-
}
656-
}
657-
}
658-
659628
/// And the low priority worker.
660629
fn low_runner(this: Arc<Self>, command: Receiver<Command>) {
661630
let _ = this;
@@ -685,9 +654,6 @@ impl ThreadTests {
685654
}
686655
Command::SemPingPongAsync(_) => (),
687656
Command::SemOnePingPongAsync(_, _) => (),
688-
Command::BaseSemPingPong(nthread, count) => {
689-
this.base_replier(nthread, count);
690-
}
691657
}
692658
// printkln!("low command: {:?}", cmd);
693659

@@ -720,7 +686,6 @@ impl ThreadTests {
720686
}
721687
Command::SemPingPongAsync(_) => (),
722688
Command::SemOnePingPongAsync(_, _) => (),
723-
Command::BaseSemPingPong(_, _) => (),
724689
}
725690
// printkln!("high command: {:?}", cmd);
726691

@@ -779,7 +744,6 @@ enum Command {
779744
SemOnePingPong(usize),
780745
/// Same as SemOnePingPong, but async. The first parameter is the number of async tasks.
781746
SemOnePingPongAsync(usize, usize),
782-
BaseSemPingPong(usize, usize),
783747
}
784748

785749
enum Result {

0 commit comments

Comments
 (0)