X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6b188a3ca7fe91cf125a08229fb4fe51eee26e6d..06436179b7648346ff5e55ff0a9fd9da67b499ec:/src/smpi/smpi_bench.c?ds=sidebyside diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index d69573014f..a985d30988 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -116,7 +116,7 @@ typedef struct { double relstderr; int iters; double threshold; - int started; + int running; } local_data_t; void smpi_bench_destroy(void) @@ -133,11 +133,11 @@ static void smpi_execute_flops(double flops) host = SIMIX_host_self(); XBT_DEBUG("Handle real computation time: %f flops", flops); - action = SIMIX_req_host_execute("computation", host, flops, 1); + action = simcall_host_execute("computation", host, flops, 1); #ifdef HAVE_TRACING - SIMIX_req_set_category (action, TRACE_internal_smpi_get_category()); + simcall_set_category (action, TRACE_internal_smpi_get_category()); #endif - SIMIX_req_host_execution_wait(action); + simcall_host_execution_wait(action); } static void smpi_execute(double duration) @@ -149,8 +149,8 @@ static void smpi_execute(double duration) xbt_cfg_get_double(_surf_cfg_set, "smpi/running_power")); } else { - XBT_DEBUG("Real computation took %f while threshold is set to %f; ignore it", - duration, xbt_cfg_get_double(_surf_cfg_set, "smpi/cpu_threshold")); + XBT_DEBUG("Real computation took %f while threshold is set to %f; ignore it", + duration, xbt_cfg_get_double(_surf_cfg_set, "smpi/cpu_threshold")); } } @@ -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) { @@ -215,7 +235,7 @@ int smpi_sample_1(int global, const char *file, int line, int iters, double thre data->sum_pow2 = 0.0; data->iters = iters; data->threshold = threshold; - data->started = 0; + data->running = 0; xbt_dict_set(samples, loc, data, NULL); return 0; } @@ -228,27 +248,27 @@ int smpi_sample_2(int global, const char *file, int line) char *loc = sample_location(global, file, line); local_data_t *data; - xbt_assert(samples, "You did something very inconsistent, didn't you?"); + xbt_assert(samples, "Y U NO use SMPI_SAMPLE_* macros? Stop messing directly with smpi_sample_* functions!"); data = xbt_dict_get_or_null(samples, loc); if (!data) { xbt_assert(data, "Please, do thing in order"); } - if (!data->started) { + if (!data->running) { if ((data->iters > 0 && data->count >= data->iters) || (data->count > 1 && data->threshold > 0.0 && data->relstderr <= data->threshold)) { XBT_DEBUG("Perform some wait of %f", data->mean); smpi_execute(data->mean); } else { - data->started = 1; + data->running = 1; data->count++; } } else { - data->started = 0; + data->running = 0; } free(loc); smpi_bench_begin(); smpi_process_simulated_start(); - return data->started; + return data->running; } void smpi_sample_3(int global, const char *file, int line) @@ -257,10 +277,10 @@ void smpi_sample_3(int global, const char *file, int line) local_data_t *data; double sample, n; - xbt_assert(samples, "You did something very inconsistent, didn't you?"); + xbt_assert(samples, "Y U NO use SMPI_SAMPLE_* macros? Stop messing directly with smpi_sample_* functions!"); data = xbt_dict_get_or_null(samples, loc); smpi_bench_end(); - if(data && data->started && data->count < data->iters) { + if(data && data->running && data->count < data->iters) { sample = smpi_process_simulated_elapsed(); data->sum += sample; data->sum_pow2 += sample * sample;