![]() |
Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
|
Go to the source code of this file.
Data Structures | |
struct | arax_object_repo_s |
struct | arax_object_s |
Macros | |
#define | ARAX_OBJ_DTOR_DECL(TYPE) |
#define | ARAX_OBJ_DTOR_USE(TYPE) |
Typedefs | |
typedef enum arax_object_type | arax_object_type_e |
Enumerations | |
enum | arax_object_type { ARAX_TYPE_PHYS_ACCEL , ARAX_TYPE_VIRT_ACCEL , ARAX_TYPE_PROC , ARAX_TYPE_DATA , ARAX_TYPE_TASK , ARAX_TYPE_COUNT } |
Functions | |
void | arax_object_repo_init (arax_object_repo_s *repo, arax_pipe_s *pipe) |
int | arax_object_repo_exit (arax_object_repo_s *repo) |
const char * | arax_object_type_to_str (arax_object_type_e type) |
arax_object_s * | arax_object_register (arax_object_repo_s *repo, arax_object_type_e type, const char *name, size_t size, const int ref_count) |
void | arax_object_rename (arax_object_s *obj, const char *fmt,...) |
void | arax_object_ref_inc (arax_object_s *obj) |
int | arax_object_ref_dec (arax_object_s *obj) |
int | arax_object_ref_dec_pre_locked (arax_object_s *obj) |
int | arax_object_refs (arax_object_s *obj) |
utils_list_s * | arax_object_list_lock (arax_object_repo_s *repo, arax_object_type_e type) |
void | arax_object_list_unlock (arax_object_repo_s *repo, arax_object_type_e type) |
#define ARAX_OBJ_DTOR_DECL | ( | TYPE | ) |
Definition at line 152 of file arax_object.h.
#define ARAX_OBJ_DTOR_USE | ( | TYPE | ) |
Definition at line 153 of file arax_object.h.
typedef enum arax_object_type arax_object_type_e |
Enumeration with available Arax Object Types.
enum arax_object_type |
Enumeration with available Arax Object Types.
Enumerator | |
---|---|
ARAX_TYPE_PHYS_ACCEL | |
ARAX_TYPE_VIRT_ACCEL | |
ARAX_TYPE_PROC | |
ARAX_TYPE_DATA | |
ARAX_TYPE_TASK | |
ARAX_TYPE_COUNT |
Definition at line 14 of file arax_object.h.
utils_list_s * arax_object_list_lock | ( | arax_object_repo_s * | repo, |
arax_object_type_e | type ) |
Get a locked utils_list_s for traversing all objects of type
.
repo | A valid arax_object_repo_s instance. |
type | Type of objects contained in list. |
Definition at line 248 of file arax_object.c.
References arax_object_repo_s::list, arax_object_repo_s::lock, arax_object_repo_s::repo, and utils_spinlock_lock.
Referenced by arax_accel_list(), arax_data_ref_offset(), arax_pipe_delete_accel(), arax_pipe_find_accel(), and arax_pipe_find_proc().
void arax_object_list_unlock | ( | arax_object_repo_s * | repo, |
arax_object_type_e | type ) |
Unlock previously locked list. Parameters should be the same with the previous arax_object_list_locked() invocation.
repo | A valid arax_object_repo_s instance. |
type | Type of objects contained in list. |
Definition at line 255 of file arax_object.c.
References arax_object_repo_s::lock, arax_object_repo_s::repo, and utils_spinlock_unlock.
Referenced by arax_accel_list(), arax_data_ref_offset(), arax_pipe_delete_accel(), arax_pipe_find_accel(), and arax_pipe_find_proc().
int arax_object_ref_dec | ( | arax_object_s * | obj | ) |
Decrease reference count of obj
.
obj | A valid arax_object_s instance. |
Definition at line 161 of file arax_object.c.
References arax_object_s::alloc_size, arax_pipe::allocator, arax_assert, arax_pipe_size_inc(), ARAX_TYPE_COUNT, arch_alloc_free, dtor_table, arax_object_repo_s::list, arax_object_s::list, arax_object_repo_s::lock, arax_object_s::name, arax_object_repo_s::pipe, PRINT_REFS, arax_object_s::ref_count, arax_object_repo_s::repo, arax_object_s::repo, arax_object_s::type, utils_list_del(), utils_spinlock_lock, and utils_spinlock_unlock.
Referenced by arax_accel_list_free(), arax_accel_release(), arax_data_free(), arax_data_migrate_accel(), ARAX_OBJ_DTOR_DECL(), ARAX_OBJ_DTOR_DECL(), arax_pipe_delete_accel(), arax_proc_put(), and arax_task_free().
int arax_object_ref_dec_pre_locked | ( | arax_object_s * | obj | ) |
Decrease reference count of obj
.
obj | A valid arax_object_s instance. |
Definition at line 211 of file arax_object.c.
References arax_object_s::alloc_size, arax_pipe::allocator, arax_assert, arax_pipe_size_inc(), arch_alloc_free, dtor_table, arax_object_repo_s::list, arax_object_s::list, arax_object_s::name, arax_object_repo_s::pipe, arax_object_s::ref_count, arax_object_repo_s::repo, arax_object_s::repo, arax_object_s::type, and utils_list_del().
Referenced by arax_accel_list_free_pre_locked().
void arax_object_ref_inc | ( | arax_object_s * | obj | ) |
Increase reference count of obj
.
obj | A valid arax_object_s instance. |
Definition at line 145 of file arax_object.c.
References arax_assert, ARAX_TYPE_COUNT, PRINT_REFS, arax_object_s::ref_count, and arax_object_s::type.
Referenced by arax_accel_list(), arax_data_allocate_remote(), arax_data_input_init(), arax_data_migrate_accel(), arax_data_output_init(), arax_data_set(), arax_data_set_accel(), arax_data_set_remote(), arax_proc_get(), and arax_task_submit().
int arax_object_refs | ( | arax_object_s * | obj | ) |
Returns obj
current reference count.
obj | A valid arax_object_s instance. |
Definition at line 237 of file arax_object.c.
References arax_object_s::ref_count.
arax_object_s * arax_object_register | ( | arax_object_repo_s * | repo, |
arax_object_type_e | type, | ||
const char * | name, | ||
size_t | size, | ||
const int | ref_count ) |
Arax Object 'Constructor'
Register obj
at repo
.
Note: Sets reference count to 1
repo | A valid arax_object_repo_s instance. |
type | Type of the new arax_object. |
name | The name on the new arax_object. |
size | The size of the new object (sizeof(struct)). |
ref_count | Initialize ref count |
Definition at line 98 of file arax_object.c.
References arax_object_s::alloc_size, arax_pipe::allocator, arax_pipe_size_dec(), arch_alloc_allocate(), arax_object_repo_s::list, arax_object_s::list, arax_object_repo_s::lock, arax_object_s::name, arax_object_repo_s::pipe, arax_object_s::ref_count, arax_object_repo_s::repo, arax_object_s::repo, arax_object_s::type, utils_list_add(), utils_list_node_init(), utils_spinlock_lock, and utils_spinlock_unlock.
Referenced by arax_accel_init(), arax_data_init_aligned(), arax_proc_init(), arax_task_alloc(), and arax_vaccel_init().
void arax_object_rename | ( | arax_object_s * | obj, |
const char * | fmt, | ||
... ) |
Change name of obj
to printf like format fmt
obj | A valid arax_object_s instance. |
fmt | printf style format string |
... | Args matching fmt |
Definition at line 128 of file arax_object.c.
References arax_pipe::allocator, arch_alloc_allocate(), arch_alloc_free, arax_object_s::name, arax_object_repo_s::pipe, and arax_object_s::repo.
int arax_object_repo_exit | ( | arax_object_repo_s * | repo | ) |
Perform cleanup and exit time checks.
Prints on stderr, the Objects still registered and thus considered as leaks.
repo | A valid arax_object_repo_s instance. |
Definition at line 71 of file arax_object.c.
References ARAX_TYPE_COUNT, utils_list_s::length, arax_object_repo_s::list, arax_object_repo_s::repo, and type2str.
Referenced by arax_pipe_exit().
void arax_object_repo_init | ( | arax_object_repo_s * | repo, |
arax_pipe_s * | pipe ) |
Initialize an arax_object_repo_s instance on allocated pointer repo
.
repo | An at least sizeof(arax_object_repo_s) big buffer. |
pipe | arax_pipe_s owning all objects. |
Definition at line 60 of file arax_object.c.
References ARAX_TYPE_COUNT, arax_object_repo_s::list, arax_object_repo_s::lock, arax_object_repo_s::pipe, arax_object_repo_s::repo, utils_list_init(), and utils_spinlock_init.
Referenced by arax_pipe_init().
const char * arax_object_type_to_str | ( | arax_object_type_e | type | ) |
Convert a arax_object_type_e value to a human readable string. If type
is not a valid arax_object_type_e, then NULL is returned.
type
Definition at line 90 of file arax_object.c.
References ARAX_TYPE_COUNT, and type2str.
Referenced by arax_data_migrate_accel().