diff options
author | johnallen <[email protected]> | 2007-01-08 03:18:40 +0000 |
---|---|---|
committer | johnallen <[email protected]> | 2007-01-08 03:18:40 +0000 |
commit | 18189c197f5d5e04e8e8cd37de0caedb1a469a38 (patch) | |
tree | b0fbfe562fd5d8c371033d316fe455eb89c3eb45 /libhb/fifo.c | |
parent | dc22ce2c46ee62a46963d92ccb4a7fc26bd21d26 (diff) |
added worker thread sleep throttling.
each of the work object threads now self adjust their sleep interval based on the "fullness" of their fifo.
80% is the choose threshold.
Work objects with a fifo fullness of greater than 80% increase their sleep interval.
This allows other work object with less than 80% fullness more CPU usage.
Also adjusted thread_func, reader, and muxer sleep intervals to more reasonable values.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@98 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/fifo.c')
-rw-r--r-- | libhb/fifo.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libhb/fifo.c b/libhb/fifo.c index acdb21188..93e3e162e 100644 --- a/libhb/fifo.c +++ b/libhb/fifo.c @@ -101,6 +101,17 @@ int hb_fifo_is_full( hb_fifo_t * f ) return ret; } +float hb_fifo_percent_full( hb_fifo_t * f ) +{ + float ret; + + hb_lock( f->lock ); + ret = f->size / f->capacity; + hb_unlock( f->lock ); + + return ret; +} + hb_buffer_t * hb_fifo_get( hb_fifo_t * f ) { hb_buffer_t * b; |