Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
pixelpipe_cache_pressure.c File Reference
#include "caches/pixelpipe_cache_pressure.h"
#include "common/logging.h"
#include "system/macros.h"
#include <string.h>
+ Include dependency graph for pixelpipe_cache_pressure.c:

Go to the source code of this file.

Functions

void dt_pixelpipe_cache_pressure_monitor_init (dt_pixelpipe_cache_pressure_monitor_t *m, const size_t plan)
 
static double _window_share (dt_pixelpipe_cache_pressure_monitor_t *m, const gint64 now, const gint64 min_window_us)
 
static size_t _shed (dt_pixelpipe_cache_pressure_monitor_t *m, const dt_pixelpipe_cache_pressure_sink_t *sink, const double share, const char *origin)
 
static gboolean _shed_too_soon (const dt_pixelpipe_cache_pressure_monitor_t *m, const gint64 now)
 
size_t dt_pixelpipe_cache_pressure_react (dt_pixelpipe_cache_pressure_monitor_t *m, const dt_pixelpipe_cache_pressure_sink_t *sink)
 
void dt_pixelpipe_cache_pressure_triggered (dt_pixelpipe_cache_pressure_monitor_t *m, const dt_pixelpipe_cache_pressure_sink_t *sink)
 
void dt_pixelpipe_cache_pressure_watch_start (dt_pixelpipe_cache_pressure_monitor_t *m, void(*wake)(void *user), void *user)
 
void dt_pixelpipe_cache_pressure_watch_stop (dt_pixelpipe_cache_pressure_monitor_t *m)
 

Function Documentation

◆ _shed()

◆ _shed_too_soon()

static gboolean _shed_too_soon ( const dt_pixelpipe_cache_pressure_monitor_t m,
const gint64  now 
)
inlinestatic

◆ _window_share()

static double _window_share ( dt_pixelpipe_cache_pressure_monitor_t m,
const gint64  now,
const gint64  min_window_us 
)
static

◆ dt_pixelpipe_cache_pressure_monitor_init()

void dt_pixelpipe_cache_pressure_monitor_init ( dt_pixelpipe_cache_pressure_monitor_t m,
size_t  plan 
)

A monitor for a cache planned at plan bytes: full budget, nothing measured, no watcher.

Definition at line 63 of file pixelpipe_cache_pressure.c.

References dt_pixelpipe_cache_pressure_init(), and m.

Referenced by dt_dev_pixelpipe_cache_init().

◆ dt_pixelpipe_cache_pressure_react()

size_t dt_pixelpipe_cache_pressure_react ( dt_pixelpipe_cache_pressure_monitor_t m,
const dt_pixelpipe_cache_pressure_sink_t sink 
)

Close the window since the last measurement and act on it: shed past the threshold, let the budget climb back under it, do nothing in between. Returns the bytes shed.

Definition at line 133 of file pixelpipe_cache_pressure.c.

References _shed(), _shed_too_soon(), _window_share(), DT_DEBUG_MEMORY, DT_DEBUG_PIPECACHE, dt_pixelpipe_cache_pressure_budget(), dt_pixelpipe_cache_pressure_cap(), dt_pixelpipe_cache_pressure_relax(), DT_PIXELPIPE_CACHE_PSI_CALM, DT_PIXELPIPE_CACHE_PSI_SHED, DT_PIXELPIPE_CACHE_PSI_WINDOW_US, dt_print(), and m.

Referenced by _pressure_react_locked().

◆ dt_pixelpipe_cache_pressure_triggered()

void dt_pixelpipe_cache_pressure_triggered ( dt_pixelpipe_cache_pressure_monitor_t m,
const dt_pixelpipe_cache_pressure_sink_t sink 
)

The kernel raised a trigger: shed now, without waiting for a window of ours to close.

Definition at line 157 of file pixelpipe_cache_pressure.c.

References _shed(), _shed_too_soon(), _window_share(), DT_PIXELPIPE_CACHE_PSI_SHED, DT_PIXELPIPE_CACHE_PSI_WINDOW_US, m, and MAX.

Referenced by _pressure_wake().

◆ dt_pixelpipe_cache_pressure_watch_start()

◆ dt_pixelpipe_cache_pressure_watch_stop()

void dt_pixelpipe_cache_pressure_watch_stop ( dt_pixelpipe_cache_pressure_monitor_t m)

Join that thread. Nothing the sink touches may go away before this returns.

Definition at line 181 of file pixelpipe_cache_pressure.c.

References dt_memory_pressure_watch_stop(), and m.

Referenced by dt_dev_pixelpipe_cache_cleanup().