From 05e2ad34521f3bb2a558de66363b93d58e90a75a Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 4 Aug 2009 12:03:53 +0000 Subject: [PATCH] Merge of r1007: Patch from Smadar Gonen : The following fixes were made: - Use monotonic clock as time source instead of a real-time clock so change of system time will not affect calculation. - Init scst_time to 0 + minor display fix. git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/1.0.1.x@1008 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_proc.c | 3 ++- scst/src/scst_targ.c | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index ec8c125a8..41e982da2 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -419,7 +419,7 @@ static int lat_info_show(struct seq_file *seq, void *v) "Target name", "Initiator name", "SCST latency", - "Processing latency (us)"); + "Processing latency (ns)"); list_for_each_entry(acg, &scst_acg_list, scst_acg_list_entry) { list_for_each_entry(sess, &acg->acg_sess_list, @@ -493,6 +493,7 @@ static ssize_t scst_proc_scsi_tgt_gen_write_lat(struct file *file, sess->initiator_name); spin_lock_bh(&sess->meas_lock); sess->processing_time = 0; + sess->scst_time = 0; sess->processed_cmds = 0; spin_unlock_bh(&sess->meas_lock); } diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 91def4fd3..2688dc34e 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "scst.h" #include "scst_priv.h" @@ -198,7 +199,7 @@ void scst_cmd_init_done(struct scst_cmd *cmd, #ifdef CONFIG_SCST_MEASURE_LATENCY { struct timespec ts; - getnstimeofday(&ts); + ktime_get_ts(&ts); cmd->start = scst_sec_to_nsec(ts.tv_sec) + ts.tv_nsec; TRACE_DBG("cmd %p (sess %p): start %lld (tv_sec %ld, " "tv_nsec %ld)", cmd, sess, cmd->start, ts.tv_sec, @@ -1216,7 +1217,7 @@ static void scst_do_cmd_done(struct scst_cmd *cmd, int result, #ifdef CONFIG_SCST_MEASURE_LATENCY { struct timespec ts; - getnstimeofday(&ts); + ktime_get_ts(&ts); cmd->post_exec_start = scst_sec_to_nsec(ts.tv_sec) + ts.tv_nsec; TRACE_DBG("cmd %p (sess %p): post_exec_start %lld (tv_sec %ld, " "tv_nsec %ld)", cmd, cmd->sess, cmd->post_exec_start, @@ -1356,7 +1357,7 @@ static void scst_cmd_done_local(struct scst_cmd *cmd, int next_state, #ifdef CONFIG_SCST_MEASURE_LATENCY { struct timespec ts; - getnstimeofday(&ts); + ktime_get_ts(&ts); cmd->post_exec_start = scst_sec_to_nsec(ts.tv_sec) + ts.tv_nsec; TRACE_DBG("cmd %p (sess %p): post_exec_start %lld (tv_sec %ld, " "tv_nsec %ld)", cmd, cmd->sess, cmd->post_exec_start, @@ -2240,7 +2241,7 @@ static int scst_send_for_exec(struct scst_cmd **active_cmd) #ifdef CONFIG_SCST_MEASURE_LATENCY if (cmd->pre_exec_finish == 0) { struct timespec ts; - getnstimeofday(&ts); + ktime_get_ts(&ts); cmd->pre_exec_finish = scst_sec_to_nsec(ts.tv_sec) + ts.tv_nsec; TRACE_DBG("cmd %p (sess %p): pre_exec_finish %lld (tv_sec %ld, " "tv_nsec %ld)", cmd, cmd->sess, cmd->pre_exec_finish, @@ -2853,7 +2854,7 @@ out: uint64_t finish, scst_time, proc_time; struct scst_session *sess = cmd->sess; - getnstimeofday(&ts); + ktime_get_ts(&ts); finish = scst_sec_to_nsec(ts.tv_sec) + ts.tv_nsec; spin_lock_bh(&sess->meas_lock);