view stat.h @ 254:67c8ace9d5f6

Save time strings in UTC time and rotate datafiles at midnight UTC Time strings '05/06/2015 00:00:00.014' in datafiles were reported in Paris local time and the data files were rotated at midnight Paris time. Switch to use UTC time for both.
author Daniele Nicolodi <daniele@grinta.net>
date Fri, 05 Jun 2015 18:06:12 +0200
parents e04123ab79ef
children
line wrap: on
line source

#ifndef __STAT_H__
#define __STAT_H__

struct stat {
	int samples;
	double mean;
	double slope;
	double previous;
};

void stat_zero(struct stat *s);
void stat_accumulate(struct stat *s, double value);

/* must be a power of two */
#define _ROLLMEAN_WLEN 16

struct rollmean {
	unsigned int nobs;
	double mean;
	double acc;
	double prev[_ROLLMEAN_WLEN];
};

void rollmean_zero(struct rollmean *s);
void rollmean_accumulate(struct rollmean *s, double value);

#endif