From 18119bca348232fc1e38d429f860a93650f07ef4 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 24 Dec 2019 17:42:56 +0800 Subject: [PATCH] Shannon Plugin update. --- plugins/shannon/shannon-nvme.c | 47 ++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/plugins/shannon/shannon-nvme.c b/plugins/shannon/shannon-nvme.c index 80db4665..175d1e7c 100644 --- a/plugins/shannon/shannon-nvme.c +++ b/plugins/shannon/shannon-nvme.c @@ -39,7 +39,9 @@ typedef enum { #pragma pack(push,1) struct nvme_shannon_smart_log_item { - __u8 _resv[5]; + __u8 rsv1[3]; + __u8 norm; + __u8 rsv2; union { __u8 item_val[6]; struct wear_level { @@ -52,7 +54,7 @@ struct nvme_shannon_smart_log_item { __u32 count; } thermal_throttle; }; - __u8 resv; + __u8 _resv; }; #pragma pack(pop) @@ -66,35 +68,48 @@ static void show_shannon_smart_log(struct nvme_shannon_smart_log *smart, { printf("Additional Smart Log for NVME device:%s namespace-id:%x\n", devname, nsid); - printf("key value\n"); - printf("program_fail_count : %"PRIu64"\n", + printf("key normalized value\n"); + printf("program_fail_count : %3d%% %"PRIu64"\n", + smart->items[PROGRAM_FAIL_CNT].norm, int48_to_long(smart->items[PROGRAM_FAIL_CNT].item_val)); - printf("erase_fail_count : %"PRIu64"\n", + printf("erase_fail_count : %3d%% %"PRIu64"\n", + smart->items[ERASE_FAIL_CNT].norm, int48_to_long(smart->items[ERASE_FAIL_CNT].item_val)); - printf("wear_leveling : min: %u, max: %u, avg: %u\n", + printf("wear_leveling : %3d%% min: %u, max: %u, avg: %u\n", + smart->items[WEARLEVELING_COUNT].norm, le16_to_cpu(smart->items[WEARLEVELING_COUNT].wear_level.min), le16_to_cpu(smart->items[WEARLEVELING_COUNT].wear_level.max), le16_to_cpu(smart->items[WEARLEVELING_COUNT].wear_level.avg)); - printf("end_to_end_error_detection_count: %"PRIu64"\n", + printf("end_to_end_error_detection_count: %3d%% %"PRIu64"\n", + smart->items[E2E_ERR_CNT].norm, int48_to_long(smart->items[E2E_ERR_CNT].item_val)); - printf("crc_error_count : %"PRIu64"\n", + printf("crc_error_count : %3d%% %"PRIu64"\n", + smart->items[CRC_ERR_CNT].norm, int48_to_long(smart->items[CRC_ERR_CNT].item_val)); - printf("timed_workload_media_wear : %.3f%%\n", + printf("timed_workload_media_wear : %3d%% %.3f%%\n", + smart->items[TIME_WORKLOAD_MEDIA_WEAR].norm, ((float)int48_to_long(smart->items[TIME_WORKLOAD_MEDIA_WEAR].item_val)) / 1024); - printf("timed_workload_host_reads : %"PRIu64"%%\n", + printf("timed_workload_host_reads : %3d%% %"PRIu64"%%\n", + smart->items[TIME_WORKLOAD_HOST_READS].norm, int48_to_long(smart->items[TIME_WORKLOAD_HOST_READS].item_val)); - printf("timed_workload_timer : %"PRIu64" min\n", + printf("timed_workload_timer : %3d%% %"PRIu64" min\n", + smart->items[TIME_WORKLOAD_TIMER].norm, int48_to_long(smart->items[TIME_WORKLOAD_TIMER].item_val)); - printf("thermal_throttle_status : CurTTState: %u%%, TTActiveCnt: %u\n", + printf("thermal_throttle_status : %3d%% CurTTSta: %u%%, TTCnt: %u\n", + smart->items[THERMAL_THROTTLE].norm, smart->items[THERMAL_THROTTLE].thermal_throttle.st, smart->items[THERMAL_THROTTLE].thermal_throttle.count); - printf("retry_buffer_overflow_count : %"PRIu64"\n", + printf("retry_buffer_overflow_count : %3d%% %"PRIu64"\n", + smart->items[RETRY_BUFFER_OVERFLOW].norm, int48_to_long(smart->items[RETRY_BUFFER_OVERFLOW].item_val)); - printf("pll_lock_loss_count : %"PRIu64"\n", + printf("pll_lock_loss_count : %3d%% %"PRIu64"\n", + smart->items[PLL_LOCK_LOSS].norm, int48_to_long(smart->items[PLL_LOCK_LOSS].item_val)); - printf("nand_bytes_written : sectors: %"PRIu64"\n", + printf("nand_bytes_written : %3d%% sectors: %"PRIu64"\n", + smart->items[NAND_WRITE].norm, int48_to_long(smart->items[NAND_WRITE].item_val)); - printf("host_bytes_written : sectors: %"PRIu64"\n", + printf("host_bytes_written : %3d%% sectors: %"PRIu64"\n", + smart->items[HOST_WRITE].norm, int48_to_long(smart->items[HOST_WRITE].item_val)); } -- 2.50.1