|
BeBOP Optimized Sparse Kernel Interface Library
1.0.1h
|
Simple read-only, lockable, append-only list implementation. More...
Go to the source code of this file.
Data Structures | |
| struct | tagSimplenode_t |
| Node in the linked list. More... | |
| struct | tagSimplelist_t |
| Simple list object. More... | |
| struct | tagSimplelistIterator_t |
| Iterator object for a simple list. More... | |
Typedefs | |
| typedef struct tagSimplenode_t | simplenode_t |
| Node in the linked list. | |
| typedef struct tagSimplelist_t | simplelist_t |
| Simple list object. | |
|
typedef struct tagSimplelistIterator_t | simplelist_iter_t |
| Iterator object for a simple list. | |
Functions | |
| simplelist_t * | simplelist_Create (void) |
| Returns a newly allocated list object. | |
| void | simplelist_Destroy (simplelist_t *L) |
| Deallocates memory associated with a simple list. | |
| size_t | simplelist_Append (simplelist_t *L, const void *element) |
| Append a new element to the list, and return its list index. | |
| size_t | simplelist_GetLength (const simplelist_t *L) |
| Returns the length of the list. | |
| const void * | simplelist_GetElem (const simplelist_t *L, size_t i) |
| Returns a given element from the list. | |
| void | simplelist_InitIter (const simplelist_t *L, simplelist_iter_t *i) |
| Initialize an iterator. | |
| const void * | simplelist_BeginIter (const simplelist_t *L, simplelist_iter_t *i) |
| Initialize an iterator and return the first element. | |
| const void * | simplelist_GetIterObj (const simplelist_iter_t *i) |
| Return the object of the current iteration. | |
| size_t | simplelist_GetIterId (const simplelist_iter_t *i) |
| Return the index of the object of the current iteration. | |
| const void * | simplelist_NextIter (simplelist_iter_t *i) |
| Advances the iterator, and then returns the new iteration object. | |
| const void * | simplelist_GetLastElem (const simplelist_t *L) |
| Return the last element in the list. | |
Simple read-only, lockable, append-only list implementation.
This module implements a simple 1-D array type whose only supported operations are "append" (simplelist_Append) and "get element" (simplelist_GetElem). This list should only be used to store read-only elements.
A logical SimpleList object (of type simplelist_t) L, of length n, is a sequence of elements L[1], ..., L[n].
If the library is compiled with pthreads support enabled, then simplelist_t is implemented with some locking support, so that a SimpleList user does not have to explicitly lock the list. Refer to simplelist_Append for more information.
Compile-time control flags:
| typedef struct tagSimplenode_t simplenode_t |
Node in the linked list.
A node encapsulates an arbitrary data element, and furthermore contains a pointer to the next element of the list (or NULL if none).
Note that the element should logically be read-only.
| size_t simplelist_Append | ( | simplelist_t * | L, |
| const void * | element | ||
| ) |
Append a new element to the list, and return its list index.
| [in,out] | L | List object. |
| [in] | element | A pointer to a read-only element to insert. |
In multithreaded environments, calls to simplelist_Append are mutually exclusive. Simultaneous simplelist_GetLength and simplelist_GetElem operations may execute and are considered 'safe' provided they access elements whose index is less than the length of the list at the time of the call to simplelist_Append.
Begin mutually exclusive region.
End mutually exclusive region.
References tagSimplenode_t::element, tagSimplelist_t::head, tagSimplenode_t::next, tagSimplelist_t::num_elements, oski_Malloc, simplelist_Append(), and tagSimplelist_t::tail.
Referenced by oski_RecordCalls(), oski_RegisterHeur(), oski_RegisterMatType(), and simplelist_Append().
| simplelist_t* simplelist_Create | ( | void | ) |
Returns a newly allocated list object.
References tagSimplelist_t::head, oski_Malloc, simplelist_Create(), and tagSimplelist_t::tail.
Referenced by oski_CreateMatReprFromCSR(), oski_CreateTrace(), oski_InitHeurManager(), oski_InitMatTypeManager(), and simplelist_Create().
| void simplelist_Destroy | ( | simplelist_t * | L | ) |
Deallocates memory associated with a simple list.
| [in,out] | L | List object to destroy. |
In multithreaded environments, the caller MUST ensure that no other threads are executing any operations on L.
References tagSimplelist_t::head, tagSimplenode_t::next, oski_Free, and simplelist_Destroy().
Referenced by oski_CloseHeurManager(), oski_CloseMatTypeManager(), oski_CreateMatReprFromCSR(), oski_DestroyTrace(), and simplelist_Destroy().
| const void* simplelist_GetElem | ( | const simplelist_t * | L, |
| size_t | i | ||
| ) |
Returns a given element from the list.
| [in] | L | List object containing elements. |
| [in] | i | Index of item to retrieve, starting at 1 for the first element. |
If L is invalid or i
, then NULL is returned. Otherwise, returns the logical element L[i].
References tagSimplenode_t::element, tagSimplelist_t::head, simplelist_GetElem(), and simplelist_GetLength().
Referenced by count_workload_flops_per_nz(), create_workload_data(), DumpTrace(), oski_CloseHeurManager(), oski_CloseMatTypeManager(), oski_CountTraceFlopsPerNz(), oski_DestroyTrace(), oski_EstimateTraceTime(), oski_FindHeurRecord(), oski_FindMatTypeRecord(), oski_GetNumCalls(), oski_LookupHeur(), oski_LookupHeurIdByNum(), oski_LookupMatTypeId(), oski_RecordCalls(), simplelist_GetElem(), workload_CountFlopsPerNz(), and workload_CreateData().
| size_t simplelist_GetIterId | ( | const simplelist_iter_t * | i | ) |
Return the index of the object of the current iteration.
| [in] | i | Pointer to an initialized iteration object. |
References simplelist_GetIterId().
Referenced by simplelist_GetIterId().
| const void* simplelist_GetIterObj | ( | const simplelist_iter_t * | i | ) |
Return the object of the current iteration.
| [in] | i | Pointer to an initialized iteration object. |
References tagSimplenode_t::element, and simplelist_GetIterObj().
Referenced by simplelist_BeginIter(), simplelist_GetIterObj(), and simplelist_NextIter().
| size_t simplelist_GetLength | ( | const simplelist_t * | L | ) |
Returns the length of the list.
| [in] | L | List object. |
References tagSimplelist_t::num_elements, and simplelist_GetLength().
Referenced by count_workload_flops_per_nz(), create_workload_data(), DumpTrace(), oski_CloseHeurManager(), oski_CountTraceFlopsPerNz(), oski_CreateMatReprFromCSR(), oski_DestroyTrace(), oski_EstimateTraceTime(), oski_GetNumCalls(), oski_GetNumHeur(), oski_GetNumMatTypes(), oski_RecordCalls(), simplelist_GetElem(), simplelist_GetLength(), workload_CountFlopsPerNz(), and workload_CreateData().
| void simplelist_InitIter | ( | const simplelist_t * | L, |
| simplelist_iter_t * | i | ||
| ) |
Initialize an iterator.
| [in] | L | List over which to iterate. |
| [in,out] | i | Pointer to an uninitialized iteration object. |
References tagSimplelist_t::head, and simplelist_InitIter().
Referenced by simplelist_BeginIter(), and simplelist_InitIter().
| const void* simplelist_NextIter | ( | simplelist_iter_t * | i | ) |
Advances the iterator, and then returns the new iteration object.
| [in,out] | i | Pointer to an initialized iteration object. |
References tagSimplenode_t::next, simplelist_GetIterObj(), and simplelist_NextIter().
Referenced by oski_MatReprMult(), and simplelist_NextIter().
1.7.6.1