Skip to content

[Feature] Add Support for Human-Readable Data Units in NVMe Attributes #756

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

StancuFlorin
Copy link

@StancuFlorin StancuFlorin commented Mar 1, 2025

Overview

This PR adds support for displaying transformed values with appropriate units for NVMe drive attributes. This enhancement improves the readability of large data values by converting them to appropriate units (MB, GB, TB, PB) based on their size.

Changes

Backend Changes

  • Added a new TransformDataUnits utility function in smart_utils.go that converts raw data values (in 512-byte units) to appropriate human-readable units
  • Updated the SmartNvmeAttribute struct to include a new ValueUnit field to store the unit type (MB, GB, TB, PB)
  • Modified the NVMe attribute metadata to support a new display type transformed_with_unit for attributes that should use this transformation
  • Applied the transformation to data-related attributes like data_units_read and data_units_written

Frontend Changes

  • Updated the detail component to display the transformed values with their appropriate units
  • Enhanced the attribute display logic to handle the new transformed values with units

Screenshots

Old Implementation

image

New Implementation

image

Related Issues

Notes

Unfortunately, the data is returned as int64 instead of float64, preventing me from displaying decimals. This is due to the existing TransformedValue field, which is of type int64.

@StancuFlorin StancuFlorin force-pushed the transformed_with_unit branch from 6beab8e to ccd0feb Compare March 1, 2025 14:21
@StancuFlorin StancuFlorin changed the title Transformed with unit [FEAT] Add Support for Human-Readable Data Units in NVMe Attributes Mar 1, 2025
@StancuFlorin StancuFlorin force-pushed the transformed_with_unit branch from ccd0feb to 9b8140a Compare March 1, 2025 14:44
@StancuFlorin StancuFlorin force-pushed the transformed_with_unit branch from 6cffb42 to 8b34dfc Compare March 1, 2025 15:02
@StancuFlorin StancuFlorin changed the title [FEAT] Add Support for Human-Readable Data Units in NVMe Attributes [Feature] Add Support for Human-Readable Data Units in NVMe Attributes Mar 1, 2025
@StancuFlorin
Copy link
Author

@AnalogJ - can you please take a look on this one? thanks!

@AnalogJ
Copy link
Owner

AnalogJ commented Mar 22, 2025

Hey @StancuFlorin

my concern is that the raw data structure is not standardized across device manufacturers, so I'm worried that this may be incorrect for some users.

@StancuFlorin
Copy link
Author

@AnalogJ - I also considered this. However, the formula used to display the human readable data is the one from the attribute description (the one displayed on the left).

Additionally, you can still view the RAW data in the normalized field, in case the formula is wrong.

@StancuFlorin
Copy link
Author

@AnalogJ - any second thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants