Skip to content

Commit

Permalink
Move benchmar
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Nov 22, 2024
1 parent 173a128 commit a611639
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 81 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[alias]
xtask = "run --package xtask --"
xfmt = "xtask fmt-packages"
qa = "xtask run-example qa-test"
15 changes: 0 additions & 15 deletions esp-hal-embassy/bench/.cargo/config.toml

This file was deleted.

41 changes: 0 additions & 41 deletions esp-hal-embassy/bench/Cargo.toml

This file was deleted.

9 changes: 0 additions & 9 deletions esp-hal-embassy/bench/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions esp-hal-embassy/bench/build.rs

This file was deleted.

2 changes: 0 additions & 2 deletions esp-hal-embassy/bench/rust-toolchain.toml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//! Embassy executor benchmark, used to try out optimization ideas.

//% CHIPS: esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
//% FEATURES: esp-hal-embassy/integrated-timers

#![no_std]
#![no_main]

Expand All @@ -9,15 +14,15 @@ use core::{

use embassy_executor::{raw::TaskStorage, Spawner};
use esp_backtrace as _;
use esp_println::println;
use esp_hal::{
prelude::*,
time::Duration,
timer::{
systimer::{SystemTimer, Target},
systimer::SystemTimer,
OneShotTimer,
},
};
use log::info;

static mut COUNTER: u32 = 0;

Expand All @@ -30,7 +35,7 @@ fn timer_handler() {
let cpu_clock = CLOCK.hz() as u64;
let timer_ticks_per_second = SystemTimer::ticks_per_second();
let cpu_cycles_per_timer_ticks = cpu_clock / timer_ticks_per_second;
info!(
println!(
"Test OK, count={}, cycles={}/100",
c,
(100 * timer_ticks_per_second * cpu_cycles_per_timer_ticks * TEST_MILLIS / 1000) / c
Expand All @@ -51,24 +56,20 @@ impl Future for Task1 {

static TASK1: TaskStorage<Task1> = TaskStorage::new();

#[main]
#[esp_hal_embassy::main]
async fn main(spawner: Spawner) {
let peripherals = esp_hal::init({
let mut config = esp_hal::Config::default();
config.cpu_clock = CLOCK;
config
});

esp_println::logger::init_logger_from_env();

let systimer =
esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER).split::<Target>();
let systimer = SystemTimer::new(peripherals.SYSTIMER);
esp_hal_embassy::init(systimer.alarm0);
info!("Embassy initialized!");
println!("Embassy initialized!");

spawner.spawn(TASK1.spawn(|| Task1 {})).unwrap();

info!("Starting test");
println!("Starting test");

let mut timer = OneShotTimer::new(systimer.alarm1);
timer.set_interrupt_handler(timer_handler);
Expand Down

0 comments on commit a611639

Please sign in to comment.