[collectd] [PATCH] - simplified heartbeat calculation

Sebastian Harl sh at tokkee.org
Mon Feb 25 23:15:28 CET 2008


Hi,

On Mon, Feb 25, 2008 at 08:14:19PM +0100, bd at bc-bd.org wrote:
> Looks simpler, should do the same.
> 
> ---
>  src/rrdtool.c |    7 +------
>  1 files changed, 1 insertions(+), 6 deletions(-)
> 
> diff --git a/src/rrdtool.c b/src/rrdtool.c
> index 65acbe3..07ea84b 100644
> --- a/src/rrdtool.c
> +++ b/src/rrdtool.c
> @@ -1110,12 +1110,7 @@ static int rrd_init (void)
>  	if (stepsize < 0)
>  		stepsize = 0;
>  	if (heartbeat <= 0)
> -	{
> -		if (stepsize > 0)
> -			heartbeat = 2 * stepsize;
> -		else
> -			heartbeat = 0;
> -	}
> +		heartbeat = 2 * stepsize;
>  
>  	if ((heartbeat > 0) && (heartbeat < interval_g))
>  		WARNING ("rrdtool plugin: Your `heartbeat' is "

Agreed - stepsize is guaranteed to be >= 0 by the if-statement right
before that, so it's really the same ;-)

Cheers,
Sebastian

-- 
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080225/4bef7a51/attachment.pgp 


More information about the collectd mailing list