public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/53456] New: Add time support for VxWorks
@ 2012-05-22 19:04 rbmj at verizon dot net
  2012-05-22 19:06 ` [Bug fortran/53456] " rbmj at verizon dot net
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: rbmj at verizon dot net @ 2012-05-22 19:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

             Bug #: 53456
           Summary: Add time support for VxWorks
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rbmj@verizon.net


VxWorks has its own time/clock API and doesn't provide standard times(),
gettimeofday(), etc.  This patch adds support for this interface into
gf_cputime() and gf_gettime().

This is the last patch I need to get GCC with gfortran to build!


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
@ 2012-05-22 19:06 ` rbmj at verizon dot net
  2012-05-23  8:04 ` jb at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rbmj at verizon dot net @ 2012-05-22 19:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

--- Comment #1 from rbmj at verizon dot net 2012-05-22 19:04:03 UTC ---
Created attachment 27479
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27479
Patch against trunk


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
  2012-05-22 19:06 ` [Bug fortran/53456] " rbmj at verizon dot net
@ 2012-05-23  8:04 ` jb at gcc dot gnu.org
  2012-05-23  9:47 ` burnus at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jb at gcc dot gnu.org @ 2012-05-23  8:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

Janne Blomqvist <jb at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jb at gcc dot gnu.org

--- Comment #2 from Janne Blomqvist <jb at gcc dot gnu.org> 2012-05-23 07:14:58 UTC ---
According to 

http://www-kryo.desy.de/documents/vxWorks/V5.5/vxworks/ref/ansiTime.html

vxworks provides the C standard clock() and time() functions. The gf_gettime
and gf_cputime functions in libgfortran should fall back to these if other
functionality is not available. So the question is why does this fail?

Also, the part of the patch touching gf_cputime is certainly wrong: The point
of that function is to get the cpu time consumed by the current process, and
the patch uses the realtime clock. If vxwork doesn't provide CPU time, I think
it's better to just return an error, this is also what the vxworks clock()
appears to do.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
  2012-05-22 19:06 ` [Bug fortran/53456] " rbmj at verizon dot net
  2012-05-23  8:04 ` jb at gcc dot gnu.org
@ 2012-05-23  9:47 ` burnus at gcc dot gnu.org
  2012-05-23 13:13 ` rbmj at verizon dot net
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-05-23  9:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-23 09:35:29 UTC ---
For some reasons, the time() and clock() functions of POSIX do not seem to be
listed at
http://www-ad.fnal.gov/controls/micro_p/manuals/vxworks_application_programmers_guide_6.7.pdf
and
http://www-ad.fnal.gov/controls/micro_p/manuals/vxworks_kernel_api_reference_vol1_6.4.pdf

Those references only list the clockLib with the POSIX functions such as
clock_gettime.

I wonder whether clockLib is linked by default while ansiTime (which has
clock() and time() isn't)? If so, we should really think of using clockLib and,
thus, clock_gettime.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
                   ` (2 preceding siblings ...)
  2012-05-23  9:47 ` burnus at gcc dot gnu.org
@ 2012-05-23 13:13 ` rbmj at verizon dot net
  2012-05-23 14:58 ` jb at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rbmj at verizon dot net @ 2012-05-23 13:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

--- Comment #4 from rbmj at verizon dot net 2012-05-23 13:10:14 UTC ---
VxWorks does not provide the process time in most versions and for most cases. 
In fact, many VxWorks applications are not processes in the traditional sense
but instead tasks/threads spawned by the kernel in kernel space.

If returning an error is the preferred behavior for gf_cputime, then the code
as is should work.  But it doesn't seem optimal (IMHO) to only have second
resolution for gf_gettime.  If that is OK though, and preferable to introducing
new code (I could understand why), then that is fine too.

Also, I started working on this before realizing that the reason it failed to
compile initially was mis-configuration.  It should compile as-is, just not
work as well as (I believe) it could.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
                   ` (3 preceding siblings ...)
  2012-05-23 13:13 ` rbmj at verizon dot net
@ 2012-05-23 14:58 ` jb at gcc dot gnu.org
  2012-05-23 15:37 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jb at gcc dot gnu.org @ 2012-05-23 14:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

Janne Blomqvist <jb at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2012-05/msg01563.htm
                   |                            |l
   Last reconfirmed|                            |2012-05-23
     Ever Confirmed|0                           |1

--- Comment #5 from Janne Blomqvist <jb at gcc dot gnu.org> 2012-05-23 14:50:44 UTC ---
(In reply to comment #4)
> VxWorks does not provide the process time in most versions and for most cases. 
> In fact, many VxWorks applications are not processes in the traditional sense
> but instead tasks/threads spawned by the kernel in kernel space.
> 
> If returning an error is the preferred behavior for gf_cputime, then the code
> as is should work.

Yes, I do think it's better to return some kind of error rather than trying to
fake a value.

>  But it doesn't seem optimal (IMHO) to only have second
> resolution for gf_gettime.

Yes, fair enough. The patch I posted at

http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01563.html

should fix this.

> Also, I started working on this before realizing that the reason it failed to
> compile initially was mis-configuration.  It should compile as-is, just not
> work as well as (I believe) it could.

I see, thanks for the clarification. Attention to detail is appreciated, as I
don't have access to a vxworks system to test on myself.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
                   ` (4 preceding siblings ...)
  2012-05-23 14:58 ` jb at gcc dot gnu.org
@ 2012-05-23 15:37 ` burnus at gcc dot gnu.org
  2012-05-23 19:09 ` jb at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-05-23 15:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |UNCONFIRMED
     Ever Confirmed|1                           |0

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-23 15:36:26 UTC ---
(In reply to comment #4)
> VxWorks does not provide the process time in most versions and for most
> cases. In fact, many VxWorks applications are not processes in the
> traditional sense but instead tasks/threads spawned by the kernel in kernel
> space.

That's not different to, e.g., RTEMS which only allows for a single process but
multiple threads.


> If returning an error is the preferred behavior for gf_cputime, then the code
> as is should work.

I think returning "-1" is a sensible choice as the information is not
available.

An alternative would be: clock_gettime with CLOCK_MONOTONIC - but the starting
point is not defined; in case of VxWorks it seems to be the elapsed since
system startup, which would be a reasonable choice. However, POSIX allows other
choices, for instance since the (Unix) epoch.  [Plus CLOCK_MONOTONIC seems to
be valid only in VxWorks 6.x but not in 5.x]

(Another choice - available in 5.x - would be to use tickGet(), but that can be
reset via tickSet and has probably some other issues.)

Thus, instead of creating a special case for VxWorks, relying on 0 == start up
time, and papering over the difference between kernel startup vs. program
startup, returning -1 seems to be best.


Note: Fortran provides SYSTEM_CLOCK which - with libgfortran - calls
clock_gettime (using CLOCK_MONOTONIC if available and CLOCK_REALTIME if not) -
or as fall back, it calls gf_gettime (which calls gettimeofday, clock_gettime
w/ CLOCK_REALTIME, or time().)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
                   ` (5 preceding siblings ...)
  2012-05-23 15:37 ` burnus at gcc dot gnu.org
@ 2012-05-23 19:09 ` jb at gcc dot gnu.org
  2012-05-24 14:01 ` rbmj at verizon dot net
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jb at gcc dot gnu.org @ 2012-05-23 19:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

--- Comment #7 from Janne Blomqvist <jb at gcc dot gnu.org> 2012-05-23 18:52:52 UTC ---
Author: jb
Date: Wed May 23 18:52:47 2012
New Revision: 187806

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187806
Log:
PR 53456 clock_gettime fallback for gf_gettime

2012-05-23  Janne Blomqvist  <jb@gcc.gnu.org>

    PR fortran/53456
    * intrinsics/time_1.h (gf_gettime): Fallback for clock_gettime.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/intrinsics/time_1.h


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
                   ` (6 preceding siblings ...)
  2012-05-23 19:09 ` jb at gcc dot gnu.org
@ 2012-05-24 14:01 ` rbmj at verizon dot net
  2012-05-24 20:22 ` jb at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rbmj at verizon dot net @ 2012-05-24 14:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

rbmj at verizon dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #8 from rbmj at verizon dot net 2012-05-24 14:00:00 UTC ---
Fixed in 187806.  Enhancements pending:
http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01579.html


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
                   ` (7 preceding siblings ...)
  2012-05-24 14:01 ` rbmj at verizon dot net
@ 2012-05-24 20:22 ` jb at gcc dot gnu.org
  2012-06-04 19:14 ` jb at gcc dot gnu.org
  2012-06-04 19:15 ` jb at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jb at gcc dot gnu.org @ 2012-05-24 20:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

--- Comment #9 from Janne Blomqvist <jb at gcc dot gnu.org> 2012-05-24 20:19:46 UTC ---
Author: jb
Date: Thu May 24 20:19:37 2012
New Revision: 187846

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187846
Log:
PR 53456 CPU timing fallback using clock_gettime.

2012-05-24  Janne Blomqvist  <jb@gcc.gnu.org>

    PR fortran/53456
    * intrinsics/time_1.h (gf_cputime): Fallback for clock_gettime.


Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/intrinsics/time_1.h


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
                   ` (8 preceding siblings ...)
  2012-05-24 20:22 ` jb at gcc dot gnu.org
@ 2012-06-04 19:14 ` jb at gcc dot gnu.org
  2012-06-04 19:15 ` jb at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jb at gcc dot gnu.org @ 2012-06-04 19:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

--- Comment #10 from Janne Blomqvist <jb at gcc dot gnu.org> 2012-06-04 19:13:54 UTC ---
Author: jb
Date: Mon Jun  4 19:13:49 2012
New Revision: 188201

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188201
Log:
PR 53456 Fix typo in gf_cputime.

2012-06-04  Robert Mason  <rbmj@verizon.net>
        Janne Blomqvist  <jb@gcc.gnu.org>

    PR fortran/53456
    * intrinsics/time_1.h (gf_cputime): Fix typo in clock_gettime branch.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/intrinsics/time_1.h


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/53456] Add time support for VxWorks
  2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
                   ` (9 preceding siblings ...)
  2012-06-04 19:14 ` jb at gcc dot gnu.org
@ 2012-06-04 19:15 ` jb at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jb at gcc dot gnu.org @ 2012-06-04 19:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53456

--- Comment #11 from Janne Blomqvist <jb at gcc dot gnu.org> 2012-06-04 19:15:25 UTC ---
Author: jb
Date: Mon Jun  4 19:15:21 2012
New Revision: 188202

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188202
Log:
PR 53456 Fix incorrect ChangeLog entry.


Modified:
    trunk/libgfortran/ChangeLog


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-06-04 19:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-22 19:04 [Bug fortran/53456] New: Add time support for VxWorks rbmj at verizon dot net
2012-05-22 19:06 ` [Bug fortran/53456] " rbmj at verizon dot net
2012-05-23  8:04 ` jb at gcc dot gnu.org
2012-05-23  9:47 ` burnus at gcc dot gnu.org
2012-05-23 13:13 ` rbmj at verizon dot net
2012-05-23 14:58 ` jb at gcc dot gnu.org
2012-05-23 15:37 ` burnus at gcc dot gnu.org
2012-05-23 19:09 ` jb at gcc dot gnu.org
2012-05-24 14:01 ` rbmj at verizon dot net
2012-05-24 20:22 ` jb at gcc dot gnu.org
2012-06-04 19:14 ` jb at gcc dot gnu.org
2012-06-04 19:15 ` jb at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).