Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: Display scanning while access recordings
Emil Naepflein wrote:
>
> On Thu, 3 Jan 2002 18:04:05 +0100 (MET), Gerhard Achs
> <gerhard.achs@gmx.at> wrote:
>
> > I dont think itīs necessary to "find" every 30 seconds, VDR is intelligent
> > enough to search for recordings after recording something new or deleting old
> > recordings, isnīt it ??
>
> No, it just regenerates the list every time you enter the recording
> menu. In general this is fine because something may have changed through
> other threads or by external programs. The only problem is that it uses
> the find command instead of the ftw()/nftw() library function.
>
> Emil
I tried using the ftw() function, but it would appear that this takes
a lot longer than the 'find' command.
I took the following test program:
------------------------------------------
#include <ftw.h>
#include <stdio.h>
int Filter(const char *Name, const struct stat *Stat, int Status)
{
printf("%s\n", Name);
return 0;
}
int main(void)
{
ftw("/", Filter, 10);
return 0;
}
------------------------------------------
and compiled it with 'g++' into 'a.out. Then I did this:
------------------------------------------
kls@panther:/home/kls/vdr/VDR > time find / 2> /dev/null | wc -l
144488
real 0m0.780s
user 0m0.260s
sys 0m0.520s
kls@panther:/home/kls/vdr/VDR > time find / 2> /dev/null | wc -l
144518
real 0m0.772s
user 0m0.260s
sys 0m0.520s
kls@panther:/home/kls/vdr/VDR > time a.out | wc -l
144423
real 0m2.765s
user 0m0.520s
sys 0m2.050s
kls@panther:/home/kls/vdr/VDR > time a.out | wc -l
144423
real 0m2.576s
user 0m0.340s
sys 0m2.240s
------------------------------------------
To make sure both calls find the entire directory structure in memory
I repeated the calls several times.
Looking at these numbers I don't think it is a good idea to use ftw()
instead of 'find'. Or am I missing something here?
Maybe the time difference won't hurt when there are only few directories
to traverse (as is usually the case with VDR's /video), but since we are
looking for ways to speed up things, I guess it's not a good idea to switch
to a method that is known to be slower...
At first I liked the idea of an internal function instead of an external
command, because it would get rid of another dependency, but after these
tests I guess I'll stay with the 'find' - unless somebody can tell me that
I did something wrong.
Klaus
--
_______________________________________________________________
Klaus Schmidinger Phone: +49-8635-6989-10
CadSoft Computer GmbH Fax: +49-8635-6989-40
Hofmark 2 Email: kls@cadsoft.de
D-84568 Pleiskirchen, Germany URL: www.cadsoft.de
_______________________________________________________________
Home |
Main Index |
Thread Index