test_performance: Add performance experimentation test module.

This is a module which is only built when TEST_FRAMEWORK is enabled
and provides CLI commands for testing performance of certain things
on the system they are invoked on. The first CLI commands added
cover the most common container usage: storage of objects with a
lookup based on a string key. These commands take various arguments
and allow you to see how they perform. There is also an "all" command
named "performance test container_key_lookup_all" that will execute
all of these container tests and pass through the given arguments,
which makes it easy to run all of the tests for given usage.

To facilitate a vector bsearch test a new AST_VECTOR_BSEARCH macro
has been added that allows more efficient searching of sorted vectors.
releases/20
Joshua C. Colp 3 months ago committed by Asterisk Development Team
parent a0cf8f9f65
commit 4a9668bf98

@ -408,6 +408,23 @@ char *ast_vector_string_join(struct ast_vector_string *vec, const char *delim);
qsort((vec)->elems, (vec)->current, sizeof(typeof((vec)->elems[0])), cmp); \
})
/*!
* \brief Binary search a sorted vector
*
* \param vec Sorted vector to search.
* \param key The key to search for.
* \param cmp A bsearch compatible compare function.
*
* \return a pointer to the found element, or NULL if not found.
*
* \warning This macro requires the vector to have been sorted.
*/
#define AST_VECTOR_BSEARCH(vec, key, cmp) ({ \
typeof(key) __key = (key); \
bsearch(&__key, (vec)->elems, (vec)->current, \
sizeof(typeof((vec)->elems[0])), cmp); \
})
/*!
* \brief Remove an element from a vector by index.
*

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save