| <html lang="en"> |
| <head> |
| <title>ETIME - The GNU Fortran Compiler</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="The GNU Fortran Compiler"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Intrinsic-Procedures.html#Intrinsic-Procedures" title="Intrinsic Procedures"> |
| <link rel="prev" href="ERFC_005fSCALED.html#ERFC_005fSCALED" title="ERFC_SCALED"> |
| <link rel="next" href="EXECUTE_005fCOMMAND_005fLINE.html#EXECUTE_005fCOMMAND_005fLINE" title="EXECUTE_COMMAND_LINE"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| Copyright (C) 1999-2013 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 or |
| any later version published by the Free Software Foundation; with the |
| Invariant Sections being ``Funding Free Software'', the Front-Cover |
| Texts being (a) (see below), and with the Back-Cover Texts being (b) |
| (see below). A copy of the license is included in the section entitled |
| ``GNU Free Documentation License''. |
| |
| (a) The FSF's Front-Cover Text is: |
| |
| A GNU Manual |
| |
| (b) The FSF's Back-Cover Text is: |
| |
| You have freedom to copy and modify this GNU Manual, like GNU |
| software. Copies published by the Free Software Foundation raise |
| funds for GNU development.--> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="ETIME"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="EXECUTE_005fCOMMAND_005fLINE.html#EXECUTE_005fCOMMAND_005fLINE">EXECUTE_COMMAND_LINE</a>, |
| Previous: <a rel="previous" accesskey="p" href="ERFC_005fSCALED.html#ERFC_005fSCALED">ERFC_SCALED</a>, |
| Up: <a rel="up" accesskey="u" href="Intrinsic-Procedures.html#Intrinsic-Procedures">Intrinsic Procedures</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">8.77 <code>ETIME</code> — Execution time subroutine (or function)</h3> |
| |
| <p><a name="index-ETIME-609"></a><a name="index-time_002c-elapsed-610"></a> |
| <dl> |
| <dt><em>Description</em>:<dd><code>ETIME(VALUES, TIME)</code> returns the number of seconds of runtime |
| since the start of the process's execution in <var>TIME</var>. <var>VALUES</var> |
| returns the user and system components of this time in <code>VALUES(1)</code> and |
| <code>VALUES(2)</code> respectively. <var>TIME</var> is equal to <code>VALUES(1) + VALUES(2)</code>. |
| |
| <p>On some systems, the underlying timings are represented using types with |
| sufficiently small limits that overflows (wrap around) are possible, such as |
| 32-bit types. Therefore, the values returned by this intrinsic might be, or |
| become, negative, or numerically less than previous values, during a single |
| run of the compiled program. |
| |
| <p>This intrinsic is provided in both subroutine and function forms; however, |
| only one form can be used in any given program unit. |
| |
| <p><var>VALUES</var> and <var>TIME</var> are <code>INTENT(OUT)</code> and provide the following: |
| |
| <p><table summary=""><tr align="left"><td valign="top" width="15%"></td><td valign="top" width="30%"><code>VALUES(1)</code>: </td><td valign="top" width="60%">User time in seconds. |
| <br></td></tr><tr align="left"><td valign="top" width="15%"></td><td valign="top" width="30%"><code>VALUES(2)</code>: </td><td valign="top" width="60%">System time in seconds. |
| <br></td></tr><tr align="left"><td valign="top" width="15%"></td><td valign="top" width="30%"><code>TIME</code>: </td><td valign="top" width="60%">Run time since start in seconds. |
| <br></td></tr></table> |
| |
| <br><dt><em>Standard</em>:<dd>GNU extension |
| |
| <br><dt><em>Class</em>:<dd>Subroutine, function |
| |
| <br><dt><em>Syntax</em>:<dd> |
| <p><table summary=""><tr align="left"><td valign="top" width="80%"><code>CALL ETIME(VALUES, TIME)</code>. |
| <br></td></tr><tr align="left"><td valign="top" width="80%"><code>TIME = ETIME(VALUES)</code>, (not recommended). |
| <br></td></tr></table> |
| |
| <br><dt><em>Arguments</em>:<dd> |
| <p><table summary=""><tr align="left"><td valign="top" width="15%"><var>VALUES</var></td><td valign="top" width="70%">The type shall be <code>REAL(4), DIMENSION(2)</code>. |
| <br></td></tr><tr align="left"><td valign="top" width="15%"><var>TIME</var></td><td valign="top" width="70%">The type shall be <code>REAL(4)</code>. |
| <br></td></tr></table> |
| |
| <br><dt><em>Return value</em>:<dd>Elapsed time in seconds since the start of program execution. |
| |
| <br><dt><em>Example</em>:<dd> |
| <pre class="smallexample"> program test_etime |
| integer(8) :: i, j |
| real, dimension(2) :: tarray |
| real :: result |
| call ETIME(tarray, result) |
| print *, result |
| print *, tarray(1) |
| print *, tarray(2) |
| do i=1,100000000 ! Just a delay |
| j = i * i - i |
| end do |
| call ETIME(tarray, result) |
| print *, result |
| print *, tarray(1) |
| print *, tarray(2) |
| end program test_etime |
| </pre> |
| <br><dt><em>See also</em>:<dd><a href="CPU_005fTIME.html#CPU_005fTIME">CPU_TIME</a> |
| |
| </dl> |
| |
| </body></html> |
| |