Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
test_pipe_cache_pressure.c File Reference
#include "caches/pixelpipe_cache_pressure.h"
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <stdint.h>
#include <cmocka.h>
+ Include dependency graph for test_pipe_cache_pressure.c:

Go to the source code of this file.

Macros

#define GIB   ((size_t)1024 * 1024 * 1024)
 
#define MIB   ((size_t)1024 * 1024)
 

Functions

static dt_pixelpipe_cache_pressure_t _plan_of (const size_t plan)
 
static void _starts_at_the_plan (void **state)
 
static void _sheds_a_share_of_what_is_held (void **state)
 
static void _an_empty_cache_is_not_the_cause (void **state)
 
static void _a_shed_lowers_the_budget_to_what_is_left (void **state)
 
static void _the_budget_never_falls_under_the_floor (void **state)
 
static void _recovery_waits_under_the_mark (void **state)
 
static void _recovery_reaches_the_plan_without_a_jump (void **state)
 
static void _reported_budget_never_underflows_its_readers (void **state)
 
int main (void)
 

Macro Definition Documentation

◆ GIB

#define GIB   ((size_t)1024 * 1024 * 1024)

How much the pixelpipe cache may hold while the machine stalls on memory.

These tests exist because nothing else can see this policy: it changes no pixel and no hash, only how much cache survives a stalling machine, and its failures were measured on live runs that ended with systemd-oomd killing the process. Both are pinned below.

Definition at line 36 of file test_pipe_cache_pressure.c.

◆ MIB

#define MIB   ((size_t)1024 * 1024)

Definition at line 37 of file test_pipe_cache_pressure.c.

Function Documentation

◆ _a_shed_lowers_the_budget_to_what_is_left()

static void _a_shed_lowers_the_budget_to_what_is_left ( void **  state)
static

A shed lowers the budget to what eviction actually left, and marks where pressure struck.

Definition at line 89 of file test_pipe_cache_pressure.c.

References _plan_of(), dt_pixelpipe_cache_pressure_after_shed(), dt_pixelpipe_cache_pressure_budget(), GIB, p, state, and void().

Referenced by main().

◆ _an_empty_cache_is_not_the_cause()

static void _an_empty_cache_is_not_the_cause ( void **  state)
static

THE STARTUP DEFECT: four kernel wake-ups in the first 12 s of a run, while the cache still held nothing, recorded a mark of 0 and pinned the budget at the floor for the next quarter of an hour. A cache holding less than the floor is not what the machine is short of.

Definition at line 74 of file test_pipe_cache_pressure.c.

References _plan_of(), dt_pixelpipe_cache_pressure_budget(), dt_pixelpipe_cache_pressure_floor(), DT_PIXELPIPE_CACHE_PRESSURE_KEEP, dt_pixelpipe_cache_pressure_mark_top(), dt_pixelpipe_cache_pressure_shed_target(), GIB, p, state, and void().

Referenced by main().

◆ _plan_of()

◆ _recovery_reaches_the_plan_without_a_jump()

static void _recovery_reaches_the_plan_without_a_jump ( void **  state)
static

And it gets there in the end, continuously: the ceiling reaches the plan by climbing, never by a jump when the mark tops out.

Definition at line 139 of file test_pipe_cache_pressure.c.

References _plan_of(), dt_pixelpipe_cache_pressure_after_shed(), dt_pixelpipe_cache_pressure_budget(), dt_pixelpipe_cache_pressure_relax(), GIB, p, state, void(), and window.

Referenced by main().

◆ _recovery_waits_under_the_mark()

static void _recovery_waits_under_the_mark ( void **  state)
static

THE RECOVERY DEFECT: restoring the whole plan in ~80 s brought the stall back within half a minute of every recovery, five times in five minutes, once at 49% – one point under systemd-oomd's limit. The ceiling must stay under the footprint that caused the stall until the mark itself has recovered, which takes minutes.

Definition at line 118 of file test_pipe_cache_pressure.c.

References _plan_of(), dt_pixelpipe_cache_pressure_after_shed(), dt_pixelpipe_cache_pressure_budget(), dt_pixelpipe_cache_pressure_cap(), dt_pixelpipe_cache_pressure_relax(), GIB, p, state, void(), and window.

Referenced by main().

◆ _reported_budget_never_underflows_its_readers()

static void _reported_budget_never_underflows_its_readers ( void **  state)
static

The reported budget never drops under what is held: both readers compute max - current unsigned, and a lowered ceiling would wrap it into a huge number.

Definition at line 160 of file test_pipe_cache_pressure.c.

References _plan_of(), dt_pixelpipe_cache_pressure_after_shed(), dt_pixelpipe_cache_pressure_budget(), dt_pixelpipe_cache_pressure_reported(), GIB, p, state, and void().

Referenced by main().

◆ _sheds_a_share_of_what_is_held()

static void _sheds_a_share_of_what_is_held ( void **  state)
static

A stalled window sheds a quarter of what is held, half when the stall is severe.

Definition at line 58 of file test_pipe_cache_pressure.c.

References _plan_of(), DT_PIXELPIPE_CACHE_PRESSURE_KEEP, dt_pixelpipe_cache_pressure_shed_target(), GIB, p, state, and void().

Referenced by main().

◆ _starts_at_the_plan()

static void _starts_at_the_plan ( void **  state)
static

A fresh cache may use its whole plan, and reports it.

Definition at line 47 of file test_pipe_cache_pressure.c.

References _plan_of(), dt_pixelpipe_cache_pressure_budget(), dt_pixelpipe_cache_pressure_cap(), dt_pixelpipe_cache_pressure_reported(), GIB, p, state, and void().

Referenced by main().

◆ _the_budget_never_falls_under_the_floor()

static void _the_budget_never_falls_under_the_floor ( void **  state)
static

However hard the pressure, the budget stays usable: a floor of an eighth of the plan.

Definition at line 104 of file test_pipe_cache_pressure.c.

References _plan_of(), dt_pixelpipe_cache_pressure_after_shed(), dt_pixelpipe_cache_pressure_budget(), dt_pixelpipe_cache_pressure_floor(), GIB, p, state, and void().

Referenced by main().

◆ main()