SIONlib  1.7.7
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-2019 **
5 ** Forschungszentrum Juelich, Juelich Supercomputing Centre **
6 ** **
7 ** See the file COPYRIGHT in the package base directory for details **
8 ****************************************************************************/
9 
10 #define _XOPEN_SOURCE 700
11 
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <string.h>
15 #include <ctype.h>
16 #include <time.h>
17 #include <sys/time.h>
18 
19 #include "sion_printts.h"
20 #include "sion.h"
21 #include "sion_debug.h"
22 
29 #if defined(_SION_BGP) && defined(SION_MPI)
30 
31 #include <spi/kernel_interface.h>
32 #include <common/bgp_personality.h>
33 #include <common/bgp_personality_inlines.h>
34 
35 
36 static double clockspeed = 1.0e-6 / 850.0;
37 
38 double bgp_wtime(void)
39 {
40  return (_bgp_GetTimeBase() * clockspeed);
41  /*return(1.0); */
42 }
43 #elif defined(_SION_BGQ) && defined(SION_MPI)
44 
45 #include <firmware/include/personality.h>
46 #include <spi/include/kernel/process.h>
47 #include <spi/include/kernel/location.h>
48 #ifdef __GNUC__
49 #include <hwi/include/bqc/A2_inlines.h> /* for GetTimebase() */
50 #endif
51 #include <hwi/include/common/uci.h>
52 
53 static double clockspeed = 1.0e-6 / 850.0;
54 
55 double bgq_wtime(void)
56 {
57 #ifdef __IBMC__
58  return ( __mftb() * elg_clockspeed );
59 #elif defined __GNUC__
60  return ( GetTimeBase() * elg_clockspeed );
61 #else
62 #error "Platform BGQ: cannot determine timebase"
63 #endif
64 }
65 #endif
66 
70 double _sion_get_time(void)
71 {
72 #if defined(_SION_BGQ) && defined(SION_MPI)
73  return bgp_wtime();
74 #elif defined(_SION_BGP) && defined(SION_MPI)
75  return bgp_wtime();
76 #else
77  struct timeval tp;
78  gettimeofday (&tp, (struct timezone *)NULL);
79  return tp.tv_sec + tp.tv_usec/1000000.0;
80 #endif
81 }
82 
91 int sion_print_time_stamp(int rank, char *desc)
92 {
93 #ifdef SION_DEBUG
94  if (!sion_isdebug())
95  return (1);
96 
97  DPRINTFP((32, "TIMINGS", rank, " step=%-18s timestamp=%18.8f AA \n", desc, _sion_get_time()));
98 #endif
99  return (1);
100 }
int sion_print_time_stamp(int rank, char *desc)
Prints a sion time stamp.
Definition: sion_printts.c:91
double _sion_get_time(void)
Returns the current time as a double.
Definition: sion_printts.c:70
Sion Time Stamp Header.