My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
rt_stats.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 RT_STATS_H_
27 #define RT_STATS_H_
28 #include "stats.h"
29 
30 #include <stdbool.h>
31 
36 int remove_stat_item(enum stat_id stat_id, unsigned int item_id);
37 
42 int init_stat_item(enum stat_id stat_id, unsigned int item_id);
43 
47 int init_statistics();
48 
53 void finalize_statistics(char *statlog);
54 
62 int record_start_time(enum stat_id stat_id, unsigned int item_id);
63 
69 int record_end_time(enum stat_id stat_id, unsigned int item_id);
70 
78 int increment_stat(enum stat_id stat_id, unsigned int item_id, double value);
79 
88 int record_stat(enum stat_id stat_id, unsigned int item_id, double stat, bool relog);
89 
91 double get_last_stat(enum stat_id stat_id, unsigned int item_id);
92 
100 struct stat_sample *get_stat_samples(enum stat_id stat_id, struct timespec *time,
101  int *n_sample_out);
102 #endif
103 
int record_end_time(enum stat_id stat_id, unsigned int item_id)
Records the elapsed time since the previous call to record_start_time.
Definition: rt_stats.c:355
void finalize_statistics(char *statlog)
Writes the statistics to statlog if provided, and frees assocated structure.
Definition: rt_stats.c:822
int init_statistics()
Initializes the entire stats module.
Definition: rt_stats.c:783
A single stat sample for a single item.
Definition: stats.h:53
stat_id
The identifiers with which stats can be logged.
Definition: stat_ids.h:32
int record_stat(enum stat_id stat_id, unsigned int item_id, double stat, bool relog)
Records a statistic in the statlog.
Definition: rt_stats.c:426
double get_last_stat(enum stat_id stat_id, unsigned int item_id)
Returns the last statistic recorded.
Definition: rt_stats.c:466
Functions for the sending and receiving of statistics between ctrl and runtime.
struct stat_sample * get_stat_samples(enum stat_id stat_id, struct timespec *time, int *n_sample_out)
Samples the statistic with the provided stat_id.
Definition: rt_stats.c:634
int record_start_time(enum stat_id stat_id, unsigned int item_id)
Starts a measurement of elapsed time.
Definition: rt_stats.c:320
int remove_stat_item(enum stat_id stat_id, unsigned int item_id)
Un-registers an item so it can no longer have statistics registered, and will not be reported to the ...
Definition: rt_stats.c:683
int init_stat_item(enum stat_id stat_id, unsigned int item_id)
Initializes a new stat item so it can have stats registered and can be reported to the global control...
Definition: rt_stats.c:719
int increment_stat(enum stat_id stat_id, unsigned int item_id, double value)
Increments the given statistic by the provided value.
Definition: rt_stats.c:389