Skip to content

Automatic units in memory metrics #1031

Description

@SinyaWeo

Automatic unit conversion for memory metrics via bytes2human in stats.py Memory class:

       display_themed_value(
            theme_data=memory_stats_theme_data['VIRTUAL']['USED'],
            value=f"{bytes2human(sensors.Memory.virtual_used(), '%(value).1f %(symbol)s')}",
            min_size=6
        )
        display_themed_value(
            theme_data=memory_stats_theme_data['VIRTUAL']['FREE'],
            value=f"{bytes2human(sensors.Memory.virtual_free(), '%(value).1f %(symbol)s')}",
            min_size=6
        )
        display_themed_value(
            theme_data=memory_stats_theme_data['VIRTUAL']['TOTAL'],
            value=f"{bytes2human(sensors.Memory.virtual_free() + sensors.Memory.virtual_used(), '%(value).1f %(symbol)s')}",
            min_size=6
        )```

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions