[m-rev.] diff: Use gettimeofday() for Mercury's ThreadScope support.

Paul Bone pbone at csse.unimelb.edu.au
Thu Jun 21 11:43:07 AEST 2012


On Wed, Jun 20, 2012 at 11:56:19PM +1000, Julien Fischer wrote:
> 
> 
> 
> On Wed, 20 Jun 2012, Paul Bone wrote:
> 
> >On Wed, Jun 20, 2012 at 11:25:13PM +1000, Julien Fischer wrote:
> >>
> >>On Wed, 20 Jun 2012, Paul Bone wrote:
> >>
> >>>Index: runtime/mercury_threadscope.c
> >>>===================================================================
> >>>RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_threadscope.c,v
> >>>retrieving revision 1.20
> >>>diff -u -r1.20 mercury_threadscope.c
> >>>--- runtime/mercury_threadscope.c	19 Jun 2012 11:08:16 -0000	1.20
> >>>+++ runtime/mercury_threadscope.c	20 Jun 2012 12:59:41 -0000
> >>
> >>>+static Time
> >>>+gettimeofday_nsecs(void)
> >>>+{
> >>>+    struct timeval      tv;
> >>>+
> >>>+    if (0 != gettimeofday(&tv, NULL)) {
> >>>+        perror("gettimeofday()");
> >>>+        /*
> >>>+        ** Return a stupid value generating an obviously bad logfile
> >>>+        ** rather than crashing a program that may otherwise work.
> >>>+        */
> >>>+        return 0;
> >>>   }
> >>>+    return (Time)tv.tv_sec * 1000000000 +
> >>>+            (Time)tv.tv_usec * 1000;
> >>>}
> >>
> >>The body of that function should be protected by
> >>
> >>   #if defined(MR_HAVE_GETTIMEOFDAY)
> >>
> >>(unless that is implied by the surrouding context.)
> >
> >I'll make another change later to make threadscope depend on gettimeofday.
> 
> Could you at least leave things in a state where the runtime will compile
> on systems that don't provide gettimeofday.
> 

it will compile provided that threadscope is not used.  ThreadScope can only be
used if --enable-libgrades or --enable-additional-libgrades is used with
configure.

I'm looking for somewhere in configure where we tell the user that the grades
they've selected cannot be used.  For example, because some feature is not
available such as gettimeofday().  The problem is, that according to
configure.in a user can say --enable-libgrades=asm_fast.gc.par even if they
don't have pthreads or support for asm_fast.  Configure will run and then the
system will fail to build.

I want to avoid placing more checks than I need to, there should be one
canonical place to check a grade's dependencies and tell the user "you can't
have this grade".  Ideally this should be as early as possible in the user's
experience.

I'll be in the office tomorrow.  We can talk about it in person and look at
configure.in together.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20120621/376ef0c5/attachment.sig>


More information about the reviews mailing list