Openfile and close file are essentially null operations in owfs under FUSE.

First off, there aren't any real files.
Second open and close are essentially ignored. It's only the read and write
that generate activity.

I did some measurements using 4 different ways to access 1000 owfs readings.

1. owread: (owserver --fake=10)

#!/bin/sh
d=`/opt/owfs/bin/owdir | grep 10`
time for a in {0..999} ; do /opt/owfs/bin/owread /uncached$d/temperature >
/dev/null ; done

real    0m2.428s
user    0m0.108s
sys    0m0.288s

2. owfs (owfs --fake=10 -m ~/1wire)

#!/bin/sh
d=`dir -1 ~/1wire | grep 10`
time for a in {0..999} ; do cat ~/1wire/uncached/$d/temperature > /dev/null
; done

real    0m1.910s
user    0m0.092s
sys    0m0.296s

3. owhttpd (owhttpd --fake=10 -p 4444)

#/bin/sh
d=`wget localhost:4444/ -q -O- | tr "<>" "\n\n" | grep "^10" | uniq`
time for a in {0..999} ; do wget localhost:4444/uncached/$d/temperature -q
-O/dev/null ; done

real    0m4.152s
user    0m0.164s
sys    0m0.384s

4. perl (this program):

#!/usr/bin/perl -w
use OW ;
OW::init("--fake=10");
for (split(',',OW::get("/")) ) {
    if (m/^10/) {
        my $d = $_ ;
        for (0..999) {
            OW::get($d."temperature") ;
        }
        exit 0 ;
    }
}

real    0m0.023s
user    0m0.012s
sys    0m0.008s



Conclusion:
All these cases are with no real 1-wire activity, they only measure the
overhead ( of the loop and process creation)
Of the shell methods, the filesystem case is fastest, and the web server is
slowest, at least if accessed by a new invocation of wget for every call.

Also note that the actual time per loop is 2-4 msec, so any method used to
get 1 second samples will have insignificant overhead costs.

If we include the perl example (of any method where a persistent connection
to the library is kept and no independent processes need to be launched for
each reading), the overhead is 20 usec.

Also note that all these examples would be a lot cleaner if the device
address were specified.

Paul Alfille

On Mon, Mar 26, 2012 at 5:35 PM, Roberto Spadim <[email protected]>wrote:

> i think owhttp have a bug in setting values (any one) i don´t know if
> the newest version have this problem, please check, if its ok tell us,
> if not tell us too =)
>
> Em 26 de março de 2012 18:25, Ivan Lisenkov <[email protected]> escreveu:
> > Thank you for your answers!
> >
> > The problem with selective search is that I don't know if the device is
> > still on a bus or not, so polling on ordinary search is more reliable for
> > hardware failure detection. Second, alarm is set for sensed values, not
> for
> > latches, so it is possible to miss some very short event.
> >
> > I know, 1-wire is not the fastest network on the Earth, but I'm trying my
> > best :)
> >
> > PS.
> >
> > It seems it is not possible to set negative alarm values for DS18B20
> > temperature sensors. Or it is a bug in owhttp interface?
> >
> >
> > Best Regards,
> >
> > Ivan, PhD
> >
> >
> >
> >
> >
> > On Tue, Mar 27, 2012 at 12:13 AM, Serg Oskin <[email protected]> wrote:
> >>
> >> Try to use the alarm-directory.
> >>
> >> # Setup
> >> foreach 12.*
> >>     openeach
> >>     writevalue_to_set_alarm
> >>     closeeach
> >> end foreach
> >>
> >> # Main loop
> >> foreach uncached/alarm
> >>     openeach
> >>     readvalue
> >>     reset_alarm
> >>     closeeach
> >> end loop
> >>
> >> --
> >> Serg.
> >>
> >> > Greetings to all,
> >> >
> >> > I am implementing a system which need to poll sensors (mainly DS2406
> and
> >> > DS2408) nearly every second. Of course I use uncached values of
> sensors to
> >> > get the most recent data. I have about 15-20 sensors to poll.
> >> >
> >> > I see three options:
> >> >
> >> > First:
> >> > loop:
> >> >     openfile("12.XXXXXXXX/latch.A");
> >> >     readvalue;
> >> >     closefile;
> >> > end loop.
> >> >
> >> > The most obvious one, but open/close file is rather costly operation.
> >> >
> >> > Second:
> >> > openfile("12.XXXXXXXX/latch.A");
> >> > loop:
> >> >      readvalue;
> >> >      goto_first_line;
> >> > end loop;
> >> > closefile;
> >> >
> >> > This is better, but is there some chance, that value will be cached
> >> > somewhere inside OS?
> >> >
> >> > Third:
> >> > give up on owfs and use owhttpd and make tcp connections to read
> files.
> >> >
> >> > I think this is a heaviest one, but crossplatform, so can be used on
> >> > windows. Can owhttpd have about 20 concurrent connections in a second?
> >> >
> >> >
> >> > What strategy to choose? Thank you for any help in advance.
> >> >
> >> >
> >> > Best Regards,
> >> >
> >> > Ivan, PhD
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> ------------------------------------------------------------------------------
> >> > This SF email is sponsosred by:
> >> > Try Windows Azure free for 90 days Click Here
> >> > http://p.sf.net/sfu/sfd2d-msazure
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > Owfs-developers mailing list
> >> > [email protected]
> >> > https://lists.sourceforge.net/lists/listinfo/owfs-developers
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> This SF email is sponsosred by:
> >> Try Windows Azure free for 90 days Click Here
> >> http://p.sf.net/sfu/sfd2d-msazure
> >> _______________________________________________
> >> Owfs-developers mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/owfs-developers
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > This SF email is sponsosred by:
> > Try Windows Azure free for 90 days Click Here
> > http://p.sf.net/sfu/sfd2d-msazure
> > _______________________________________________
> > Owfs-developers mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/owfs-developers
> >
>
>
>
> --
> Roberto Spadim
> Spadim Technology / SPAEmpresarial
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Owfs-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to