Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add counters to thermal and sensor-polling ringbufs #1686

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions drv/i2c-devices/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ zerocopy = { workspace = true }
derive-idol-err = { path = "../../lib/derive-idol-err" }
drv-i2c-api = { path = "../i2c-api" }
drv-onewire = { path = "../onewire" }
counters = { path = "../../lib/counters" }
ringbuf = { path = "../../lib/ringbuf" }
task-power-api = { path = "../../task/power-api" }
userlib = { path = "../../sys/userlib" }
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/mwocp68.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct Mwocp68 {
mode: Cell<Option<pmbus::VOutModeCommandData>>,
}

#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, counters::Count)]
pub enum Error {
BadRead { cmd: u8, code: ResponseCode },
BadWrite { cmd: u8, code: ResponseCode },
Expand Down
1 change: 1 addition & 0 deletions task/sensor-polling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ zerocopy = { workspace = true }

drv-i2c-api = { path = "../../drv/i2c-api" }
drv-i2c-devices = { path = "../../drv/i2c-devices" }
counters = { path = "../../lib/counters" }
ringbuf = { path = "../../lib/ringbuf" }
task-sensor-api = { path = "../sensor-api" }
userlib = { path = "../../sys/userlib", features = ["panic-messages"] }
Expand Down
14 changes: 8 additions & 6 deletions task/sensor-polling/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ pub enum Device {
Mwocp68,
}

#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, counters::Count)]
pub enum Error {
Mwocp68Error(Mwocp68Error),
Mwocp68Error(#[count(children)] Mwocp68Error),
}

impl From<Error> for task_sensor_api::NoData {
Expand Down Expand Up @@ -101,14 +101,16 @@ impl TemperatureSensor {

////////////////////////////////////////////////////////////////////////////////

#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, counters::Count)]
enum Trace {
#[count(skip)]
None,
#[count(skip)]
Start,
SpeedReadFailed(SensorId, Error),
TemperatureReadFailed(SensorId, Error),
SpeedReadFailed(SensorId, #[count(children)] Error),
TemperatureReadFailed(SensorId, #[count(children)] Error),
}
ringbuf!(Trace, 32, Trace::None);
counted_ringbuf!(Trace, 32, Trace::None);

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion task/thermal-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl ThermalProperties {
counters::Count,
)]
pub enum SensorReadError {
I2cError(#[count(children)] ResponseCode),
I2cError(ResponseCode),

/// The sensor reported that data is either not present or too old
NoData,
Expand Down
9 changes: 5 additions & 4 deletions task/thermal/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,18 @@ task_slot!(SENSOR, sensor);
enum Trace {
#[count(skip)]
None,
#[count(skip)]
Start,
ThermalMode(#[count(children)] ThermalMode),
AutoState(#[count(children)] ThermalAutoState),
FanReadFailed(SensorId, ResponseCode),
MiscReadFailed(SensorId, SensorReadError),
SensorReadFailed(SensorId, SensorReadError),
MiscReadFailed(SensorId, #[count(children)] SensorReadError),
SensorReadFailed(SensorId, #[count(children)] SensorReadError),
ControlPwm(u8),
PowerModeChanged(PowerBitmask),
PowerDownFailed(SeqError),
PowerDownFailed(#[count(children)] SeqError),
ControlError(#[count(children)] ThermalError),
FanPresenceUpdateFailed(SeqError),
FanPresenceUpdateFailed(#[count(children)] SeqError),
FanAdded(Fan),
FanRemoved(Fan),
PowerDownAt(u64),
Expand Down
Loading