![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "caches/pixelpipe_cache_wait.h"#include "caches/pixelpipe_cache.h"#include "system/macros.h"#include "system/mem_alloc.h"#include <stdlib.h>
Include dependency graph for pixelpipe_cache_wait.c:Go to the source code of this file.
Data Structures | |
| struct | dt_pixelpipe_cache_wait_record_t |
| struct | dt_pixelpipe_cache_wait_queue_t |
Typedefs | |
| typedef struct dt_pixelpipe_cache_wait_record_t | dt_pixelpipe_cache_wait_record_t |
| typedef struct dt_pixelpipe_cache_wait_queue_t | dt_pixelpipe_cache_wait_queue_t |
Functions | |
| static void | _unlink_locked (GList *link) |
| static GList * | _find_locked (const dt_pixelpipe_cache_wait_t *wait) |
| gboolean | dt_pixelpipe_cache_wait_enqueue (dt_pixelpipe_cache_wait_t *wait) |
Queue wait, or refresh it in place if it is already queued for the same target. | |
| GList * | dt_pixelpipe_cache_wait_take_matching (const uint64_t hash, const uint64_t producer_node_key, gboolean *drained) |
Take every waiter satisfied by a publication of hash from node producer_node_key. | |
| gboolean | dt_pixelpipe_cache_wait_cancel (dt_pixelpipe_cache_wait_t *wait, gboolean *drained) |
Remove wait from the queue if it is there, and reset it to an inert state. | |
| guint | dt_pixelpipe_cache_wait_pending_count (void) |
| How many requests are outstanding. Diagnostics only. | |
| void | dt_pixelpipe_cache_wait_get_stats (uint64_t *queued, uint64_t *served, uint64_t *cancelled, uint64_t *immediate_hits, uint64_t *misses) |
| Snapshot of the lifetime counters, for the dump. Any pointer may be NULL. | |
| void | dt_pixelpipe_cache_wait_count_immediate_hit (void) |
| Count one cache hit that never needed to queue. | |
| void | dt_pixelpipe_cache_wait_count_miss (void) |
| Count one miss that is about to queue. | |
| void | dt_pixelpipe_cache_wait_foreach_pending (dt_pixelpipe_cache_wait_visitor_t callback, gpointer user_data) |
Variables | |
| static dt_pixelpipe_cache_wait_queue_t | _queue |
|
static |
Find the record linking wait, or NULL. Caller holds the lock.
Definition at line 64 of file pixelpipe_cache_wait.c.
References _queue, IS_NULL_PTR, L, and dt_pixelpipe_cache_wait_queue_t::pending.
Referenced by dt_pixelpipe_cache_wait_cancel(), and dt_pixelpipe_cache_wait_enqueue().
Unlink one record without touching the wait it points at. Caller holds the lock.
Definition at line 56 of file pixelpipe_cache_wait.c.
References _queue, dt_free, L, and dt_pixelpipe_cache_wait_queue_t::pending.
Referenced by dt_pixelpipe_cache_wait_cancel(), and dt_pixelpipe_cache_wait_take_matching().
| gboolean dt_pixelpipe_cache_wait_cancel | ( | dt_pixelpipe_cache_wait_t * | wait, |
| gboolean * | drained | ||
| ) |
Remove wait from the queue if it is there, and reset it to an inert state.
| drained | Set to TRUE when this emptied the queue. |
Definition at line 145 of file pixelpipe_cache_wait.c.
References _find_locked(), _queue, _unlink_locked(), dt_pixelpipe_cache_wait_queue_t::cancelled_requests, dt_pixelpipe_cache_wait_t::connected, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, IS_NULL_PTR, L, dt_pixelpipe_cache_wait_queue_t::lock, and dt_pixelpipe_cache_wait_queue_t::pending.
Referenced by dt_dev_pixelpipe_cache_wait_cleanup().
Count one cache hit that never needed to queue.
Definition at line 184 of file pixelpipe_cache_wait.c.
References _queue, dt_pthread_mutex_trylock(), dt_pthread_mutex_unlock(), dt_pixelpipe_cache_wait_queue_t::immediate_hits, and dt_pixelpipe_cache_wait_queue_t::lock.
Referenced by dt_dev_pixelpipe_cache_peek_gui().
Count one miss that is about to queue.
Definition at line 195 of file pixelpipe_cache_wait.c.
References _queue, dt_pthread_mutex_trylock(), dt_pthread_mutex_unlock(), dt_pixelpipe_cache_wait_queue_t::lock, and dt_pixelpipe_cache_wait_queue_t::misses.
Referenced by dt_dev_pixelpipe_cache_peek_gui().
| gboolean dt_pixelpipe_cache_wait_enqueue | ( | dt_pixelpipe_cache_wait_t * | wait | ) |
Queue wait, or refresh it in place if it is already queued for the same target.
Definition at line 74 of file pixelpipe_cache_wait.c.
References _find_locked(), _queue, dt_pixelpipe_cache_wait_t::connected, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, IS_NULL_PTR, L, dt_pixelpipe_cache_wait_queue_t::lock, dt_pixelpipe_cache_wait_queue_t::next_request_id, dt_pixelpipe_cache_wait_queue_t::pending, dt_pixelpipe_cache_wait_queue_t::queued_requests, dt_pixelpipe_cache_wait_t::request_id, and TRUE.
Referenced by dt_dev_pixelpipe_cache_peek_gui().
| void dt_pixelpipe_cache_wait_foreach_pending | ( | dt_pixelpipe_cache_wait_visitor_t | callback, |
| gpointer | user_data | ||
| ) |
Definition at line 204 of file pixelpipe_cache_wait.c.
References _queue, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), IS_NULL_PTR, L, dt_pixelpipe_cache_wait_queue_t::lock, and dt_pixelpipe_cache_wait_queue_t::pending.
Referenced by dt_dev_pixelpipe_cache_wait_dump_pending().
| void dt_pixelpipe_cache_wait_get_stats | ( | uint64_t * | queued, |
| uint64_t * | served, | ||
| uint64_t * | cancelled, | ||
| uint64_t * | immediate_hits, | ||
| uint64_t * | misses | ||
| ) |
Snapshot of the lifetime counters, for the dump. Any pointer may be NULL.
Definition at line 172 of file pixelpipe_cache_wait.c.
References _queue, dt_pixelpipe_cache_wait_queue_t::cancelled_requests, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_pixelpipe_cache_wait_queue_t::immediate_hits, IS_NULL_PTR, L, dt_pixelpipe_cache_wait_queue_t::lock, dt_pixelpipe_cache_wait_queue_t::misses, dt_pixelpipe_cache_wait_queue_t::queued_requests, and dt_pixelpipe_cache_wait_queue_t::served_requests.
Referenced by dt_dev_pixelpipe_cache_wait_dump_pending().
| guint dt_pixelpipe_cache_wait_pending_count | ( | void | ) |
How many requests are outstanding. Diagnostics only.
Definition at line 164 of file pixelpipe_cache_wait.c.
References _queue, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), L, dt_pixelpipe_cache_wait_queue_t::lock, and dt_pixelpipe_cache_wait_queue_t::pending.
Referenced by dt_dev_pixelpipe_cache_wait_dump_pending().
| GList * dt_pixelpipe_cache_wait_take_matching | ( | uint64_t | hash, |
| uint64_t | producer_node_key, | ||
| gboolean * | drained | ||
| ) |
Take every waiter satisfied by a publication of hash from node producer_node_key.
Matches on the exact hash OR on the producing node, which is what makes the protocol survive hash drift. Removes them from the queue and marks them disconnected.
| drained | Set to TRUE when this emptied the queue. |
Definition at line 110 of file pixelpipe_cache_wait.c.
References _queue, _unlink_locked(), dt_pixelpipe_cache_wait_t::connected, DT_PIXELPIPE_CACHE_HASH_INVALID, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, dt_pixelpipe_cache_wait_t::hash, IS_NULL_PTR, L, dt_pixelpipe_cache_wait_queue_t::lock, dt_pixelpipe_cache_wait_queue_t::pending, dt_pixelpipe_cache_wait_queue_t::served_requests, and dt_pixelpipe_cache_wait_t::target_node_key.
Referenced by _dt_dev_pixelpipe_cache_wait_ready_callback().
|
static |
Definition at line 50 of file pixelpipe_cache_wait.c.
Referenced by _find_locked(), _unlink_locked(), dt_pixelpipe_cache_wait_cancel(), dt_pixelpipe_cache_wait_count_immediate_hit(), dt_pixelpipe_cache_wait_count_miss(), dt_pixelpipe_cache_wait_enqueue(), dt_pixelpipe_cache_wait_foreach_pending(), dt_pixelpipe_cache_wait_get_stats(), dt_pixelpipe_cache_wait_pending_count(), and dt_pixelpipe_cache_wait_take_matching().