if (sleep_test_time > 0) { /* - "test_time" is set to 0, wait on @ref MSG_comm_wait */
while (MSG_comm_test(comm) == 0) { /* - Call @ref MSG_comm_test every "test_time" otherwise */
MSG_process_sleep(sleep_test_time);
- };
+ }
} else {
MSG_comm_wait(comm, -1);
}
#include <math.h>
#include "simgrid/msg.h"
- XBT_LOG_NEW_DEFAULT_CATEGORY(msg_pastry, "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_pastry, "Messages specific for this msg example");
/* TODO: *
* - handle node departure *
{
double workload = 100E6;
int new_peak_index=2;
- msg_host_t host = MSG_host_self();; //MSG_get_host_by_name("MyHost1");
+ msg_host_t host = MSG_host_self();
int nb = MSG_host_get_nb_pstates(host);
XBT_INFO("Count of Processor states=%d", nb);
#include "simgrid/datatypes.h"
#include "simgrid/host.h"
-
#ifdef __cplusplus
namespace simgrid {
SG_BEGIN_DECL()
-XBT_PUBLIC(xbt_dynar_t) SIMIX_process_get_runnable(void);
+XBT_PUBLIC(xbt_dynar_t) SIMIX_process_get_runnable();
XBT_PUBLIC(smx_process_t) SIMIX_process_from_PID(int PID);
-XBT_PUBLIC(xbt_dynar_t) SIMIX_processes_as_dynar(void);
+XBT_PUBLIC(xbt_dynar_t) SIMIX_processes_as_dynar();
/* parallelism */
-XBT_PUBLIC(int) SIMIX_context_is_parallel(void);
-XBT_PUBLIC(int) SIMIX_context_get_nthreads(void);
+XBT_PUBLIC(int) SIMIX_context_is_parallel();
+XBT_PUBLIC(int) SIMIX_context_get_nthreads();
XBT_PUBLIC(void) SIMIX_context_set_nthreads(int nb_threads);
-XBT_PUBLIC(int) SIMIX_context_get_parallel_threshold(void);
+XBT_PUBLIC(int) SIMIX_context_get_parallel_threshold();
XBT_PUBLIC(void) SIMIX_context_set_parallel_threshold(int threshold);
-XBT_PUBLIC(e_xbt_parmap_mode_t) SIMIX_context_get_parallel_mode(void);
+XBT_PUBLIC(e_xbt_parmap_mode_t) SIMIX_context_get_parallel_mode();
XBT_PUBLIC(void) SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
XBT_PUBLIC(int) SIMIX_is_maestro();
XBT_PUBLIC(void) SIMIX_function_register_process_kill(void_pfn_smxprocess_t function);
/* Simulation execution */
-XBT_PUBLIC(void) SIMIX_run(void);
-XBT_PUBLIC(double) SIMIX_get_clock(void);
+XBT_PUBLIC(void) SIMIX_run();
+XBT_PUBLIC(double) SIMIX_get_clock();
/* Timer functions FIXME: should these be public? */
typedef struct s_smx_timer* smx_timer_t;
XBT_PUBLIC(smx_timer_t) SIMIX_timer_set(double date, void (*function)(void*), void *arg);
XBT_PUBLIC(void) SIMIX_timer_remove(smx_timer_t timer);
-XBT_PUBLIC(double) SIMIX_timer_next(void);
+XBT_PUBLIC(double) SIMIX_timer_next();
XBT_PUBLIC(double) SIMIX_timer_get_date(smx_timer_t timer);
-XBT_PUBLIC(void) SIMIX_display_process_status(void);
+XBT_PUBLIC(void) SIMIX_display_process_status();
/******************************* Environment **********************************/
XBT_PUBLIC(void) SIMIX_create_environment(const char *file);
XBT_PUBLIC(void) SIMIX_function_register(const char *name, xbt_main_func_t code);
XBT_PUBLIC(void) SIMIX_function_register_default(xbt_main_func_t code);
-XBT_PUBLIC(void) SIMIX_init_application(void);
+XBT_PUBLIC(void) SIMIX_init_application();
XBT_PUBLIC(void) SIMIX_launch_application(const char *file);
XBT_PUBLIC(void) SIMIX_process_set_function(const char* process_host,
const char* hostname,
xbt_dict_t properties,
smx_process_t parent_process);
-XBT_PUBLIC(void) SIMIX_process_detach(void);
+XBT_PUBLIC(void) SIMIX_process_detach();
/*********************************** Host *************************************/
-XBT_PUBLIC(sg_host_t) SIMIX_host_self(void);
-XBT_PUBLIC(const char*) SIMIX_host_self_get_name(void);
+XBT_PUBLIC(sg_host_t) SIMIX_host_self();
+XBT_PUBLIC(const char*) SIMIX_host_self_get_name();
XBT_PUBLIC(void) SIMIX_host_on(sg_host_t host);
XBT_PUBLIC(void) SIMIX_host_off(sg_host_t host, smx_process_t issuer);
XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data);
-XBT_PUBLIC(void*) SIMIX_host_self_get_data(void);
+XBT_PUBLIC(void*) SIMIX_host_self_get_data();
/********************************* Process ************************************/
XBT_PUBLIC(smx_process_t) SIMIX_process_ref(smx_process_t process);
XBT_PUBLIC(void) SIMIX_process_unref(smx_process_t process);
-XBT_PUBLIC(int) SIMIX_process_count(void);
-XBT_PUBLIC(smx_process_t) SIMIX_process_self(void);
-XBT_PUBLIC(const char*) SIMIX_process_self_get_name(void);
+XBT_PUBLIC(int) SIMIX_process_count();
+XBT_PUBLIC(smx_process_t) SIMIX_process_self();
+XBT_PUBLIC(const char*) SIMIX_process_self_get_name();
XBT_PUBLIC(void) SIMIX_process_self_set_data(void *data);
-XBT_PUBLIC(void*) SIMIX_process_self_get_data(void);
-XBT_PUBLIC(smx_context_t) SIMIX_process_get_context(smx_process_t);
+XBT_PUBLIC(void*) SIMIX_process_self_get_data();
+XBT_PUBLIC(smx_context_t) SIMIX_process_get_context(smx_process_t process);
XBT_PUBLIC(void) SIMIX_process_set_context(smx_process_t p,smx_context_t c);
XBT_PUBLIC(int) SIMIX_process_has_pending_comms(smx_process_t process);
XBT_PUBLIC(void) SIMIX_process_on_exit_runall(smx_process_t process);
/** @addtogroup XBT_fifo
* @brief This section describes the API to generic workqueue.
*
- * These functions provide the same kind of functionnality as dynamic arrays but in time O(1).
- * However these functions use malloc/free way too much often.
+ * These functions provide the same kind of functionality as dynamic arrays but in time O(1).
+ * However these functions use malloc/free way too much often.
*/
/** @defgroup XBT_fifo_cons Fifo constructor and destructor
* @ingroup XBT_fifo
typedef struct xbt_fifo *xbt_fifo_t;
XBT_PUBLIC(xbt_fifo_t) xbt_fifo_new(void);
-XBT_PUBLIC(void) xbt_fifo_free(xbt_fifo_t);
-XBT_PUBLIC(void) xbt_fifo_reset(xbt_fifo_t);
+XBT_PUBLIC(void) xbt_fifo_free(xbt_fifo_t l);
+XBT_PUBLIC(void) xbt_fifo_reset(xbt_fifo_t l);
/** @} */
/** @defgroup XBT_fifo_perl Fifo perl-like functions
*
* @{
*/
-XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_push(xbt_fifo_t, void *);
-XBT_PUBLIC(void *) xbt_fifo_pop(xbt_fifo_t);
-XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_unshift(xbt_fifo_t, void *);
-XBT_PUBLIC(void *) xbt_fifo_shift(xbt_fifo_t);
-XBT_PUBLIC(int) xbt_fifo_size(xbt_fifo_t);
-XBT_PUBLIC(int) xbt_fifo_is_in(xbt_fifo_t, void *);
+XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_push(xbt_fifo_t l, void *t);
+XBT_PUBLIC(void *) xbt_fifo_pop(xbt_fifo_t l);
+XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_unshift(xbt_fifo_t l, void *t);
+XBT_PUBLIC(void *) xbt_fifo_shift(xbt_fifo_t l);
+XBT_PUBLIC(int) xbt_fifo_size(xbt_fifo_t l);
+XBT_PUBLIC(int) xbt_fifo_is_in(xbt_fifo_t l, void *t);
XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_search_item(xbt_fifo_t f, int_f_pvoid_pvoid_t cmp_fun, void *closure);
/** @} */
*/
XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_new_item(void);
-XBT_PUBLIC(void) xbt_fifo_set_item_content(xbt_fifo_item_t, void *);
-XBT_PUBLIC(void *) xbt_fifo_get_item_content(xbt_fifo_item_t);
-XBT_PUBLIC(void) xbt_fifo_free_item(xbt_fifo_item_t);
+XBT_PUBLIC(void) xbt_fifo_set_item_content(xbt_fifo_item_t i, void *v);
+XBT_PUBLIC(void *) xbt_fifo_get_item_content(xbt_fifo_item_t i);
+XBT_PUBLIC(void) xbt_fifo_free_item(xbt_fifo_item_t i);
-XBT_PUBLIC(void) xbt_fifo_push_item(xbt_fifo_t, xbt_fifo_item_t);
-XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_pop_item(xbt_fifo_t);
-XBT_PUBLIC(void) xbt_fifo_unshift_item(xbt_fifo_t, xbt_fifo_item_t);
-XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_shift_item(xbt_fifo_t);
+XBT_PUBLIC(void) xbt_fifo_push_item(xbt_fifo_t l, xbt_fifo_item_t i);
+XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_pop_item(xbt_fifo_t i);
+XBT_PUBLIC(void) xbt_fifo_unshift_item(xbt_fifo_t l, xbt_fifo_item_t i);
+XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_shift_item(xbt_fifo_t l);
-XBT_PUBLIC(int) xbt_fifo_remove(xbt_fifo_t, void *);
-XBT_PUBLIC(int) xbt_fifo_remove_all(xbt_fifo_t, void *);
-XBT_PUBLIC(void) xbt_fifo_remove_item(xbt_fifo_t, xbt_fifo_item_t);
+XBT_PUBLIC(int) xbt_fifo_remove(xbt_fifo_t l, void *t);
+XBT_PUBLIC(int) xbt_fifo_remove_all(xbt_fifo_t l, void *t);
+XBT_PUBLIC(void) xbt_fifo_remove_item(xbt_fifo_t l, xbt_fifo_item_t i);
XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_get_first_item(xbt_fifo_t l);
XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_get_last_item(xbt_fifo_t l);
*
* @{
*/
-XBT_PUBLIC(void **) xbt_fifo_to_array(xbt_fifo_t);
-XBT_PUBLIC(xbt_fifo_t) xbt_fifo_copy(xbt_fifo_t);
+XBT_PUBLIC(void **) xbt_fifo_to_array(xbt_fifo_t l);
+XBT_PUBLIC(xbt_fifo_t) xbt_fifo_copy(xbt_fifo_t l);
/** @} */
/* Deprecated functions: don't use! */
XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_newitem(void);
-XBT_PUBLIC(void) xbt_fifo_freeitem(xbt_fifo_item_t);
+XBT_PUBLIC(void) xbt_fifo_freeitem(xbt_fifo_item_t l);
XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_getFirstItem(xbt_fifo_t l);
XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_getNextItem(xbt_fifo_item_t i);
XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_getPrevItem(xbt_fifo_item_t i);
-
SG_END_DECL()
#ifdef __cplusplus
*
* @return A variable associated to a constraint
*/
-XBT_PUBLIC(lmm_variable_t) lmm_get_var_from_cnst_safe(lmm_system_t /*sys*/, lmm_constraint_t cnst,
+XBT_PUBLIC(lmm_variable_t) lmm_get_var_from_cnst_safe(lmm_system_t sys, lmm_constraint_t cnst,
lmm_element_t * elem, lmm_element_t * nextelem, int * numelem);
/**
XBT_PRIVATE void smpi_process_set_replaying(bool s);
XBT_PRIVATE bool smpi_process_get_replaying(void);
-XBT_PRIVATE void smpi_deployment_register_process(const char* instance_id, int rank, int index, MPI_Comm**, xbt_bar_t*);
+XBT_PRIVATE void smpi_deployment_register_process(const char* instance_id, int rank, int index, MPI_Comm** comm, xbt_bar_t*bar);
XBT_PRIVATE void smpi_deployment_cleanup_instances(void);
XBT_PRIVATE void smpi_comm_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size);
XBT_PRIVATE int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value);
// f77 wrappers
-void mpi_init_(int*);
-void mpi_finalize_(int*);
+void mpi_init_(int* ierr);
+void mpi_finalize_(int* ierr);
void mpi_abort_(int* comm, int* errorcode, int* ierr);
void mpi_comm_rank_(int* comm, int* rank, int* ierr);
void mpi_comm_size_(int* comm, int* size, int* ierr);
static void array_new(unsigned **a, xbt_dynar_t *data)
{
- int i;
*a = xbt_malloc(ARRAY_SIZE * sizeof **a);
*data = xbt_dynar_new(sizeof *a, NULL);
xbt_dynar_shrink(*data, ARRAY_SIZE);
- for (i = 0 ; i < ARRAY_SIZE ; i++) {
+ for (int i = 0 ; i < ARRAY_SIZE ; i++) {
(*a)[i] = i;
xbt_dynar_push_as(*data, void*, &(*a)[i]);
}
unsigned *a;
xbt_dynar_t data;
xbt_parmap_t parmap;
- int i;
- double start_time, elapsed_time;
+ double elapsed_time;
printf("** mode = %-15s ", parmap_mode_name(mode));
fflush(stdout);
array_new(&a, &data);
- i = 0;
- start_time = xbt_os_time();
+ int i = 0;
+ double start_time = xbt_os_time();
do {
parmap = xbt_parmap_new(nthreads, mode);
xbt_parmap_apply(parmap, fun_to_apply, data);
{
unsigned *a;
xbt_dynar_t data;
- double start_time, elapsed_time;
+ double elapsed_time;
printf("** mode = %-15s ", parmap_mode_name(mode));
fflush(stdout);
xbt_parmap_t parmap = xbt_parmap_new(nthreads, mode);
int i = 0;
- start_time = xbt_os_time();
+ double start_time = xbt_os_time();
do {
xbt_parmap_apply(parmap, fun_to_apply, data);
elapsed_time = xbt_os_time() - start_time;
} while (elapsed_time < TIMEOUT);
xbt_parmap_destroy(parmap);
- printf("ran %d times in %g seconds (%g/s)\n",
- i, elapsed_time, i / elapsed_time);
+ printf("ran %d times in %g seconds (%g/s)\n", i, elapsed_time, i / elapsed_time);
xbt_dynar_free(&data);
xbt_free(a);