![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "caches/pixelpipe_cache.h"#include "system/atomic.h"#include <stdarg.h>#include <stddef.h>#include <setjmp.h>#include <stdint.h>#include <cmocka.h>#include "win/main_wrapper.h"Go to the source code of this file.
Macros | |
| #define | LINE_BYTES (256 * 1024) |
| #define | HASH_A 0x0A0A0A0A0A0A0A0Aull |
Functions | |
| static int | _setup (void **state __attribute__((unused))) |
| static int | _teardown (void **state __attribute__((unused))) |
| static dt_pixel_cache_entry_t * | _create (void) |
| static void | _flagged_line_goes_with_its_release (void **state __attribute__((unused))) |
| static void | _flagged_line_goes_with_its_last_holder (void **state __attribute__((unused))) |
| static void | _unflagged_line_outlives_its_release (void **state __attribute__((unused))) |
| int | main (int argc, char *argv[]) |
| #define HASH_A 0x0A0A0A0A0A0A0A0Aull |
Definition at line 44 of file test_pipe_cache_auto_destroy.c.
Referenced by _create(), _create_held(), _flagged_line_goes_with_its_last_holder(), _flagged_line_goes_with_its_release(), _held_line_survives_the_flush(), _rekeyed_line_publishes_no_host_pixels(), _released_line_goes_with_the_flush(), _rewritten_line_publishes_its_host_pixels(), _unflagged_line_outlives_its_release(), and _without_rekey_the_previous_output_stays().
| #define LINE_BYTES (256 * 1024) |
A disposable cache line goes with its last release, in the same hold of the cache lock.
To drop a line it holds, a caller flags it, then releases it. Releasing first and naming the line afterwards, to remove or to flag it, leaves a window between two holds of the lock in which another thread's eviction can free it, and the second call then works on freed memory.
These tests drive the cache alone, without a pipe: the contract is the cache's.
Definition at line 43 of file test_pipe_cache_auto_destroy.c.
Referenced by _create(), _create_held(), _produce(), _publish(), _rewritten_line_publishes_its_host_pixels(), and _without_rekey_the_previous_output_stays().
|
static |
Definition at line 58 of file test_pipe_cache_auto_destroy.c.
References data, dt_dev_pixelpipe_cache_get(), HASH_A, LINE_BYTES, and TRUE.
Referenced by _flagged_line_goes_with_its_last_holder(), _flagged_line_goes_with_its_release(), and _unflagged_line_outlives_its_release().
Another holder keeps it, out of reach of any retained lookup, and the last release removes it.
Definition at line 80 of file test_pipe_cache_auto_destroy.c.
References _create(), dt_atomic_get_int(), dt_dev_pixelpipe_cache_flag_auto_destroy(), dt_dev_pixelpipe_cache_get_entry(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_ref_entry_by_hash(), dt_dev_pixelpipe_cache_wrlock_entry(), FALSE, HASH_A, dt_pixel_cache_entry_t::refcount, state, and TRUE.
Referenced by main().
Flagged while held, then released: the release removes it.
Definition at line 69 of file test_pipe_cache_auto_destroy.c.
References _create(), dt_dev_pixelpipe_cache_flag_auto_destroy(), dt_dev_pixelpipe_cache_get_entry(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_wrlock_entry(), FALSE, HASH_A, and state.
Referenced by main().
Definition at line 46 of file test_pipe_cache_auto_destroy.c.
References dt_dev_pixelpipe_cache_init(), FALSE, and state.
Definition at line 51 of file test_pipe_cache_auto_destroy.c.
References dt_dev_pixelpipe_cache_cleanup(), and state.
A line nobody flagged stays after its last release: it is kept for reuse.
Definition at line 100 of file test_pipe_cache_auto_destroy.c.
References _create(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_ref_entry_by_hash(), dt_dev_pixelpipe_cache_wrlock_entry(), FALSE, HASH_A, and state.
Referenced by main().
| int main | ( | int | argc, |
| char * | argv[] ) |
Definition at line 112 of file test_pipe_cache_auto_destroy.c.
References _flagged_line_goes_with_its_last_holder(), _flagged_line_goes_with_its_release(), _setup(), _teardown(), and _unflagged_line_outlives_its_release().