summaryrefslogtreecommitdiff
path: root/src/lib/eio
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2018-06-19 13:33:14 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-06-19 13:33:14 -0400
commit2acb5e506aa02ef73281c3b63ac21422bf996a9b (patch)
treeada519506279149dd75e2cdeb31a0adaf51f07ea /src/lib/eio
parent6353a699e3161bc2a6a962e76cffc7257b250da0 (diff)
eio: add method for setting the global file polling rate for fallback monitors
Summary: the default value for the fallback poll monitor timer interval is 60.0 seconds, which is not useful for all cases, such as CI, where we don't care about cpu usage and just want things to process as fast as possible at all times this enables setting the interval to any value, ensuring that any existing timers are modified to use that value immediately @feature Reviewers: stefan_schmidt, bu5hm4n, raster, devilhorns, ManMower Reviewed By: bu5hm4n, ManMower Subscribers: ManMower, raster, bu5hm4n, cedric, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D6247
Diffstat (limited to 'src/lib/eio')
-rw-r--r--src/lib/eio/Eio.h9
-rw-r--r--src/lib/eio/eio_monitor_poll.c30
2 files changed, 37 insertions, 2 deletions
diff --git a/src/lib/eio/Eio.h b/src/lib/eio/Eio.h
index 2a446d6ed4..cc986938dd 100644
--- a/src/lib/eio/Eio.h
+++ b/src/lib/eio/Eio.h
@@ -120,6 +120,15 @@ static inline Eina_Bool eio_file_is_dir(const Eina_Stat *stat);
120 */ 120 */
121static inline Eina_Bool eio_file_is_lnk(const Eina_Stat *stat); 121static inline Eina_Bool eio_file_is_lnk(const Eina_Stat *stat);
122 122
123/**
124 * @ingroup Eio
125 *
126 * @brief Set the polling interval to control the fallback monitor behavior
127 * @param interval The interval (in seconds) to poll
128 * @since 1.21
129 */
130EAPI void eio_monitoring_interval_set(double interval);
131
123#include "eio_inline_helper.x" 132#include "eio_inline_helper.x"
124 133
125#define EIO_VERSION_MAJOR EFL_VERSION_MAJOR 134#define EIO_VERSION_MAJOR EFL_VERSION_MAJOR
diff --git a/src/lib/eio/eio_monitor_poll.c b/src/lib/eio/eio_monitor_poll.c
index fc4b70e8c5..be27eaaf75 100644
--- a/src/lib/eio/eio_monitor_poll.c
+++ b/src/lib/eio/eio_monitor_poll.c
@@ -54,6 +54,9 @@ struct _Eio_Monitor_Backend
54 Eina_Bool destroyed : 1; 54 Eina_Bool destroyed : 1;
55}; 55};
56 56
57static double fallback_interval = 60.0;
58static Eina_Hash *timer_hash;
59
57static Eina_Bool _eio_monitor_fallback_timer_cb(void *data); 60static Eina_Bool _eio_monitor_fallback_timer_cb(void *data);
58 61
59static void 62static void
@@ -217,7 +220,8 @@ _eio_monitor_fallback_end_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
217 Eio_Monitor_Backend *backend = data; 220 Eio_Monitor_Backend *backend = data;
218 221
219 backend->work = NULL; 222 backend->work = NULL;
220 backend->timer = ecore_timer_add(60.0, _eio_monitor_fallback_timer_cb, backend); 223 backend->timer = ecore_timer_add(fallback_interval, _eio_monitor_fallback_timer_cb, backend);
224 eina_hash_set(timer_hash, &backend, backend->timer);
221} 225}
222 226
223static void 227static void
@@ -231,7 +235,8 @@ _eio_monitor_fallback_cancel_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
231 free(backend); 235 free(backend);
232 return; 236 return;
233 } 237 }
234 backend->timer = ecore_timer_add(60.0, _eio_monitor_fallback_timer_cb, backend); 238 backend->timer = ecore_timer_add(fallback_interval, _eio_monitor_fallback_timer_cb, backend);
239 eina_hash_set(timer_hash, &backend, backend->timer);
235} 240}
236 241
237static Eina_Bool 242static Eina_Bool
@@ -253,6 +258,7 @@ _eio_monitor_fallback_timer_cb(void *data)
253 Eio_Monitor_Backend *backend = data; 258 Eio_Monitor_Backend *backend = data;
254 259
255 backend->timer = NULL; 260 backend->timer = NULL;
261 eina_hash_set(timer_hash, &backend, NULL);
256 backend->idler = ecore_idler_add(_eio_monitor_fallback_idler_cb, backend); 262 backend->idler = ecore_idler_add(_eio_monitor_fallback_idler_cb, backend);
257 263
258 return EINA_FALSE; 264 return EINA_FALSE;
@@ -274,10 +280,13 @@ _eio_monitor_fallback_timer_cb(void *data)
274 && !defined HAVE_NOTIFY_KEVENT 280 && !defined HAVE_NOTIFY_KEVENT
275void eio_monitor_backend_init(void) 281void eio_monitor_backend_init(void)
276{ 282{
283 timer_hash = eina_hash_pointer_new(NULL);
277} 284}
278 285
279void eio_monitor_backend_shutdown(void) 286void eio_monitor_backend_shutdown(void)
280{ 287{
288 eina_hash_free(timer_hash);
289 timer_hash = NULL;
281} 290}
282 291
283void eio_monitor_backend_add(Eio_Monitor *monitor) 292void eio_monitor_backend_add(Eio_Monitor *monitor)
@@ -333,6 +342,7 @@ eio_monitor_fallback_del(Eio_Monitor *monitor)
333 if (backend->work) ecore_thread_cancel(backend->work); 342 if (backend->work) ecore_thread_cancel(backend->work);
334 343
335 if (backend->timer) ecore_timer_del(backend->timer); 344 if (backend->timer) ecore_timer_del(backend->timer);
345 eina_hash_set(timer_hash, &backend, NULL);
336 backend->timer = NULL; 346 backend->timer = NULL;
337 if (backend->idler) ecore_idler_del(backend->idler); 347 if (backend->idler) ecore_idler_del(backend->idler);
338 backend->idler = NULL; 348 backend->idler = NULL;
@@ -356,3 +366,19 @@ eio_monitor_fallback_del(Eio_Monitor *monitor)
356/*============================================================================* 366/*============================================================================*
357 * API * 367 * API *
358 *============================================================================*/ 368 *============================================================================*/
369
370
371EAPI void
372eio_monitoring_interval_set(double interval)
373{
374 Eina_Iterator *it;
375 Ecore_Timer *timer;
376
377 EINA_SAFETY_ON_TRUE_RETURN(interval < 0.0);
378 fallback_interval = interval;
379 if (!timer_hash) return;
380 it = eina_hash_iterator_data_new(timer_hash);
381 EINA_ITERATOR_FOREACH(it, timer)
382 ecore_timer_interval_set(timer, fallback_interval);
383 eina_iterator_free(it);
384}