From: Mikael Beckius Date: Wed, 21 Oct 2015 19:48:29 +0000 (-0400) Subject: Fix live timer calculation error X-Git-Tag: v2.6.2~15 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b6898a3c5765a64e2d843028808d9aaf5b008b6a;p=lttng-tools.git Fix live timer calculation error There is an calculation error for live timer. Variable switch_timer_interval is based on microsecond, and it is not right to assign switch_timer_interval mod 1000000 to var tv_nsec which is based on nanosecond. Signed-off-by: Mikael Beckius Signed-off-by: Jianchuan Wang Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/consumer-timer.c b/src/common/consumer-timer.c index 02b7b3a49..b35826cbb 100644 --- a/src/common/consumer-timer.c +++ b/src/common/consumer-timer.c @@ -438,7 +438,7 @@ void consumer_timer_switch_start(struct lttng_consumer_channel *channel, channel->switch_timer_enabled = 1; its.it_value.tv_sec = switch_timer_interval / 1000000; - its.it_value.tv_nsec = switch_timer_interval % 1000000; + its.it_value.tv_nsec = (switch_timer_interval % 1000000) * 1000; its.it_interval.tv_sec = its.it_value.tv_sec; its.it_interval.tv_nsec = its.it_value.tv_nsec; @@ -495,7 +495,7 @@ void consumer_timer_live_start(struct lttng_consumer_channel *channel, channel->live_timer_enabled = 1; its.it_value.tv_sec = live_timer_interval / 1000000; - its.it_value.tv_nsec = live_timer_interval % 1000000; + its.it_value.tv_nsec = (live_timer_interval % 1000000) * 1000; its.it_interval.tv_sec = its.it_value.tv_sec; its.it_interval.tv_nsec = its.it_value.tv_nsec;