![]() |
Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
|
#include "arax_object.h"
#include "arax_pipe.h"
#include "arax_accel.h"
#include "arax_proc.h"
#include "arax_task.h"
#include "arax_data.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
Go to the source code of this file.
Data Structures | |
union | arax_object_union |
Macros | |
#define | PRINT_REFS(OBJ, DELTA) |
Typedefs | |
typedef void(* | arax_object_dtor) (arax_pipe_s *pipe, arax_object_s *obj) |
Functions | |
ARAX_OBJ_DTOR_DECL (arax_accel_s) | |
ARAX_OBJ_DTOR_DECL (arax_vaccel_s) | |
ARAX_OBJ_DTOR_DECL (arax_proc_s) | |
ARAX_OBJ_DTOR_DECL (arax_task_msg_s) | |
ARAX_OBJ_DTOR_DECL (arax_data_s) | |
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) |
Variables | |
static const char * | type2str [ARAX_TYPE_COUNT] |
static const arax_object_dtor | dtor_table [ARAX_TYPE_COUNT] |
#define PRINT_REFS | ( | OBJ, | |
DELTA ) |
Definition at line 38 of file arax_object.c.
Referenced by arax_object_ref_dec(), and arax_object_ref_inc().
typedef void(* arax_object_dtor) (arax_pipe_s *pipe, arax_object_s *obj) |
Definition at line 43 of file arax_object.c.
|
extern |
Definition at line 180 of file arax_accel.c.
References arax_accel_release(), arax_assert, arax_assert_obj, ARAX_TYPE_PHYS_ACCEL, async_condition_lock(), async_condition_unlock(), arax_accel_s::free_vaq, utils_list_s::length, arax_accel_s::lock, arax_object_s::name, arax_accel_s::obj, and arax_accel_s::vaccels.
|
extern |
Definition at line 373 of file arax_data.c.
References arax_data_s::accel, arax_assert, arax_assert_obj, arax_data_size(), arax_object_ref_dec(), arax_proc_get(), arax_task_issue(), ARAX_THROTTLE_DEBUG_PRINT, ARAX_TYPE_COUNT, ARAX_TYPE_DATA, ARAX_TYPE_VIRT_ACCEL, arax_data_s::flags, arax_accel_s::free_vaq, OTHR_REMT, arax_data_s::phys, arax_data_s::remote, and arax_data_s::size.
|
extern |
Definition at line 41 of file arax_proc.c.
|
extern |
Definition at line 89 of file arax_task.c.
References arax_task_msg::accel, arax_object_ref_dec(), arax_task_msg::in_count, arax_task_msg::io, and arax_task_msg::out_count.
|
extern |
Definition at line 113 of file arax_vaccel.c.
References arax_accel_del_vaccel(), arax_assert_obj, arax_pipe_remove_orphan_vaccel(), ARAX_TYPE_VIRT_ACCEL, and arax_vaccel_s::phys.
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().
|
static |
Definition at line 52 of file arax_object.c.
Referenced by arax_object_ref_dec(), and arax_object_ref_dec_pre_locked().
|
static |
Definition at line 11 of file arax_object.c.
Referenced by arax_object_repo_exit(), and arax_object_type_to_str().