My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
timeseries.h
Go to the documentation of this file.
1 /*
2 START OF LICENSE STUB
3  DeDOS: Declarative Dispersion-Oriented Software
4  Copyright (C) 2017 University of Pennsylvania, Georgetown University
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 END OF LICENSE STUB
19 */
26 #ifndef TIMESERIES_H
27 #define TIMESERIES_H
28 #include "stats.h"
29 #include <time.h>
30 
32 #define RRDB_ENTRIES 240
33 
36 struct timed_rrdb {
37  double data[RRDB_ENTRIES];
38  struct timespec time[RRDB_ENTRIES];
40 };
41 
42 // Have to put this here to deal with ciruclar depedency :(
43 #include "dfg.h"
44 
46 double average_n(struct timed_rrdb *timeseries, int n_samples);
47 
49 int append_to_timeseries(struct timed_stat *input, int input_size,
50  struct timed_rrdb *timeseries);
51 
53 void print_timeseries(struct timed_rrdb *ts);
54 
55 
56 #endif
Round-robin database (circular buffer) for storing timeseries data.
Definition: timeseries.h:36
double data[240]
The statistics.
Definition: timeseries.h:37
int append_to_timeseries(struct timed_stat *input, int input_size, struct timed_rrdb *timeseries)
Appends a number of timed statistics to a timeseries.
Definition: timeseries.c:58
double average_n(struct timed_rrdb *timeseries, int n_samples)
Calculates the average of the last n stats for a given MSU.
Definition: timeseries.c:31
Functions for the sending and receiving of statistics between ctrl and runtime.
int write_index
Offset into the rrdb at which writing has occurred.
Definition: timeseries.h:39
#define RRDB_ENTRIES
timeseries.h
Definition: timeseries.h:32
Interfaces for the creation and modification of the data-flow-graph and and general description of th...
Holds a single timestamped value.
Definition: stats.h:37
struct timespec time[240]
The time at which the stats were gathered.
Definition: timeseries.h:38
void print_timeseries(struct timed_rrdb *ts)
Prints the beginning and end of a timeseries.
Definition: timeseries.c:82