On Thu, Mar 26, 2009 at 03:33:54AM -0700, Peter (Stig) Edwards wrote:
> On Mar 25, 5:48 pm, Tim Bunce <[email protected]> wrote:
> > On Wed, Mar 25, 2009 at 03:46:37PM +0000, [email protected] wrote:
> >
> > > Author: thatsafunnyname
> > > Date: Wed Mar 25 08:30:24 2009
> > > New Revision: 721
> >
> > > Modified:
> > >     trunk/t/50-errno.t
> >
> > > Log:
> > > Allow nytprof.out file to have 0 size on VMS as buffers have not flushed.
> >
> > Does fflush() (in NYTP_flush) not flush?
> > Could you add code to NYTP_flush to make it flush on VMS?
> 
> fflush() forces a flush of user-space buffered data according to "man
> 3 fflush", there is also this note in the man 3 page:
> 
>  Note that fflush() only flushes the user space buffers provided by
>  the C  library.   To ensure that the data is physically stored on
>  disk the kernel buffers must be flushed too, e.g. with sync(2) or
>  fsync(2).
> 
> Adding a fsync call after the flush forces the flush to disk (tested
> on VMS)

Normally (in unix) when data for a file is flushed into the kernel then
other references to that file will see the new data (and metadata, like
size) irrespective of whether the data has reached the physical disk yet.

Perhaps that's not true on VMS.

Oh well. Nevermind. Thanks!

Tim.

> <     return fflush(file->file);
> ---
> >     fflush(file->file);
> >     return fsync(fileno(file->file));
> 
> But calling fsync on VMS will cause a significant performance
> decrease.
> 
> Some links I read:
>    http://h71000.www7.hp.com/wizard/wiz_0103.html
>    http://h71000.www7.hp.com/wizard/wiz_2295.html
> 
> I don't know if the benefit of a flush to disk fsync() outweights the
> performance cost on VMS.

> > > Modified: trunk/t/50-errno.t
> > > ===========================================================================
> > >  ===
> > > --- trunk/t/50-errno.t     (original)
> > > +++ trunk/t/50-errno.t     Wed Mar 25 08:30:24 2009
> > > @@ -1,4 +1,4 @@
> > > -use Test::More tests => 5;
> > > +use Test::More tests => 6;
> >
> > >   my $nytprof_out;
> > >   BEGIN {
> > > @@ -16,7 +16,12 @@
> > >   is 0+$!, 9999, '$! should not be altered by NYTProf';
> >
> > >   my $size1 = -s $nytprof_out;
> > > -cmp_ok $size1, '>', 0, "$nytprof_out should exist and not be empty";
> > > +cmp_ok $size1, '>=', 0, "$nytprof_out should exist";
> > > +
> > > +SKIP: {
> > > +    skip 'On VMS buffer is not flushed', 1 if ($^O eq 'VMS');
> > > +    cmp_ok $size1, '>', 0, "$nytprof_out should not be empty";
> > > +}
> >
> > >   $! = 9999;
> > >   example_sub();
> > 

--~--~---------~--~----~------------~-------~--~----~
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to