Patch from Smadar Gonen <smadar.gn@gmail.com>:

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/trunk@1007 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2009-08-04 11:59:15 +00:00
parent 24f4743f68
commit 01c113dbb4
2 changed files with 8 additions and 6 deletions

View File

@@ -425,7 +425,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,
@@ -499,6 +499,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);
}

View File

@@ -28,6 +28,7 @@
#include <linux/string.h>
#include <linux/kthread.h>
#include <linux/delay.h>
#include <linux/ktime.h>
#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,
@@ -1192,7 +1193,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,
@@ -1332,7 +1333,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,
@@ -2324,7 +2325,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,
@@ -2941,7 +2942,7 @@ out:
struct timespec ts;
uint64_t finish, scst_time, proc_time;
getnstimeofday(&ts);
ktime_get_ts(&ts);
finish = scst_sec_to_nsec(ts.tv_sec) + ts.tv_nsec;
spin_lock_bh(&sess->meas_lock);