![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "develop/gui_throttle.h"#include "system/macros.h"#include "system/atomic.h"#include "system/dtpthread.h"#include <stdint.h>
Include dependency graph for gui_throttle.c:Go to the source code of this file.
Data Structures | |
| struct | dt_gui_throttle_task_t |
| struct | dt_gui_throttle_state_t |
Macros | |
| #define | DT_GUI_THROTTLE_RUNTIME_CONF "processing/gui_throttle_runtime_us" |
Typedefs | |
| typedef struct dt_gui_throttle_task_t | dt_gui_throttle_task_t |
| typedef struct dt_gui_throttle_state_t | dt_gui_throttle_state_t |
Functions | |
| static dt_gui_throttle_task_t * | _find_task (gpointer source) |
| void | dt_gui_throttle_set_timeout_ms (guint timeout_ms) |
| static guint | _get_user_timeout_ms (void) |
| static guint | _runtime_us_to_ms (const int runtime_us) |
| static guint | _effective_timeout_ms (void) |
| static gboolean | _dispatch_pending_tasks (gpointer user_data) |
| void | dt_gui_throttle_init (int saved_runtime_us_in) |
| void | dt_gui_throttle_cleanup (void) |
| void | dt_gui_throttle_record_runtime (const dt_throttle_slot_t slot, const gint64 runtime_us) |
| int | dt_gui_throttle_get_runtime_us (void) |
| int | dt_gui_throttle_get_pipe_runtime_us (const dt_throttle_slot_t slot) |
| guint | dt_gui_throttle_get_timeout_ms (void) |
| gint64 | dt_gui_throttle_get_timeout_us (void) |
| void | dt_gui_throttle_queue (gpointer source, dt_gui_throttle_callback_t callback, gpointer user_data) |
| void | dt_gui_throttle_cancel (gpointer source) |
Variables | |
| static dt_gui_throttle_state_t | _gui_throttle = { 0 } |
| static guint | _user_timeout_ms = 0 |
| #define DT_GUI_THROTTLE_RUNTIME_CONF "processing/gui_throttle_runtime_us" |
Definition at line 27 of file gui_throttle.c.
| typedef struct dt_gui_throttle_state_t dt_gui_throttle_state_t |
| typedef struct dt_gui_throttle_task_t dt_gui_throttle_task_t |
|
static |
Definition at line 96 of file gui_throttle.c.
References _gui_throttle, dt_gui_throttle_task_t::callback, dt_gui_throttle_state_t::pending_tasks, dt_gui_throttle_state_t::timeout_source, dt_gui_throttle_task_t::user_data, and void().
Referenced by dt_gui_throttle_queue().
|
static |
Definition at line 88 of file gui_throttle.c.
References _get_user_timeout_ms(), _gui_throttle, _runtime_us_to_ms(), dt_gui_throttle_state_t::avg_runtime_us, dt_atomic_get_int(), and MIN.
Referenced by dt_gui_throttle_get_timeout_ms(), dt_gui_throttle_get_timeout_us(), and dt_gui_throttle_queue().
|
static |
Definition at line 58 of file gui_throttle.c.
References _gui_throttle, dt_gui_throttle_state_t::pending_tasks, and dt_gui_throttle_task_t::source.
Referenced by dt_gui_throttle_queue().
|
static |
Definition at line 77 of file gui_throttle.c.
References _user_timeout_ms.
Referenced by _effective_timeout_ms().
|
static |
Definition at line 82 of file gui_throttle.c.
References MAX.
Referenced by _effective_timeout_ms().
| void dt_gui_throttle_cancel | ( | gpointer | source | ) |
Definition at line 283 of file gui_throttle.c.
References _gui_throttle, IS_NULL_PTR, dt_gui_throttle_state_t::pending_tasks, dt_gui_throttle_task_t::source, and dt_gui_throttle_state_t::timeout_source.
Referenced by _area_button_release_callback(), cleanup(), dt_dev_cleanup(), dt_gui_throttle_queue(), gui_cleanup(), and leave().
Definition at line 146 of file gui_throttle.c.
References _gui_throttle, dt_pthread_mutex_destroy(), dt_gui_throttle_state_t::pending_tasks, dt_gui_throttle_state_t::runtime_mutex, and dt_gui_throttle_state_t::timeout_source.
Referenced by dt_cleanup().
| int dt_gui_throttle_get_pipe_runtime_us | ( | const dt_throttle_slot_t | slot | ) |
Definition at line 223 of file gui_throttle.c.
References _gui_throttle, dt_gui_throttle_state_t::avg_full_runtime_us, dt_gui_throttle_state_t::avg_preview_runtime_us, dt_atomic_get_int(), dt_gui_throttle_get_runtime_us(), DT_THROTTLE_SLOT_MAIN, DT_THROTTLE_SLOT_OTHER, DT_THROTTLE_SLOT_PREVIEW, and MAX.
Referenced by _live_publish_interval_us().
| int dt_gui_throttle_get_runtime_us | ( | void | ) |
Definition at line 218 of file gui_throttle.c.
References _gui_throttle, dt_gui_throttle_state_t::avg_runtime_us, dt_atomic_get_int(), and MAX.
Referenced by dt_cleanup(), and dt_gui_throttle_get_pipe_runtime_us().
| guint dt_gui_throttle_get_timeout_ms | ( | void | ) |
Definition at line 239 of file gui_throttle.c.
References _effective_timeout_ms().
Referenced by _queue_pending_commit(), and dt_dev_history_flush_pending_commits().
| gint64 dt_gui_throttle_get_timeout_us | ( | void | ) |
Definition at line 244 of file gui_throttle.c.
References _effective_timeout_ms().
| void dt_gui_throttle_init | ( | int | saved_runtime_us | ) |
| saved_runtime_us | the average redraw time persisted from the last session, or 0. |
Definition at line 118 of file gui_throttle.c.
References _gui_throttle, dt_gui_throttle_state_t::avg_full_runtime_us, dt_gui_throttle_state_t::avg_preview_runtime_us, dt_gui_throttle_state_t::avg_runtime_us, dt_atomic_set_int(), dt_pthread_mutex_init(), i, MAX, dt_gui_throttle_state_t::pending_tasks, dt_gui_throttle_state_t::recent_full_runtime_count, dt_gui_throttle_state_t::recent_full_runtime_pos, dt_gui_throttle_state_t::recent_full_runtime_us, dt_gui_throttle_state_t::recent_preview_runtime_count, dt_gui_throttle_state_t::recent_preview_runtime_pos, dt_gui_throttle_state_t::recent_preview_runtime_us, dt_gui_throttle_state_t::recent_runtime_count, dt_gui_throttle_state_t::recent_runtime_pos, dt_gui_throttle_state_t::recent_runtime_us, and dt_gui_throttle_state_t::runtime_mutex.
Referenced by dt_init().
| void dt_gui_throttle_queue | ( | gpointer | source, |
| dt_gui_throttle_callback_t | callback, | ||
| gpointer | user_data | ||
| ) |
Definition at line 251 of file gui_throttle.c.
References _dispatch_pending_tasks(), _effective_timeout_ms(), _find_task(), _gui_throttle, dt_gui_throttle_task_t::callback, dt_gui_throttle_cancel(), IS_NULL_PTR, dt_gui_throttle_state_t::pending_tasks, dt_gui_throttle_task_t::source, dt_gui_throttle_state_t::timeout_source, and dt_gui_throttle_task_t::user_data.
Referenced by _area_button_press_callback(), _area_motion_notify_callback(), _delayed_history_commit(), _queue_delayed_history_commit(), button_pressed(), and scrolled().
| void dt_gui_throttle_record_runtime | ( | const dt_throttle_slot_t | slot, |
| const gint64 | runtime_us | ||
| ) |
Definition at line 162 of file gui_throttle.c.
References _gui_throttle, dt_gui_throttle_state_t::avg_full_runtime_us, dt_gui_throttle_state_t::avg_preview_runtime_us, dt_gui_throttle_state_t::avg_runtime_us, dt_atomic_set_int(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), DT_THROTTLE_SLOT_MAIN, DT_THROTTLE_SLOT_OTHER, DT_THROTTLE_SLOT_PREVIEW, i, MAX, MIN, dt_gui_throttle_state_t::recent_full_runtime_count, dt_gui_throttle_state_t::recent_full_runtime_pos, dt_gui_throttle_state_t::recent_full_runtime_us, dt_gui_throttle_state_t::recent_preview_runtime_count, dt_gui_throttle_state_t::recent_preview_runtime_pos, dt_gui_throttle_state_t::recent_preview_runtime_us, dt_gui_throttle_state_t::recent_runtime_count, dt_gui_throttle_state_t::recent_runtime_pos, dt_gui_throttle_state_t::recent_runtime_us, and dt_gui_throttle_state_t::runtime_mutex.
Referenced by dt_dev_darkroom_pipeline().
| void dt_gui_throttle_set_timeout_ms | ( | guint | timeout_ms | ) |
Maximum time a queued task may wait, in ms. Set by the host from its preferences; 0 disables the timeout.
Definition at line 72 of file gui_throttle.c.
References _user_timeout_ms.
Referenced by dt_init().
|
static |
Definition at line 56 of file gui_throttle.c.
Referenced by _dispatch_pending_tasks(), _effective_timeout_ms(), _find_task(), dt_gui_throttle_cancel(), dt_gui_throttle_cleanup(), dt_gui_throttle_get_pipe_runtime_us(), dt_gui_throttle_get_runtime_us(), dt_gui_throttle_init(), dt_gui_throttle_queue(), and dt_gui_throttle_record_runtime().
|
static |
Definition at line 70 of file gui_throttle.c.
Referenced by _get_user_timeout_ms(), and dt_gui_throttle_set_timeout_ms().