0x58, 0x5e, 0xd4, 0x85
};
-#define READ 0
-#define WRITE 1
-#define TRIM 2
-#define RESERVED 3
+#define READ 3
+#define WRITE 2
+#define TRIM 1
+#define RESERVED 0
struct __attribute__((__packed__)) ssd_latency_monitor_log {
__u8 feature_status; /* 0x00 */
for (i = 0; i < C3_BUCKET_NUM; i++) {
printf(" Active Latency Time Stamp: Bucket %d ", i);
- for (j = 0; j <= 2; j++) {
+ for (j = 2; j >= 0; j--) {
if (le64_to_cpu(log_data->active_latency_timestamp[i][j]) == -1)
printf(" N/A ");
else {
for (i = 0; i < C3_BUCKET_NUM; i++) {
printf(" Active Measured Latency: Bucket %d %27d ms %27d ms %27d ms\n",
i,
- le16_to_cpu(log_data->active_measured_latency[i][READ]),
- le16_to_cpu(log_data->active_measured_latency[i][WRITE]),
- le16_to_cpu(log_data->active_measured_latency[i][TRIM]));
+ le16_to_cpu(log_data->active_measured_latency[i][READ-1]),
+ le16_to_cpu(log_data->active_measured_latency[i][WRITE-1]),
+ le16_to_cpu(log_data->active_measured_latency[i][TRIM-1]));
}
+ printf("\n");
for (i = 0; i < C3_BUCKET_NUM; i++) {
printf(" Static Bucket Counter: Bucket %d %27d %27d %27d\n",
i,
for (i = 0; i < C3_BUCKET_NUM; i++) {
printf(" Static Latency Time Stamp: Bucket %d ", i);
- for (j = 0; j <= 2; j++) {
+ for (j = 2; j >= 0; j--) {
if (le64_to_cpu(log_data->static_latency_timestamp[i][j]) == -1)
printf(" N/A ");
else {
for (i = 0; i < C3_BUCKET_NUM; i++) {
printf(" Static Measured Latency: Bucket %d %27d ms %27d ms %27d ms \n",
i,
- le16_to_cpu(log_data->static_measured_latency[i][READ]),
- le16_to_cpu(log_data->static_measured_latency[i][WRITE]),
- le16_to_cpu(log_data->static_measured_latency[i][TRIM]));
+ le16_to_cpu(log_data->static_measured_latency[i][READ-1]),
+ le16_to_cpu(log_data->static_measured_latency[i][WRITE-1]),
+ le16_to_cpu(log_data->static_measured_latency[i][TRIM-1]));
}
return 0;
char buf[128];
int i, j;
int pos = 0;
- char *operation[3] = {"Read", "Write", "Trim"};
+ char *operation[3] = {"Trim", "Write", "Read"};
root = json_create_object();
bucket = json_create_object();
sprintf(buf, "Active Latency Mode: Bucket %d", i);
- for (j = 0; j <= 2; j++) {
+ for (j = 2; j >= 0; j--) {
json_object_add_value_uint(bucket, operation[j],
log_data->active_latency_config & (1 << pos));
}
bucket = json_create_object();
sprintf(buf, "Active Bucket Counter: Bucket %d", i);
- for (j = 0; j <= 2; j++) {
+ for (j = 2; j >= 0; j--) {
json_object_add_value_uint(bucket, operation[j],
- le32_to_cpu(log_data->active_bucket_counter[i][j]));
+ le32_to_cpu(log_data->active_bucket_counter[i][j+1]));
}
json_object_add_value_object(root, buf, bucket);
}
bucket = json_create_object();
sprintf(buf, "Active Latency Time Stamp: Bucket %d", i);
- for (j = 0; j <= 2; j++) {
+ for (j = 2; j >= 0; j--) {
if (le64_to_cpu(log_data->active_latency_timestamp[i][j]) == -1)
json_object_add_value_string(bucket, operation[j], "NA");
else {
bucket = json_create_object();
sprintf(buf, "Active Measured Latency: Bucket %d", i);
- for (j = 0; j <= 2; j++) {
+ for (j = 2; j >= 0; j--) {
json_object_add_value_uint(bucket, operation[j],
le16_to_cpu(log_data->active_measured_latency[i][j]));
}
bucket = json_create_object();
sprintf(buf, "Static Bucket Counter: Bucket %d", i);
- for (j = 0; j <= 2; j++) {
+ for (j = 2; j >= 0; j--) {
json_object_add_value_uint(bucket, operation[j],
- le32_to_cpu(log_data->static_bucket_counter[i][j]));
+ le32_to_cpu(log_data->static_bucket_counter[i][j+1]));
}
json_object_add_value_object(root, buf, bucket);
}
bucket = json_create_object();
sprintf(buf, "Static Latency Time Stamp: Bucket %d", i);
- for (j = 0; j <= 2; j++) {
+ for (j = 2; j >= 0; j--) {
if (le64_to_cpu(log_data->static_latency_timestamp[i][j]) == -1)
json_object_add_value_string(bucket, operation[j], "NA");
else {
bucket = json_create_object();
sprintf(buf, "Static Measured Latency: Bucket %d", i);
- for (j = 0; j <= 2; j++) {
+ for (j = 2; j >= 0; j--) {
json_object_add_value_uint(bucket, operation[j],
le16_to_cpu(log_data->static_measured_latency[i][j]));
}