Re: PosixError.SysCall.simpleResultAux

Kostirya <[email protected]> Thu, 25 Aug 2016 09:23:19 +0300
Newsgroups gmane.comp.lang.ml.mlton.user
Message-ID <CAG+QnTdpsO738Whage=uVRP9Vdm4fYXJ-E-HRCuOt+zM4YRUKA@mail.gmail.com>
Thank you very much for explanation!

2016-08-24 4:06 GMT+03:00 Matthew Fluet <[email protected]>:

> On Tue, Aug 23, 2016 at 7:31 AM, Kostirya <[email protected]> wrote:
> > Tell me, please, why PosixError.SysCall.simpleResultAux takes large
> percent
> > in the results of profiling:
> >
> >               function                cur
> > ------------------------------------ -----
> > PosixError.SysCall.simpleResultAux   28.0%
> > Sequence.concat                      14.0%
> > Integer.fmt                          12.0%
> > <gc>                                  6.0%
> > EV.kevent_wait                        6.0%
> > EV.kevent_change                      6.0%
> > ...
> >
> > This is event driven server.
> > In addition to work with string and sockets, the server use FFI call for
> > kevent (bsd).
> >
> > And what I may do to decrease this value?
>
> PosixError.SysCall.simpleResultAux is defined at
> https://github.com/MLton/mlton/blob/master/basis-
> library/posix/error.sml#L291.
> Essentially, it is used as a wrapper for any Posix / C library
> function that returns -1 on error and sets errno.  The fact that it is
> taking a large percent of the running time is probably indicative of
> the fact that the program is often blocking in a system call; that
> would seem to be consistent with an event driven server program.
>
> To investigate further, you could compile with "-profile-include
> '.*'".  By default, MLton excludes the Basis Library implementation
> from profiling; really, this simply means that profiling will
> attribute time to the outermost Basis Library function, rather than
> inner functions.  With "-profile-include '.*'", you override that
> default and MLton will include the Basis Library implementation with
> profiling.  That might reveal which function is being called by
> PosixError.SysCall.simpleResultAux.  Also, you could compile with
> "-profile-stack true", which will attribute time to all functions on
> the stack; see http://mlton.org/ProfilingTheStack for more details.
> This might also help to understand the program.
>
> Finally, the cost of PosixError.SysCall.simpleResultAux might be
> inflated due to profiling.  Although MLton installs with profiling
> signal handler with "SA_RESTART" (indicating that interrupted system
> calls should be automatically restarted), it may be that a system call
> is being repeatedly interrupted by the profiling signal and its
> resumption is contributing to the running time.
>

-- 
You received this message because you are subscribed to the Google Groups "MLton-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

------------------------------------------------------------------------------

_______________________________________________
MLton-user mailing list
[email protected]; [email protected]
https://lists.sourceforge.net/lists/listinfo/mlton-user