Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
Loading...
Searching...
No Matches
arax_throttle.h
Go to the documentation of this file.
1#ifndef ARAX_THROTTLE_HEADER
2#define ARAX_THROTTLE_HEADER
3
5
6#include "async.h"
7
8#ifdef __cplusplus
9extern "C" {
10#endif /* ifdef __cplusplus */
11
13{
14 size_t available;
15 size_t capacity;
17 #ifdef ARAX_THROTTLE_DEBUG
18 volatile size_t print_cnt;
19 utils_spinlock lock;
20 #endif
21};
22
23#ifdef ARAX_THROTTLE_DEBUG
24#define ARAX_THROTTLE_DEBUG_PARAMS , const char *func
25#define ARAX_THROTTLE_DEBUG_FUNC(FUNC) __ ## FUNC
26#define ARAX_THROTTLE_DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
27#define arax_throttle_size_inc(thr, sz) __arax_throttle_size_inc(thr, sz, __func__)
28#define arax_throttle_size_dec(thr, sz) __arax_throttle_size_dec(thr, sz, __func__)
29#else
30#define ARAX_THROTTLE_DEBUG_PARAMS
31#define ARAX_THROTTLE_DEBUG_FUNC(FUNC) FUNC
32#define ARAX_THROTTLE_DEBUG_PRINT(...) ({ })
33#endif
34
42void arax_throttle_init(async_meta_s *meta, arax_throttle_s *thr, size_t a_sz, size_t t_sz);
43
52
61
69
77
78
79#ifdef __cplusplus
80}
81#endif /* ifdef __cplusplus */
82
83#endif /* ifndef ARAX_THROTTLE_HEADER */
volatile uint32_t utils_spinlock
Definition spinlock.h:10
#define ARAX_THROTTLE_DEBUG_FUNC(FUNC)
size_t arax_throttle_get_available_size(arax_throttle_s *thr)
#define ARAX_THROTTLE_DEBUG_PARAMS
void arax_throttle_init(async_meta_s *meta, arax_throttle_s *thr, size_t a_sz, size_t t_sz)
size_t arax_throttle_get_total_size(arax_throttle_s *thr)
void ARAX_THROTTLE_DEBUG_FUNC arax_throttle_size_dec(arax_throttle_s *thr, size_t sz ARAX_THROTTLE_DEBUG_PARAMS)
void ARAX_THROTTLE_DEBUG_FUNC arax_throttle_size_inc(arax_throttle_s *thr, size_t sz ARAX_THROTTLE_DEBUG_PARAMS)
async_condition_s ready