X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0137f14a0c14e604049cfa61688d075686496f05..6760cb07d6b57be16928d95339d71e57c4e24f36:/src/smpi/smpi_util.c diff --git a/src/smpi/smpi_util.c b/src/smpi/smpi_util.c index ac5d3721ba..29f570bfcc 100644 --- a/src/smpi/smpi_util.c +++ b/src/smpi/smpi_util.c @@ -1,52 +1,51 @@ +/* Copyright (c) 2007, 2009, 2010. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + #include "private.h" +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_util, smpi, + "Logging specific to SMPI (utilities)"); + +/* int smpi_gettimeofday(struct timeval *tv, struct timezone *tz) { - double now; - int retval = 0; - smpi_bench_end(); - if (NULL == tv) { - retval = -1; - } else { - now = SIMIX_get_clock(); - tv->tv_sec = now; - tv->tv_usec = ((now - (double)tv->tv_sec) * 1000000.0); - } - smpi_bench_begin(); - return retval; + double now; + int retval; + smpi_bench_end(); + retval = 0; + if (NULL == tv) { + retval = -1; + } else { + now = SIMIX_get_clock(); + tv->tv_sec = now; + tv->tv_usec = ((now - (double) tv->tv_sec) * 1000000.0); + } + smpi_bench_begin(); + return retval; } unsigned int smpi_sleep(unsigned int seconds) { - smx_host_t host; - smx_action_t action; - - smpi_bench_end(); - - host = SIMIX_host_self(); - - SIMIX_mutex_lock(smpi_global->execute_mutex); - - // FIXME: explicit conversion to double? - action = SIMIX_action_sleep(host, seconds); - - SIMIX_register_action_to_condition(action, smpi_global->execute_cond); - SIMIX_cond_wait(smpi_global->execute_cond, smpi_global->execute_mutex); - SIMIX_unregister_action_to_condition(action, smpi_global->execute_cond); - SIMIX_action_destroy(action); - - SIMIX_mutex_unlock(smpi_global->execute_mutex); - - smpi_bench_begin(); - return 0; + smx_host_t host; + smx_action_t action; + + smpi_bench_end(); + host = SIMIX_host_self(); + action = SIMIX_action_sleep(host, (double)seconds); + smpi_process_wait_action(action); + SIMIX_action_destroy(action); + smpi_bench_begin(); + return 0; } void smpi_exit(int status) { - smpi_bench_end(); - SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex); - smpi_global->running_hosts_count--; - SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex); - SIMIX_process_kill(SIMIX_process_self()); - return; + smpi_bench_end(); + smpi_process_finalize(); + SIMIX_process_kill(SIMIX_process_self()); + return; } +*/