blob: 03120fe5d69d4f980141d8a2a69c65243ac52eb7 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001From 6d02a6c1aeb1d050ffe7c6624bab9acfa76fc05f Mon Sep 17 00:00:00 2001
2From: Mikael Beckius <mikael.beckius@windriver.com>
3Date: Tue, 12 May 2015 11:04:34 +0200
4Subject: [PATCH] lttng-ust:Fix live timer calculation error
5
6There is an calculation error for live timer. Variable chan->switch_timer_interval is
7based on microsecond, and it is not right to assign chan->switch_timer_interval mod
81000000 to var tv_nsec which is based on nanosecond.
9
10Upstream-Status: Pending
11
12Signed-off-by: Mikael Beckius <mikael.beckius@windriver.com>
13Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com>
14---
15 libringbuffer/ring_buffer_frontend.c | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/libringbuffer/ring_buffer_frontend.c b/libringbuffer/ring_buffer_frontend.c
19index eb4e486..e0377a3 100644
20--- a/libringbuffer/ring_buffer_frontend.c
21+++ b/libringbuffer/ring_buffer_frontend.c
22@@ -528,7 +528,7 @@ void lib_ring_buffer_channel_switch_timer_start(struct channel *chan)
23 }
24
25 its.it_value.tv_sec = chan->switch_timer_interval / 1000000;
26- its.it_value.tv_nsec = chan->switch_timer_interval % 1000000;
27+ its.it_value.tv_nsec = (chan->switch_timer_interval % 1000000) * 1000;
28 its.it_interval.tv_sec = its.it_value.tv_sec;
29 its.it_interval.tv_nsec = its.it_value.tv_nsec;
30
31@@ -582,7 +582,7 @@ void lib_ring_buffer_channel_read_timer_start(struct channel *chan)
32 }
33
34 its.it_value.tv_sec = chan->read_timer_interval / 1000000;
35- its.it_value.tv_nsec = chan->read_timer_interval % 1000000;
36+ its.it_value.tv_nsec = (chan->read_timer_interval % 1000000) * 1000;
37 its.it_interval.tv_sec = its.it_value.tv_sec;
38 its.it_interval.tv_nsec = its.it_value.tv_nsec;
39
40--
411.9.1
42