Cypress CSC-1200T Guía de usuario Pagina 105

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 124
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 104
Chapter 10. Miscellaneous notes 105
/* Wall clock time in seconds */
return (double) _rtc() * cpcycle * 1.0e-12;
}
This routine can be called either in C/C++ or Fortran. In C/C++ the
syntax is as follows:
extern double SECS(void);
double t1, t2, dt;
t1 = SECS();
... perform calculations ...
t2 = SECS();
dt=t2-t1;
printf("Elapsed time: %f\n",dt);
In Fortran 90:
REAL :: t1, t2, dt
REAL, EXTERNAL :: secs
t1 = secs()
... perform calculations ...
t2 = secs()
dt=t2-t1
WRITE (*,*) ’Elapsed time: ’, dt
To use the SECS routine from Fortran you have to first compile the C
routine and then link it with your program:
t3e% cc -c secs.c
t3e% f90 -o prog.x prog.f90 secs.o
10.1.3 The CPU clock timer
You can use the library function ICPUSED() in Fortran codes. This
function returns the CPU time of a task in real-time clock ticks:
INTEGER :: time
time = ICPUSED()
...computation...
time = ICPUSED() - time
WRITE (*,*) ’CPU time in user space = ’, &
time, ’ clock ticks’
C programmers can use the function cpused():
#include <time.h>
time_t before, after, utime;
before = cpused();
Vista de pagina 104
1 2 ... 100 101 102 103 104 105 106 107 108 109 110 ... 123 124

Comentarios a estos manuales

Sin comentarios