![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "config.h"
#include "common/cache.h"
#include "common/darktable.h"
#include "common/dtpthread.h"
#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
Go to the source code of this file.
Functions | |
void | dt_cache_init (dt_cache_t *cache, size_t entry_size, size_t cost_quota) |
void | dt_cache_cleanup (dt_cache_t *cache) |
int32_t | dt_cache_contains (dt_cache_t *cache, const uint32_t key) |
int | dt_cache_for_all (dt_cache_t *cache, int(*process)(const uint32_t key, const void *data, void *user_data), void *user_data) |
dt_cache_entry_t * | dt_cache_testget (dt_cache_t *cache, const uint32_t key, char mode) |
dt_cache_entry_t * | dt_cache_get_with_caller (dt_cache_t *cache, const uint32_t key, char mode, const char *file, int line) |
int | dt_cache_remove (dt_cache_t *cache, const uint32_t key) |
void | dt_cache_gc (dt_cache_t *cache, const float fill_ratio) |
void | dt_cache_release_with_caller (dt_cache_t *cache, dt_cache_entry_t *entry, const char *file, int line) |
void dt_cache_cleanup | ( | dt_cache_t * | cache | ) |
References ASAN_UNPOISON_MEMORY_REGION, dt_cache_t::cleanup, dt_cache_t::cleanup_data, dt_cache_entry_t::data, dt_cache_entry_t::data_size, dt_free_align, dt_pthread_mutex_destroy(), dt_pthread_rwlock_destroy, dt_cache_t::hashtable, dt_cache_entry_t::lock, dt_cache_t::lock, and dt_cache_t::lru.
Referenced by dt_image_cache_cleanup(), dt_mipmap_cache_cleanup(), and main().
int32_t dt_cache_contains | ( | dt_cache_t * | cache, |
const uint32_t | key | ||
) |
References dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_cache_t::hashtable, key, and dt_cache_t::lock.
Referenced by main().
int dt_cache_for_all | ( | dt_cache_t * | cache, |
int(*)(const uint32_t key, const void *data, void *user_data) | process, | ||
void * | user_data | ||
) |
void dt_cache_gc | ( | dt_cache_t * | cache, |
const float | fill_ratio | ||
) |
References dt_cache_entry_t::_lock_demoting, ASAN_UNPOISON_MEMORY_REGION, dt_cache_t::cleanup, dt_cache_t::cleanup_data, dt_cache_entry_t::cost, dt_cache_t::cost, dt_cache_t::cost_quota, dt_cache_entry_t::data, dt_cache_entry_t::data_size, dt_free_align, dt_pthread_rwlock_destroy, dt_pthread_rwlock_trywrlock, dt_pthread_rwlock_unlock, dt_cache_t::hashtable, dt_cache_entry_t::key, dt_cache_entry_t::link, dt_cache_entry_t::lock, and dt_cache_t::lru.
Referenced by dt_cache_get_with_caller().
dt_cache_entry_t * dt_cache_get_with_caller | ( | dt_cache_t * | cache, |
const uint32_t | key, | ||
char | mode, | ||
const char * | file, | ||
int | line | ||
) |
References dt_cache_entry_t::_lock_demoting, dt_cache_t::allocate, dt_cache_t::allocate_data, ASAN_POISON_MEMORY_REGION, dt_cache_entry_t::cost, dt_cache_t::cost, dt_cache_t::cost_quota, dt_cache_entry_t::data, dt_cache_entry_t::data_size, dt_alloc_align, dt_cache_gc(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_pthread_rwlock_init, dt_pthread_rwlock_rdlock_with_caller, dt_pthread_rwlock_tryrdlock_with_caller, dt_pthread_rwlock_trywrlock_with_caller, dt_pthread_rwlock_wrlock_with_caller, dt_cache_t::entry_size, dt_cache_t::hashtable, dt_cache_entry_t::key, key, dt_cache_entry_t::link, dt_cache_entry_t::lock, dt_cache_t::lock, and dt_cache_t::lru.
Referenced by dt_mipmap_cache_get_with_caller().
void dt_cache_init | ( | dt_cache_t * | cache, |
size_t | entry_size, | ||
size_t | cost_quota | ||
) |
References dt_cache_t::allocate, dt_cache_t::allocate_data, dt_cache_t::cleanup, dt_cache_t::cleanup_data, dt_cache_t::cost, dt_cache_t::cost_quota, dt_pthread_mutex_init(), dt_cache_t::entry_size, dt_cache_t::hashtable, dt_cache_t::lock, and dt_cache_t::lru.
Referenced by dt_image_cache_init(), dt_mipmap_cache_init(), and main().
void dt_cache_release_with_caller | ( | dt_cache_t * | cache, |
dt_cache_entry_t * | entry, | ||
const char * | file, | ||
int | line | ||
) |
References ASAN_POISON_MEMORY_REGION, dt_cache_entry_t::data, dt_cache_entry_t::data_size, dt_pthread_rwlock_unlock, and dt_cache_entry_t::lock.
Referenced by dt_mipmap_cache_release_with_caller().
int dt_cache_remove | ( | dt_cache_t * | cache, |
const uint32_t | key | ||
) |
References dt_cache_entry_t::_lock_demoting, ASAN_UNPOISON_MEMORY_REGION, dt_cache_t::cleanup, dt_cache_t::cleanup_data, dt_cache_entry_t::cost, dt_cache_t::cost, dt_cache_entry_t::data, dt_cache_entry_t::data_size, dt_free_align, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_pthread_rwlock_destroy, dt_pthread_rwlock_trywrlock, dt_pthread_rwlock_unlock, dt_cache_t::hashtable, key, dt_cache_entry_t::link, dt_cache_entry_t::lock, dt_cache_t::lock, dt_cache_t::lru, and void().
Referenced by dt_image_cache_remove(), dt_mimap_cache_evict(), and dt_mipmap_cache_remove_at_size().
dt_cache_entry_t * dt_cache_testget | ( | dt_cache_t * | cache, |
const uint32_t | key, | ||
char | mode | ||
) |
References ASAN_POISON_MEMORY_REGION, dt_cache_entry_t::data, dt_cache_entry_t::data_size, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_pthread_rwlock_tryrdlock, dt_pthread_rwlock_trywrlock, dt_cache_t::hashtable, key, dt_cache_entry_t::link, dt_cache_entry_t::lock, dt_cache_t::lock, and dt_cache_t::lru.
Referenced by dt_image_cache_testget(), dt_mipmap_cache_get_with_caller(), and dt_mipmap_cache_remove_at_size().