From: Lucas Schnorr Date: Tue, 14 Feb 2012 14:44:39 +0000 (+0100) Subject: [trace] simulated clock functions to be used by akypuera when tracing SMPI X-Git-Tag: exp_20120216~6 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a4cd01763d667daf639c2ba8b2347e67392008cf?hp=8205b9203eb3f2098cd7dcbd8e72d26b7977915a [trace] simulated clock functions to be used by akypuera when tracing SMPI --- diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 962b1349aa..0a4152e48a 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -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); diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index 8c80d793d4..2134e47357 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -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) {