Fix live timer calculation error
authorMikael Beckius <mikael.beckius@windriver.com>
Wed, 21 Oct 2015 19:48:29 +0000 (15:48 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 21 Oct 2015 19:49:34 +0000 (15:49 -0400)
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 <mikael.beckius@windriver.com>
Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/consumer/consumer-timer.c

index 3c9b3feb7d47f48820dcdbdb7d1b9cf819b98014..931f7471fc6fe974982ff1cb687750ff68f80a7c 100644 (file)
@@ -437,7 +437,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;
 
@@ -494,7 +494,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;
 
This page took 0.0274 seconds and 4 git commands to generate.