ESDM
Middleware for Earth System Data
lat-thr.h
1 /* This file is part of ESDM.
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with ESDM. If not, see <http://www.gnu.org/licenses/>.
15  */
16 #ifndef ESDM_BACKENDS_DYNAMIC_PERF_MODEL_H
17 #define ESDM_BACKENDS_DYNAMIC_PERF_MODEL_H
18 
19 #include <esdm.h>
20 #include <jansson.h>
21 #include <pthread.h>
22 
23 typedef struct {
24  double latency; // seconds
25  double throughput; // bytes per seconds
26  int size; // bytes for test
27  esdm_backend_t *backend; // reference to the corresponding backend
28  int (*esdm_backend_t_check_dynamic_perf_model_lat_thp)(esdm_backend_t *, int, float *); // Function to write data and remove
29 #ifdef ESDM_BACKENDS_DYNAMIC_PERF_MODEL_WITH_THREAD
30  double period; // seconds
31  double alpha;
32  pthread_t tid;
33  pthread_mutex_t flag;
34 #endif
36 
37 int esdm_backend_t_init_dynamic_perf_model_lat_thp(esdm_dynamic_perf_model_lat_thp_t *data);
38 
39 int esdm_backend_t_finalize_dynamic_perf_model_lat_thp(esdm_dynamic_perf_model_lat_thp_t *data);
40 
41 int esdm_backend_t_parse_dynamic_perf_model_lat_thp(json_t *perf_model_str, esdm_dynamic_perf_model_lat_thp_t *out_data);
42 
43 int esdm_backend_t_start_dynamic_perf_model_lat_thp(esdm_dynamic_perf_model_lat_thp_t *data, esdm_backend_t *backend, int (*checker)(esdm_backend_t *, int, float *));
44 
45 int esdm_backend_t_reset_dynamic_perf_model_lat_thp(esdm_dynamic_perf_model_lat_thp_t *data);
46 
47 int esdm_backend_t_update_dynamic_perf_model_lat_thp(esdm_dynamic_perf_model_lat_thp_t *data);
48 
49 int esdm_backend_t_estimate_dynamic_perf_model_lat_thp(esdm_dynamic_perf_model_lat_thp_t *data, esdm_fragment_t *fragment, float *out_time);
50 
51 int esdm_backend_t_get_dynamic_perf_model_lat_thp(esdm_dynamic_perf_model_lat_thp_t *data, char **json);
52 
53 #endif
Definition: esdm-datatypes-internal.h:197
Definition: lat-thr.h:23
Definition: esdm-datatypes-internal.h:78