SIONlib  1.7.1
Scalable I/O library for parallel access to task-local files
sion_printts.c
Go to the documentation of this file.
1 /****************************************************************************
2 ** SIONLIB http://www.fz-juelich.de/jsc/sionlib **
3 *****************************************************************************
4 ** Copyright (c) 2008-2016 **
5 ** Forschungszentrum Juelich, Juelich Supercomputing Centre **
6 ** **
7 ** See the file COPYRIGHT in the package base directory for details **
8 ****************************************************************************/
9 
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <ctype.h>
14 #include <time.h>
15 #include <sys/time.h>
16 
17 #include "sion_printts.h"
18 #include "sion.h"
19 #include "sion_debug.h"
20 
27 #if defined(_SION_BGP) && defined(SION_MPI)
28 
29 #include <spi/kernel_interface.h>
30 #include <common/bgp_personality.h>
31 #include <common/bgp_personality_inlines.h>
32 
33 
34 static double clockspeed = 1.0e-6 / 850.0;
35 
36 double bgp_wtime()
37 {
38  return (_bgp_GetTimeBase() * clockspeed);
39  /*return(1.0); */
40 }
41 #elif defined(_SION_BGQ) && defined(SION_MPI)
42 
43 #include <firmware/include/personality.h>
44 #include <spi/include/kernel/process.h>
45 #include <spi/include/kernel/location.h>
46 #ifdef __GNUC__
47 #include <hwi/include/bqc/A2_inlines.h> /* for GetTimebase() */
48 #endif
49 #include <hwi/include/common/uci.h>
50 
51 static double clockspeed = 1.0e-6 / 850.0;
52 
53 double bgq_wtime()
54 {
55 #ifdef __IBMC__
56  return ( __mftb() * elg_clockspeed );
57 #elif defined __GNUC__
58  return ( GetTimeBase() * elg_clockspeed );
59 #else
60 #error "Platform BGQ: cannot determine timebase"
61 #endif
62 }
63 #elif defined(_BGL)
64 #include <rts.h>
65 
66 static double clockspeed = 1.0e-6 / 700.0;
67 
68 double bgl_wtime()
69 {
70  return (rts_get_timebase() * clockspeed);
71 }
72 #endif
73 
78 {
79 #if defined(_SION_BGL) && defined(SION_MPI)
80  return bgl_wtime();
81 #elif defined(_SION_BGQ) && defined(SION_MPI)
82  return bgp_wtime();
83 #elif defined(_SION_BGP) && defined(SION_MPI)
84  return bgp_wtime();
85 #else
86  struct timeval tp;
87  gettimeofday (&tp, (struct timezone *)NULL);
88  return tp.tv_sec + tp.tv_usec/1000000.0;
89 #endif
90 }
91 
100 int sion_print_time_stamp(int rank, char *desc)
101 {
102 #ifdef SION_DEBUG
103  if (!sion_isdebug())
104  return (1);
105 
106 #if defined(_BGL)
107  DPRINTFP((32, "TIMINGS", rank, " step=%-18s timestamp=%18.8f\n", desc, bgl_wtime()));
108 #else
109  DPRINTFP((32, "TIMINGS", rank, " step=%-18s timestamp=%18.8f AA \n", desc, _sion_get_time()));
110 #endif
111 #endif
112  return (1);
113 }
double _sion_get_time()
Returns the current time as a double.
Definition: sion_printts.c:77
int sion_print_time_stamp(int rank, char *desc)
Prints a sion time stamp.
Definition: sion_printts.c:100
Sion Time Stamp Header.