提交 cdd04d98 编写于 作者: Y YOSHIFUJI Hideaki 提交者: David S. Miller

[DCCP]: Convert do_gettimeofday() to getnstimeofday().

What do_gettimeofday() does is to call getnstimeofday() and
to convert the result from timespec{} to timeval{}.
We do not always need timeval{} and we can convert timespec{}
when we really need (to print).
Signed-off-by: NYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Acked-by: NArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 633d424b
...@@ -46,29 +46,24 @@ struct { ...@@ -46,29 +46,24 @@ struct {
struct kfifo *fifo; struct kfifo *fifo;
spinlock_t lock; spinlock_t lock;
wait_queue_head_t wait; wait_queue_head_t wait;
struct timeval tstart; struct timespec tstart;
} dccpw; } dccpw;
static void printl(const char *fmt, ...) static void printl(const char *fmt, ...)
{ {
va_list args; va_list args;
int len; int len;
struct timeval now; struct timespec now;
char tbuf[256]; char tbuf[256];
va_start(args, fmt); va_start(args, fmt);
do_gettimeofday(&now); getnstimeofday(&now);
now.tv_sec -= dccpw.tstart.tv_sec; now = timespec_sub(now, dccpw.tstart);
now.tv_usec -= dccpw.tstart.tv_usec;
if (now.tv_usec < 0) {
--now.tv_sec;
now.tv_usec += 1000000;
}
len = sprintf(tbuf, "%lu.%06lu ", len = sprintf(tbuf, "%lu.%06lu ",
(unsigned long) now.tv_sec, (unsigned long) now.tv_sec,
(unsigned long) now.tv_usec); (unsigned long) now.tv_nsec / NSEC_PER_USEC);
len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args); len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args);
va_end(args); va_end(args);
...@@ -119,7 +114,7 @@ static struct jprobe dccp_send_probe = { ...@@ -119,7 +114,7 @@ static struct jprobe dccp_send_probe = {
static int dccpprobe_open(struct inode *inode, struct file *file) static int dccpprobe_open(struct inode *inode, struct file *file)
{ {
kfifo_reset(dccpw.fifo); kfifo_reset(dccpw.fifo);
do_gettimeofday(&dccpw.tstart); getnstimeofday(&dccpw.tstart);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册