Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] simulated clock functions to be used by akypuera when tracing SMPI
authorLucas Schnorr <Lucas.Schnorr@imag.fr>
Tue, 14 Feb 2012 14:44:39 +0000 (15:44 +0100)
committerLucas Schnorr <Lucas.Schnorr@imag.fr>
Tue, 14 Feb 2012 14:49:11 +0000 (15:49 +0100)
include/smpi/smpi.h
src/smpi/smpi_bench.c

index 962b134..0a4152e 100644 (file)
@@ -425,6 +425,8 @@ XBT_PUBLIC(void) smpi_exit(int);
 
 XBT_PUBLIC(unsigned int) smpi_sleep(unsigned int secs);
 XBT_PUBLIC(int) smpi_gettimeofday(struct timeval *tv, struct timezone *tz);
+XBT_PUBLIC(unsigned long long) smpi_rastro_resolution (void);
+XBT_PUBLIC(unsigned long long) smpi_rastro_timestamp (void);
 XBT_PUBLIC(int) smpi_sample_1(int global, const char *file, int line,
                               int iters, double threshold);
 XBT_PUBLIC(int) smpi_sample_2(int global, const char *file, int line);
index 8c80d79..2134e47 100644 (file)
@@ -189,6 +189,26 @@ int smpi_gettimeofday(struct timeval *tv, struct timezone *tz)
   return 0;
 }
 
+extern double sg_maxmin_precision;
+unsigned long long smpi_rastro_resolution (void)
+{
+  smpi_bench_end();
+  double resolution = (1/sg_maxmin_precision);
+  smpi_bench_begin();
+  return (unsigned long long)resolution;
+}
+
+unsigned long long smpi_rastro_timestamp (void)
+{
+  smpi_bench_end();
+  double now = SIMIX_get_clock();
+
+  unsigned long long sec = (unsigned long long)now;
+  unsigned long long pre = (now - sec) * smpi_rastro_resolution();
+  smpi_bench_begin();
+  return (unsigned long long)sec * smpi_rastro_resolution() + pre;
+}
+
 static char *sample_location(int global, const char *file, int line)
 {
   if (global) {