![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "caches/pixelpipe_cache.h"#include "system/macros.h"#include <glib.h>#include <stdarg.h>#include <stddef.h>#include <setjmp.h>#include <stdint.h>#include <cmocka.h>#include "win/main_wrapper.h"
Include dependency graph for test_pipe_cache_alloc_refusals.c:Go to the source code of this file.
Macros | |
| #define | MIB ((size_t)1024 * 1024) |
| #define | CACHE_BYTES (64 * MIB) |
| #define | HASH_HELD 0x0A0A0A0A0A0A0A0Aull |
Functions | |
| static int | _setup (void **state __attribute__((unused))) |
| static int | _teardown (void **state __attribute__((unused))) |
| static void | _granted_allocation_is_not_counted (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 | _refusal_on_another_thread_is_not_counted_here (void **state __attribute__((unused))) |
| int | main (int argc, char *argv[]) |
| #define CACHE_BYTES (64 * MIB) |
Definition at line 46 of file test_pipe_cache_alloc_refusals.c.
| #define HASH_HELD 0x0A0A0A0A0A0A0A0Aull |
Definition at line 47 of file test_pipe_cache_alloc_refusals.c.
| #define MIB ((size_t)1024 * 1024) |
The cache counts what it refuses for lack of memory, per thread.
A pixelpipe run that fails returns the same error whether a module failed or the cache refused it a buffer. An export reads dt_pixelpipe_cache_get_alloc_refusals() around the run to tell the two apart, and shows "Out of RAM" on the thumbnail instead of "Processing error". That holds only if every refusal is counted once, nothing else is, and a refusal on another thread is not.
These tests drive the cache alone, without a pipe: the contract is the cache's.
Definition at line 45 of file test_pipe_cache_alloc_refusals.c.
|
static |
The budget is spent by a line still in use, so nothing can be evicted to make room.
Definition at line 82 of file test_pipe_cache_alloc_refusals.c.
References dt_dev_pixelpipe_cache_get_writable(), dt_dev_pixelpipe_cache_ref_count_entry(), DT_DEV_PIXELPIPE_CACHE_WRITABLE_CREATED, dt_dev_pixelpipe_cache_wrlock_entry(), dt_pixelpipe_cache_alloc_align_cache_impl(), dt_pixelpipe_cache_get_alloc_refusals(), FALSE, HASH_HELD, MIB, and TRUE.
Referenced by main().
A buffer the cache can give is not a refusal.
Definition at line 61 of file test_pipe_cache_alloc_refusals.c.
References dt_pixelpipe_cache_alloc_align_cache_impl(), dt_pixelpipe_cache_free_align_cache(), dt_pixelpipe_cache_get_alloc_refusals(), and MIB.
Referenced by main().
|
static |
A refusal is counted on the thread it was refused to, and read there only: an export reading its own run must not see another pipe's.
Definition at line 110 of file test_pipe_cache_alloc_refusals.c.
References _refuse_on_this_thread(), and dt_pixelpipe_cache_get_alloc_refusals().
Referenced by main().
|
static |
Definition at line 100 of file test_pipe_cache_alloc_refusals.c.
References CACHE_BYTES, dt_pixelpipe_cache_alloc_align_cache_impl(), dt_pixelpipe_cache_get_alloc_refusals(), and IS_NULL_PTR.
Referenced by _refusal_on_another_thread_is_not_counted_here().
|
static |
More than the whole cache: the arena has no run that long.
Definition at line 73 of file test_pipe_cache_alloc_refusals.c.
References CACHE_BYTES, dt_pixelpipe_cache_alloc_align_cache_impl(), and dt_pixelpipe_cache_get_alloc_refusals().
Referenced by main().
Definition at line 49 of file test_pipe_cache_alloc_refusals.c.
References CACHE_BYTES, dt_dev_pixelpipe_cache_init(), and FALSE.
Referenced by main().
Definition at line 54 of file test_pipe_cache_alloc_refusals.c.
References dt_dev_pixelpipe_cache_cleanup().
Referenced by main().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 121 of file test_pipe_cache_alloc_refusals.c.
References _budget_spent_by_a_line_in_use_is_counted_once(), _granted_allocation_is_not_counted(), _refusal_on_another_thread_is_not_counted_here(), _request_larger_than_the_cache_is_counted_once(), _setup(), and _teardown().