blob: 4719d95489307f45109e1891b02ecb52f5a020b7 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001From 161496fbe1465817a77a50a1172734dae81a13ef Mon Sep 17 00:00:00 2001
2From: Mikael Beckius <mikael.beckius@windriver.com>
3Date: Tue, 12 May 2015 11:11:48 +0200
4Subject: [PATCH] lttng-tools: Fix live timer calculation error
5
6There is an calculation error for live timer. Variable switch_timer_interval is
7based on microsecond, and it is not right to assign 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 src/common/consumer-timer.c | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/src/common/consumer-timer.c b/src/common/consumer-timer.c
19index 1408052..c6202ba 100644
20--- a/src/common/consumer-timer.c
21+++ b/src/common/consumer-timer.c
22@@ -368,7 +368,7 @@ void consumer_timer_switch_start(struct lttng_consumer_channel *channel,
23 channel->switch_timer_enabled = 1;
24
25 its.it_value.tv_sec = switch_timer_interval / 1000000;
26- its.it_value.tv_nsec = switch_timer_interval % 1000000;
27+ its.it_value.tv_nsec = (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@@ -425,7 +425,7 @@ void consumer_timer_live_start(struct lttng_consumer_channel *channel,
32 channel->live_timer_enabled = 1;
33
34 its.it_value.tv_sec = live_timer_interval / 1000000;
35- its.it_value.tv_nsec = live_timer_interval % 1000000;
36+ its.it_value.tv_nsec = (live_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