45#define MIB ((size_t)1024 * 1024)
46#define CACHE_BYTES (64 * MIB)
47#define HASH_HELD 0x0A0A0A0A0A0A0A0Aull
66 assert_non_null(buffer);
90 assert_non_null(data);
105 return GUINT_TO_POINTER(
IS_NULL_PTR(buffer) ? counted : G_MAXUINT);
115 const guint counted_there = GPOINTER_TO_UINT(g_thread_join(other));
117 assert_int_equal(counted_there, 1);
121int main(
int argc,
char *argv[])
123 const struct CMUnitTest tests[] = {
129 return cmocka_run_group_tests(tests, NULL, NULL);
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
void dt_dev_pixelpipe_cache_wrlock_entry(gboolean lock, dt_pixel_cache_entry_t *cache_entry)
Lock or release the write lock on the entry.
void dt_dev_pixelpipe_cache_cleanup(void)
Release everything dt_dev_pixelpipe_cache_init() created, the instance included. Only after a success...
void * dt_pixelpipe_cache_alloc_align_cache_impl(size_t size, int id, const char *name)
Allocate aligned memory tracked by the pixelpipe cache. This allows LRU cache entries to be evicted i...
void dt_dev_pixelpipe_cache_ref_count_entry(gboolean lock, dt_pixel_cache_entry_t *cache_entry)
Take or release one reference on a cache line. A referenced line is never evicted,...
gboolean dt_dev_pixelpipe_cache_init(size_t max_memory, const gboolean verbose, const gboolean verbose_detail)
Reserve the cache's arena and start it.
void dt_pixelpipe_cache_free_align_cache(void **mem, const char *message)
Free aligned memory allocated with dt_pixelpipe_cache_alloc_align_cache.
dt_dev_pixelpipe_cache_writable_status_t dt_dev_pixelpipe_cache_get_writable(const uint64_t hash, const size_t size, const char *name, const int id, const gboolean alloc, const gboolean allow_rekey_reuse, const dt_pixel_cache_entry_t *reuse_hint, const dt_pixel_cache_entry_t *reuse_hint_prev, void **data, dt_pixel_cache_entry_t **entry)
uint32_t dt_pixelpipe_cache_get_alloc_refusals(void)
Count the allocations the cache refused to the calling thread for lack of memory (thread-local).
Pixelpipe cache for storing intermediate results in the pixelpipe.
@ DT_DEV_PIXELPIPE_CACHE_WRITABLE_CREATED
float dt_aligned_pixel_simd_t __attribute__((vector_size(16), aligned(16)))
Apply one channel's tone curve to each of the three colour channels, or pass the channel through unto...
const float uint32_t state[4]
static void _refusal_on_another_thread_is_not_counted_here(void **state __attribute__((unused)))
static int _teardown(void **state __attribute__((unused)))
static int _setup(void **state __attribute__((unused)))
static void _request_larger_than_the_cache_is_counted_once(void **state __attribute__((unused)))
static void _budget_spent_by_a_line_in_use_is_counted_once(void **state __attribute__((unused)))
static gpointer _refuse_on_this_thread(gpointer unused __attribute__((unused)))
static void _granted_allocation_is_not_counted(void **state __attribute__((unused)))