Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: qestion about thread priorities-> suggestion



Regarding usleep(<10000):

On all normal system (HZ=100) an usleep() with called with less than 10000 is 
not reliable and gives _very_ variing sleep-times between "0" and "10000".
Only kernels with usec-scheduling like KURT do that precisely.
IMHO in many of these cases longer sleeptimes are more suitable anyway, mostly 
to allow the system to fill buffers with enough data to process at once.

If you want 2MB/sec with an average frame size of about 500kb/25~=20kbytes (?)
and a sleep time of 10ms the patch rewrites too:

x = 2000kb/s * 0.01s / 20kb ~= 1;

If waited every x frames the data-rate increases accordingly.
Now the system processes 100 IO-operations per second with just 20kb.

> --- cutter.c.orig       2004-02-09 15:59:16.000000000 +0100
> +++ cutter.c    2003-09-12 12:26:24.000000000 +0200
> @@ -74,6 +74,7 @@
>       int FileSize = 0;
>       int CurrentFileNumber = 0;
>       int LastIFrame = 0;
> +     int i = 0;
>       toMarks.Add(0);
>       toMarks.Save();
>       uchar buffer[MAXFRAMESIZE];
> @@ -88,6 +89,8 @@
>
>             AssertFreeDiskSpace(-1);
>
> +           if(i++%1) usleep(10000);//%1~2MB/s; %2~4MB/s etc.
> +
>             // Read one frame:
>
>             if (fromIndex->Get(Index++, &FileNumber, &FileOffset,
> &PictureType, &Length)) {

Unfortunatley that makes cutting last longer, but one can not have anything at 
once ;-)



-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index