@@ -65,22 +65,22 @@ static void nvme_show_common(struct nvme_passthru_cmd *cmd)
65
65
printf ("timeout_ms : %08x\n" , cmd -> timeout_ms );
66
66
}
67
67
68
- static void nvme_show_command (struct nvme_passthru_cmd * cmd , int err , struct timeval start ,
69
- struct timeval end )
68
+ static void nvme_show_command (struct nvme_passthru_cmd * cmd , int err )
70
69
{
71
70
nvme_show_common (cmd );
72
71
printf ("result : %08x\n" , cmd -> result );
73
72
printf ("err : %d\n" , err );
74
- printf ("latency : %lu us\n" ,
75
- (end .tv_sec - start .tv_sec ) * 1000000 + (end .tv_usec - start .tv_usec ));
76
73
}
77
74
78
- static void nvme_show_command64 (struct nvme_passthru_cmd64 * cmd , int err , struct timeval start ,
79
- struct timeval end )
75
+ static void nvme_show_command64 (struct nvme_passthru_cmd64 * cmd , int err )
80
76
{
81
77
nvme_show_common ((struct nvme_passthru_cmd * )cmd );
82
78
printf ("result : %" PRIx64 "\n" , (uint64_t )(uintptr_t )cmd -> result );
83
79
printf ("err : %d\n" , err );
80
+ }
81
+
82
+ static void nvme_show_latency (struct timeval start , struct timeval end )
83
+ {
84
84
printf ("latency : %lu us\n" ,
85
85
(end .tv_sec - start .tv_sec ) * 1000000 + (end .tv_usec - start .tv_usec ));
86
86
}
@@ -92,14 +92,16 @@ int nvme_submit_passthru(int fd, unsigned long ioctl_cmd,
92
92
struct timeval end ;
93
93
int err ;
94
94
95
- if (log_level >= LOG_DEBUG )
95
+ if (log_level >= LOG_INFO )
96
96
gettimeofday (& start , NULL );
97
97
98
98
err = ioctl (fd , ioctl_cmd , cmd );
99
99
100
- if (log_level >= LOG_DEBUG ) {
100
+ if (log_level >= LOG_INFO ) {
101
101
gettimeofday (& end , NULL );
102
- nvme_show_command (cmd , err , start , end );
102
+ if (log_level >= LOG_DEBUG )
103
+ nvme_show_command (cmd , err );
104
+ nvme_show_latency (start , end );
103
105
}
104
106
105
107
if (err >= 0 && result )
@@ -116,15 +118,17 @@ int nvme_submit_passthru64(int fd, unsigned long ioctl_cmd,
116
118
struct timeval end ;
117
119
int err ;
118
120
119
- if (log_level >= LOG_DEBUG )
121
+ if (log_level >= LOG_INFO )
120
122
gettimeofday (& start , NULL );
121
123
122
124
123
125
err = ioctl (fd , ioctl_cmd , cmd );
124
126
125
- if (log_level >= LOG_DEBUG ) {
127
+ if (log_level >= LOG_INFO ) {
126
128
gettimeofday (& end , NULL );
127
- nvme_show_command64 (cmd , err , start , end );
129
+ if (log_level >= LOG_DEBUG )
130
+ nvme_show_command64 (cmd , err );
131
+ nvme_show_latency (start , end );
128
132
}
129
133
130
134
if (err >= 0 && result )
0 commit comments