@code{cpp}
class ConditionVariable {
private:
- friend s_smx_cond;
+ friend s_smx_cond_t;
smx_cond_t cond_;
ConditionVariable(smx_cond_t cond) : cond_(cond) {}
public:
#define MESSAGE_CANCEL_SIZE 17
/** Types of messages exchanged between two peers. */
-typedef enum {
+enum e_message_type {
MESSAGE_HANDSHAKE,
MESSAGE_CHOKE,
MESSAGE_UNCHOKE,
MESSAGE_REQUEST,
MESSAGE_PIECE,
MESSAGE_CANCEL
-} e_message_type;
+};
class Message {
public:
};
/* Types of tasks exchanged between nodes. */
-typedef enum {
+enum e_message_type_t {
FIND_SUCCESSOR,
FIND_SUCCESSOR_ANSWER,
GET_PREDECESSOR,
PREDECESSOR_LEAVING,
PREDECESSOR_ALIVE,
PREDECESSOR_ALIVE_ANSWER
-} e_message_type_t;
+};
class ChordMessage {
public:
XBT_PUBLIC_DATA(int) sg_storage_max_file_descriptors;
/* ******************************** Task ************************************ */
-typedef struct simdata_task *simdata_task_t;
+typedef struct s_simdata_task_t* simdata_task_t;
typedef struct msg_task {
char *name; /**< @brief task name if any */
* @ingroup msg_synchro
* @hideinitializer
*/
-typedef struct s_smx_sem *msg_sem_t; // Yeah that's a rename of the smx_sem_t which doesnt require smx_sem_t to be declared here
+typedef struct s_smx_sem_t* msg_sem_t; // Yeah that's a rename of the smx_sem_t which doesnt require smx_sem_t to be
+ // declared here
XBT_PUBLIC(msg_sem_t) MSG_sem_init(int initial_value);
XBT_PUBLIC(void) MSG_sem_acquire(msg_sem_t sem);
XBT_PUBLIC(msg_error_t) MSG_sem_acquire_timeout(msg_sem_t sem, double timeout);
*/
#define MSG_BARRIER_SERIAL_PROCESS -1
-typedef struct s_msg_bar* msg_bar_t;
+typedef struct s_msg_bar_t* msg_bar_t;
XBT_PUBLIC(msg_bar_t) MSG_barrier_init( unsigned int count);
XBT_PUBLIC(void) MSG_barrier_destroy(msg_bar_t bar);
XBT_PUBLIC(int) MSG_barrier_wait(msg_bar_t bar);
#include <simgrid/s4u/forward.hpp>
#include <simgrid/forward.h>
-typedef enum { inited = 0, started, canceled, errored, finished } e_s4u_activity_state_t;
+enum e_s4u_activity_state_t { inited = 0, started, canceled, errored, finished };
namespace simgrid {
namespace s4u {
XBT_PUBLIC_CLASS ConditionVariable
{
private:
- friend s_smx_cond;
+ friend s_smx_cond_t;
smx_cond_t cond_;
explicit ConditionVariable(smx_cond_t cond) : cond_(cond) {}
public:
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/forward.hpp"
-typedef enum {
+enum e_surf_vm_state_t {
SURF_VM_STATE_CREATED, /**< created, but not yet started */
SURF_VM_STATE_RUNNING,
SURF_VM_STATE_SUSPENDED, /**< Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
SURF_VM_STATE_DESTROYED
-} e_surf_vm_state_t;
+};
namespace simgrid {
namespace vm {
-/* Copyright (c) 2006-2010, 2012-2016. The SimGrid Team.
+/* Copyright (c) 2006-2010, 2012-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
Each task has a <em>\ref e_SD_task_state_t "state"</em> indicating whether the task is scheduled, running, done, ...
*/
-typedef struct SD_task *SD_task_t;
+typedef struct s_SD_task_t* SD_task_t;
/** @brief Task states
@ingroup SD_task_api */
/**
* \ingroup simix_synchro_management
*/
-typedef struct s_smx_cond *smx_cond_t;
+typedef struct s_smx_cond_t* smx_cond_t;
/**
* \ingroup simix_synchro_management
*/
-typedef struct s_smx_sem *smx_sem_t;
+typedef struct s_smx_sem_t* smx_sem_t;
/* ****************************** Process *********************************** */
XBT_PUBLIC(double) SIMIX_get_clock();
/* Timer functions FIXME: should these be public? */
-typedef struct s_smx_timer* smx_timer_t;
+typedef struct s_smx_timer_t* 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);
*
* This structure is used as the userdata parameter of lua_Writer.
*/
-typedef struct s_sglua_buffer {
+struct s_sglua_buffer_t {
char* data;
size_t size;
size_t capacity;
-} s_sglua_buffer_t, *sglua_buffer_t;
+};
+typedef s_sglua_buffer_t* sglua_buffer_t;
const char* sglua_tostring(lua_State* L, int index);
const char* sglua_keyvalue_tostring(lua_State* L, int key_index, int value_index);
extern "C" {
// Methods used to parse and store the values for timing injections in smpi
-typedef struct s_smpi_factor *smpi_os_factor_t;
-typedef struct s_smpi_factor{
+struct s_smpi_factor_t {
size_t factor=0;
std::vector<double> values;
-} s_smpi_factor_t;
+};
+typedef s_smpi_factor_t* smpi_os_factor_t;
}
XBT_PUBLIC(std::vector<s_smpi_factor_t>) parse_factor(const char *smpi_coef_string);
#ifndef MAXMIN_DATATYPES_H
#define MAXMIN_DATATYPES_H
-typedef struct lmm_element *lmm_element_t;
-typedef struct lmm_variable *lmm_variable_t;
-typedef struct lmm_constraint *lmm_constraint_t;
-typedef struct lmm_constraint_light *lmm_constraint_light_t;
-typedef struct lmm_system *lmm_system_t;
+typedef struct s_lmm_element_t* lmm_element_t;
+typedef struct s_lmm_variable_t* lmm_variable_t;
+typedef struct s_lmm_constraint_t* lmm_constraint_t;
+typedef struct s_lmm_constraint_light_t* lmm_constraint_light_t;
+typedef struct s_lmm_system_t* lmm_system_t;
#endif
#include "surf/surf.h"
#include <algorithm>
-typedef enum {
- INSTR_US_DECLARE,
- INSTR_US_SET,
- INSTR_US_ADD,
- INSTR_US_SUB
-} InstrUserVariable;
+enum InstrUserVariable { INSTR_US_DECLARE, INSTR_US_SET, INSTR_US_ADD, INSTR_US_SUB };
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API");
namespace simgrid {
namespace instr {
-typedef enum {
+enum e_event_type {
PAJE_DefineContainerType,
PAJE_DefineVariableType,
PAJE_DefineStateType,
PAJE_StartLink,
PAJE_EndLink,
PAJE_NewEvent
-} e_event_type;
+};
-typedef enum { TYPE_VARIABLE, TYPE_LINK, TYPE_CONTAINER, TYPE_STATE, TYPE_EVENT } e_entity_types;
+enum e_entity_types { TYPE_VARIABLE, TYPE_LINK, TYPE_CONTAINER, TYPE_STATE, TYPE_EVENT };
//--------------------------------------------------
};
//--------------------------------------------------
-typedef enum {
+enum e_container_types {
INSTR_HOST,
INSTR_LINK,
INSTR_ROUTER,
INSTR_MSG_VM,
INSTR_MSG_PROCESS,
INSTR_MSG_TASK
-} e_container_types;
+};
//--------------------------------------------------
XBT_PRIVATE void dump_comment_file(const char* filename);
XBT_PRIVATE void dump_comment(const char* comment);
-struct s_instr_extra_data;
-typedef struct s_instr_extra_data* instr_extra_data;
-
-typedef enum {
+enum e_caller_type {
TRACING_INIT,
TRACING_FINALIZE,
TRACING_COMM_SIZE,
TRACING_SLEEPING,
TRACING_SCAN,
TRACING_EXSCAN
-} e_caller_type;
+};
-typedef struct s_instr_extra_data {
+struct s_instr_extra_data_t {
e_caller_type type;
int send_size;
int recv_size;
int* sendcounts;
int* recvcounts;
int num_processes;
-} s_instr_extra_data_t;
+};
+typedef s_instr_extra_data_t* instr_extra_data;
/* Format of TRACING output.
* - paje is the regular format, that we all know
* trace can easily be replayed with smpi_replay afterward. This trick should be removed and replaced by some code
* using the signal that we will create to cleanup the TRACING
*/
-typedef enum { instr_fmt_paje, instr_fmt_TI } instr_fmt_type_t;
+enum instr_fmt_type_t { instr_fmt_paje, instr_fmt_TI };
extern instr_fmt_type_t instr_fmt_type;
}
XBT_PRIVATE const char* encode_datatype(MPI_Datatype datatype, int* known);
-typedef struct smpi_trace_call_location {
+class smpi_trace_call_location_t {
+public:
const char* filename;
int linenumber;
return std::string(previous_filename) + ':' + std::to_string(previous_linenumber) + ':' + filename + ':' +
std::to_string(linenumber);
}
-
-} smpi_trace_call_location_t;
+};
}
#endif
#include "src/kernel/activity/ActivityImpl.hpp"
#include "surf/surf.h"
-typedef enum { SIMIX_COMM_SEND, SIMIX_COMM_RECEIVE, SIMIX_COMM_READY, SIMIX_COMM_DONE } e_smx_comm_type_t;
+enum e_smx_comm_type_t { SIMIX_COMM_SEND, SIMIX_COMM_RECEIVE, SIMIX_COMM_READY, SIMIX_COMM_DONE };
namespace simgrid {
namespace kernel {
xbt_node_t DijkstraZone::routeGraphNewNode(int id, int graph_id)
{
- graph_node_data_t data = xbt_new0(struct graph_node_data, 1);
+ graph_node_data_t data = xbt_new0(s_graph_node_data_t, 1);
data->id = id;
data->graph_id = graph_id;
xbt_node_t node = xbt_graph_new_node(routeGraph_, data);
- graph_node_map_element_t elm = xbt_new0(struct graph_node_map_element, 1);
+ graph_node_map_element_t elm = xbt_new0(s_graph_node_map_element_t, 1);
elm->node = node;
xbt_dict_set_ext(graphNodeMap_, (char*)(&id), sizeof(int), (xbt_dictelm_t)elm, nullptr);
if (routeCache_ && elm == nullptr) {
/* add to predecessor list of the current src-host to cache */
- elm = xbt_new0(struct route_cache_element, 1);
+ elm = xbt_new0(s_route_cache_element_t, 1);
elm->pred_arr = pred_arr;
elm->size = size;
xbt_dict_set_ext(routeCache_, (char*)(&src_id), sizeof(int), (xbt_dictelm_t)elm, nullptr);
-/* Copyright (c) 2013-2016. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2013-2017. 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 "src/kernel/routing/RoutedZone.hpp"
-typedef struct graph_node_data {
+struct s_graph_node_data_t {
int id;
int graph_id; /* used for caching internal graph id's */
-} s_graph_node_data_t;
+};
typedef s_graph_node_data_t* graph_node_data_t;
-typedef struct graph_node_map_element {
+struct s_graph_node_map_element_t {
xbt_node_t node;
-} s_graph_node_map_element_t;
+};
typedef s_graph_node_map_element_t* graph_node_map_element_t;
-typedef struct route_cache_element {
+struct s_route_cache_element_t {
int* pred_arr;
int size;
-} s_route_cache_element_t;
+};
typedef s_route_cache_element_t* route_cache_element_t;
namespace simgrid {
-/* Copyright (c) 2007-2015. The SimGrid Team.
+/* Copyright (c) 2007-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
}
}
-typedef class simgrid::mc::RegionSnapshot s_mc_mem_region_t;
+typedef simgrid::mc::RegionSnapshot s_mc_mem_region_t;
typedef s_mc_mem_region_t* mc_mem_region_t;
#endif
public:
std::size_t operator()(std::pair<X,Y>const& x) const
{
- struct hash<X> h1;
- struct hash<X> h2;
+ hash<X> h1;
+ hash<X> h2;
return h1(x.first) ^ h2(x.second);
}
};
return true;
}
-static void fill_local_variables_values(mc_stack_frame_t stack_frame,
- simgrid::mc::Frame* scope,
- int process_index,
- std::vector<s_local_variable>& result)
+static void fill_local_variables_values(mc_stack_frame_t stack_frame, simgrid::mc::Frame* scope, int process_index,
+ std::vector<s_local_variable_t>& result)
{
simgrid::mc::RemoteClient* process = &mc_model_checker->process();
stack_frame, &nested_scope, process_index, result);
}
-static std::vector<s_local_variable> get_local_variables_values(
- std::vector<s_mc_stack_frame_t>& stack_frames, int process_index)
+static std::vector<s_local_variable_t> get_local_variables_values(std::vector<s_mc_stack_frame_t>& stack_frames,
+ int process_index)
{
- std::vector<s_local_variable> variables;
+ std::vector<s_local_variable_t> variables;
for (s_mc_stack_frame_t& stack_frame : stack_frames)
fill_local_variables_values(&stack_frame, stack_frame.frame, process_index, variables);
return variables;
*/
extern XBT_PRIVATE xbt_dynar_t incomplete_communications_pattern;
-typedef enum {
+enum e_mc_call_type_t {
MC_CALL_TYPE_NONE,
MC_CALL_TYPE_SEND,
MC_CALL_TYPE_RECV,
MC_CALL_TYPE_WAIT,
MC_CALL_TYPE_WAITANY,
-} e_mc_call_type_t;
+};
-typedef enum {
+enum e_mc_comm_pattern_difference_t {
NONE_DIFF,
TYPE_DIFF,
RDV_DIFF,
DST_PROC_DIFF,
DATA_SIZE_DIFF,
DATA_DIFF,
-} e_mc_comm_pattern_difference_t;
+};
static inline e_mc_call_type_t MC_get_call_type(smx_simcall_t req)
{
* Some parts of the snapshot are ignored by zeroing them out: the real
* values is stored here.
* */
-typedef struct s_mc_snapshot_ignored_data {
+struct s_mc_snapshot_ignored_data_t {
void* start;
std::vector<char> data;
-} s_mc_snapshot_ignored_data_t;
+};
-typedef struct s_fd_infos {
+struct s_fd_infos_t {
std::string filename;
int number;
off_t current_position;
int flags;
-} s_fd_infos_t;
+};
/** Information about a given stack frame */
-typedef struct s_mc_stack_frame {
+struct s_mc_stack_frame_t {
/** Instruction pointer */
unw_word_t ip;
/** Stack pointer */
simgrid::mc::Frame* frame;
std::string frame_name;
unw_cursor_t unw_cursor;
-} s_mc_stack_frame_t;
+};
typedef s_mc_stack_frame_t* mc_stack_frame_t;
-typedef struct s_local_variable {
+struct s_local_variable_t {
simgrid::mc::Frame* subprogram;
unsigned long ip;
std::string name;
simgrid::mc::Type* type;
void* address;
int region;
-} s_local_variable_t;
+};
typedef s_local_variable_t* local_variable_t;
-typedef struct XBT_PRIVATE s_mc_snapshot_stack {
- std::vector<s_local_variable> local_variables;
+struct XBT_PRIVATE s_mc_snapshot_stack_t {
+ std::vector<s_local_variable_t> local_variables;
simgrid::mc::UnwindContext context;
std::vector<s_mc_stack_frame_t> stack_frames;
int process_index;
-} s_mc_snapshot_stack_t, *mc_snapshot_stack_t;
+};
+typedef s_mc_snapshot_stack_t* mc_snapshot_stack_t;
namespace simgrid {
namespace mc {
std::vector<s_mc_snapshot_stack_t> stacks;
std::vector<simgrid::mc::IgnoredHeapRegion> to_ignore;
std::uint64_t hash;
- std::vector<s_mc_snapshot_ignored_data> ignored_data;
+ std::vector<s_mc_snapshot_ignored_data_t> ignored_data;
std::vector<s_fd_infos_t> current_fds;
};
}
static inline
pid_t _UPT_getpid(void* arg)
{
- struct _UPT_info* info = static_cast<_UPT_info*>(arg);
+ _UPT_info* info = static_cast<_UPT_info*>(arg);
return info->pid;
}
regex_t version_re;
};
-static char* get_lib_name(const char* pathname, struct s_mc_memory_map_re* res)
+static char* get_lib_name(const char* pathname, s_mc_memory_map_re* res)
{
char* map_basename = xbt_basename(pathname);
xbt_die("No heap information in the target process");
if (not std_heap_var->address)
xbt_die("No constant address for this variable");
- this->read_bytes(&this->heap_address, sizeof(struct mdesc*), remote(std_heap_var->address),
+ this->read_bytes(&this->heap_address, sizeof(mdesc*), remote(std_heap_var->address),
simgrid::mc::ProcessIndexDisabled);
this->smx_actors_infos.clear();
// Read/dereference/refresh the std_heap pointer:
if (not this->heap)
this->heap = std::unique_ptr<s_xbt_mheap_t>(new s_xbt_mheap_t());
- this->read_bytes(this->heap.get(), sizeof(struct mdesc), remote(this->heap_address),
- simgrid::mc::ProcessIndexDisabled);
+ this->read_bytes(this->heap.get(), sizeof(mdesc), remote(this->heap_address), simgrid::mc::ProcessIndexDisabled);
this->cache_flags_ |= RemoteClient::cache_heap;
}
this->binary_info = nullptr;
this->libsimgrid_info = nullptr;
- struct s_mc_memory_map_re res;
+ s_mc_memory_map_re res;
if (regcomp(&res.so_re, SO_RE, 0) || regcomp(&res.version_re, VERSION_RE, 0))
xbt_die(".so regexp did not compile");
}
/********************************* Task **************************************/
-typedef struct simdata_task {
- ~simdata_task()
+struct s_simdata_task_t {
+ ~s_simdata_task_t()
{
/* parallel tasks only */
xbt_free(this->host_list);
private:
void reportMultipleUse() const;
-} s_simdata_task_t;
+};
/******************************* Process *************************************/
}
/************************** Global variables ********************************/
-typedef struct MSG_Global {
+struct s_MSG_Global_t {
int debug_multiple_use; /* whether we want an error message when reusing the same Task for 2 things */
std::atomic_int_fast32_t sent_msg; /* Total amount of messages sent during the simulation */
void (*task_copy_callback)(msg_task_t task, msg_process_t src, msg_process_t dst);
void_f_pvoid_t process_data_cleanup;
-} s_MSG_Global_t;
+};
typedef s_MSG_Global_t* MSG_Global_t;
extern "C" {
XBT_PRIVATE void TRACE_msg_process_sleep_out(msg_process_t process);
}
-inline void simdata_task::setUsed()
+inline void s_simdata_task_t::setUsed()
{
if (this->isused)
this->reportMultipleUse();
}
/*-**** barrier related functions ****-*/
-typedef struct s_msg_bar {
+struct s_msg_bar_t {
xbt_mutex_t mutex;
xbt_cond_t cond;
unsigned int arrived_processes;
unsigned int expected_processes;
-} s_msg_bar_t;
+};
/** @brief Initializes a barrier, with count elements */
msg_bar_t MSG_barrier_init(unsigned int count) {
- msg_bar_t bar = xbt_new0(s_msg_bar, 1);
+ msg_bar_t bar = xbt_new0(s_msg_bar_t, 1);
bar->expected_processes = count;
bar->arrived_processes = 0;
bar->mutex = xbt_mutex_init();
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_task, msg, "Logging specific to MSG (task)");
-void simdata_task::reportMultipleUse() const
+void s_simdata_task_t::reportMultipleUse() const
{
if (msg_global->debug_multiple_use){
XBT_ERROR("This task is already used in there:");
extern "C" {
-struct dirty_page {
+struct s_dirty_page {
double prev_clock;
double prev_remaining;
msg_task_t task;
};
-typedef struct dirty_page s_dirty_page;
-typedef struct dirty_page* dirty_page_t;
+typedef s_dirty_page* dirty_page_t;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_vm, msg, "Cloud-oriented parts of the MSG API");
XBT_DEBUG("mig: rx_start");
// The structure has been created in the do_migration function and should only be freed in the same place ;)
- struct migration_session* ms = static_cast<migration_session*>(MSG_process_get_data(MSG_process_self()));
+ migration_session* ms = static_cast<migration_session*>(MSG_process_get_data(MSG_process_self()));
bool received_finalize = false;
XBT_DEBUG("mig: tx_start");
// Note that the ms structure has been allocated in do_migration and hence should be freed in the same function ;)
- migration_session *ms = static_cast<migration_session *>(MSG_process_get_data(MSG_process_self()));
+ migration_session* ms = static_cast<migration_session*>(MSG_process_get_data(MSG_process_self()));
double host_speed = ms->vm->pimpl_vm_->getPm()->getSpeed();
s_vm_params_t params;
vm->pimpl_vm_->isMigrating = true;
- struct migration_session *ms = xbt_new(struct migration_session, 1);
+ migration_session* ms = xbt_new(migration_session, 1);
ms->vm = vm;
ms->src_pm = src_pm;
ms->dst_pm = dst_pm;
-/* Copyright (c) 2004-2016. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-2017. 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. */
#define GUESTOS_NOISE 100 // This value corresponds to the cost of the global action associated to the VM
// It corresponds to the cost of a VM running no tasks.
-typedef struct dirty_page* dirty_page_t;
+typedef struct s_dirty_page* dirty_page_t;
namespace simgrid {
namespace vm {
extern XBT_PRIVATE simgrid::sd::Global *sd_global;
/* Task */
-typedef struct SD_task {
+struct s_SD_task_t {
e_SD_task_state_t state;
void *data; /* user data */
char *name;
double *flops_amount;
double *bytes_amount;
double rate;
-} s_SD_task_t;
+};
/* SimDag private functions */
XBT_PRIVATE void SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state);
#include <list>
#include <map>
-typedef struct s_smx_process_exit_fun {
+struct s_smx_process_exit_fun_t {
int_f_pvoid_pvoid_t fun;
void *arg;
-} s_smx_process_exit_fun_t;
+};
typedef s_smx_process_exit_fun_t* smx_process_exit_fun_t;
namespace simgrid {
smx_actor_t issuer;
smx_timer_t timer;
int mc_value;
- union u_smx_scalar args[11];
- union u_smx_scalar result;
+ u_smx_scalar args[11];
+ u_smx_scalar result;
};
#define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value))
static xbt_heap_t simix_timers = nullptr;
/** @brief Timer datatype */
-typedef class s_smx_timer {
+class s_smx_timer_t {
double date = 0.0;
- s_smx_timer() = default;
+ s_smx_timer_t() = default;
public:
simgrid::xbt::Task<void()> callback;
double getDate() { return date; }
- s_smx_timer(double date, simgrid::xbt::Task<void()> callback) : date(date), callback(std::move(callback)) {}
-} s_smx_timer_t;
+ s_smx_timer_t(double date, simgrid::xbt::Task<void()> callback) : date(date), callback(std::move(callback)) {}
+};
void (*SMPI_switch_data_segment)(int) = nullptr;
{
XBT_IN("()");
simgrid::simix::ActorImpl p;
- smx_cond_t cond = new s_smx_cond();
+ smx_cond_t cond = new s_smx_cond_t();
cond->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
cond->refcount_ = 1;
XBT_OUT();
}
}
-typedef struct s_smx_cond {
- s_smx_cond() : cond_(this) {}
+struct s_smx_cond_t {
+ s_smx_cond_t() : cond_(this) {}
std::atomic_int_fast32_t refcount_{1};
smx_mutex_t mutex = nullptr;
xbt_swag_t sleeping = nullptr; /* list of sleeping process */
simgrid::s4u::ConditionVariable cond_;
-} s_smx_cond_t;
+};
-typedef struct s_smx_sem {
+struct s_smx_sem_t {
unsigned int value;
xbt_swag_t sleeping; /* list of sleeping process */
-} s_smx_sem_t;
+};
XBT_PRIVATE void SIMIX_post_synchro(smx_activity_t synchro);
XBT_PRIVATE void SIMIX_synchro_stop_waiting(smx_actor_t process, smx_simcall_t simcall);
smpi_bench_end();
//save requests information for tracing
- typedef struct {
+ struct savedvalstype {
int src;
int dst;
int recv;
int tag;
MPI_Comm comm;
- } savedvalstype;
+ };
savedvalstype* savedvals = xbt_new0(savedvalstype, count);
for (int i = 0; i < count; i++) {
{
smpi_bench_end();
//save information from requests
- typedef struct {
+ struct savedvalstype {
int src;
int dst;
int recv;
int tag;
int valid;
MPI_Comm comm;
- } savedvalstype;
+ };
savedvalstype* savedvals=xbt_new0(savedvalstype, count);
for (int i = 0; i < count; i++) {
MPI_User_function * uop = MPIR_Op_table[op % 16 - 1];
#else
MPI_User_function *uop;
- struct MPIR_OP *op_ptr;
+ MPIR_OP *op_ptr;
op_ptr = MPIR_ToPointer(op);
uop = op_ptr->op;
#endif
MPI_User_function * uop = MPIR_Op_table[op % 16 - 1];
#else
MPI_User_function *uop;
- struct MPIR_OP *op_ptr;
+ MPIR_OP *op_ptr;
op_ptr = MPIR_ToPointer(op);
uop = op_ptr->op;
#endif
MPI_User_function * uop = MPIR_Op_table[op % 16 - 1];
#else
MPI_User_function *uop;
- struct MPIR_OP *op_ptr;
+ MPIR_OP *op_ptr;
op_ptr = MPIR_ToPointer(op);
uop = op_ptr->op;
#endif
MPI_User_function * uop = MPIR_Op_table[op % 16 - 1];
#else
MPI_User_function *uop;
- struct MPIR_OP *op_ptr;
+ MPIR_OP *op_ptr;
op_ptr = MPIR_ToPointer(op);
uop = op_ptr->op;
#endif
MPI_User_function * uop = MPIR_Op_table[op % 16 - 1];
#else
MPI_User_function *uop;
- struct MPIR_OP *op_ptr;
+ MPIR_OP *op_ptr;
op_ptr = MPIR_ToPointer(op);
uop = op_ptr->op;
#endif
(SEGCOUNT)++; \
}
-typedef struct ompi_coll_tree_t {
+struct ompi_coll_tree_t {
int32_t tree_root;
int32_t tree_fanout;
int32_t tree_bmtree;
int32_t tree_prev;
int32_t tree_next[MAXTREEFANOUT];
int32_t tree_nextsize;
-} ompi_coll_tree_t;
+};
ompi_coll_tree_t* ompi_coll_tuned_topo_build_tree(int fanout, MPI_Comm com, int root);
ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bintree(MPI_Comm comm);
#endif
#endif
-typedef enum {MPIM_SHORT, MPIM_INT, MPIM_LONG, MPIM_UNSIGNED_SHORT,
- MPIM_UNSIGNED, MPIM_UNSIGNED_LONG, MPIM_UNSIGNED_LONG_LONG, MPIM_FLOAT,
- MPIM_DOUBLE, MPIM_BYTE} MPIM_Datatype;
-
-typedef enum {MPIM_MAX, MPIM_MIN, MPIM_SUM, MPIM_PROD,
- MPIM_LAND, MPIM_BAND, MPIM_LOR, MPIM_BOR,
- MPIM_LXOR, MPIM_BXOR} MPIM_Op;
+enum MPIM_Datatype {
+ MPIM_SHORT,
+ MPIM_INT,
+ MPIM_LONG,
+ MPIM_UNSIGNED_SHORT,
+ MPIM_UNSIGNED,
+ MPIM_UNSIGNED_LONG,
+ MPIM_UNSIGNED_LONG_LONG,
+ MPIM_FLOAT,
+ MPIM_DOUBLE,
+ MPIM_BYTE
+};
+
+enum MPIM_Op {
+ MPIM_MAX,
+ MPIM_MIN,
+ MPIM_SUM,
+ MPIM_PROD,
+ MPIM_LAND,
+ MPIM_BAND,
+ MPIM_LOR,
+ MPIM_BOR,
+ MPIM_LXOR,
+ MPIM_BXOR
+};
#define MPI_I_DO_OP_C_INTEGER(MPI_I_do_op_TYPE,TYPE) \
static void MPI_I_do_op_TYPE(TYPE* b1,TYPE* b2,TYPE* rslt, int cnt,MPIM_Op op)\
{ int i; \
#define INTEL_MAX_NB_NUMPROCS 12
#define INTEL_MAX_NB_PPN 5 /* 1 2 4 8 16 ppn */
-typedef struct {
+struct intel_tuning_table_size_element {
unsigned int max_size;
int algo;
-} intel_tuning_table_size_element;
+};
-typedef struct {
+struct intel_tuning_table_numproc_element {
int max_num_proc;
int num_elems;
intel_tuning_table_size_element elems[INTEL_MAX_NB_THRESHOLDS];
-} intel_tuning_table_numproc_element;
+};
-typedef struct {
+struct intel_tuning_table_element {
int ppn;
intel_tuning_table_numproc_element elems[INTEL_MAX_NB_NUMPROCS];
-} intel_tuning_table_element;
+};
/*
I_MPI_ADJUST_ALLREDUCE
XBT_PUBLIC(void) smpi_coll_cleanup_mvapich2(void);
-typedef struct {
+struct mv2_alltoall_tuning_element {
int min;
int max;
int (*MV2_pt_Alltoall_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
MPI_Datatype recvtype, MPI_Comm comm_ptr);
-} mv2_alltoall_tuning_element;
+};
-typedef struct {
+struct mv2_alltoall_tuning_table {
int numproc;
int size_table;
mv2_alltoall_tuning_element algo_table[MV2_MAX_NB_THRESHOLDS];
mv2_alltoall_tuning_element in_place_algo_table[MV2_MAX_NB_THRESHOLDS];
-} mv2_alltoall_tuning_table;
+};
int (*MV2_Alltoall_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
MPI_Datatype recvtype, MPI_Comm comm_ptr) = NULL;
/************ Allgather variables and initializers */
-typedef struct {
+struct mv2_allgather_tuning_element {
int min;
int max;
int (*MV2_pt_Allgatherction)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
MPI_Datatype recvtype, MPI_Comm comm_ptr);
-} mv2_allgather_tuning_element;
+};
-typedef struct {
+struct mv2_allgather_tuning_table {
int numproc;
int two_level[MV2_MAX_NB_THRESHOLDS];
int size_inter_table;
mv2_allgather_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
-} mv2_allgather_tuning_table;
+};
int (*MV2_Allgatherction)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
MPI_Datatype recvtype, MPI_Comm comm);
/************ Gather variables and initializers */
-typedef struct {
+struct mv2_gather_tuning_element {
int min;
int max;
int (*MV2_pt_Gather_function)(void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt,
MPI_Datatype recvtype, int root, MPI_Comm comm_ptr);
-} mv2_gather_tuning_element;
+};
-typedef struct {
+struct mv2_gather_tuning_table {
int numproc;
int size_inter_table;
mv2_gather_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
int size_intra_table;
mv2_gather_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
-} mv2_gather_tuning_table;
+};
int mv2_size_gather_tuning_table = 7;
mv2_gather_tuning_table* mv2_gather_thresholds_table = NULL;
/************ Allgatherv variables and initializers */
-typedef struct {
+struct mv2_allgatherv_tuning_element {
int min;
int max;
int (*MV2_pt_Allgatherv_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts,
int* displs, MPI_Datatype recvtype, MPI_Comm commg);
-} mv2_allgatherv_tuning_element;
+};
-typedef struct {
+struct mv2_allgatherv_tuning_table {
int numproc;
int size_inter_table;
mv2_allgatherv_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
-} mv2_allgatherv_tuning_table;
+};
int (*MV2_Allgatherv_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts,
int* displs, MPI_Datatype recvtype, MPI_Comm comm);
/************ Allreduce variables and initializers */
-typedef struct {
+struct mv2_allreduce_tuning_element {
int min;
int max;
int (*MV2_pt_Allreducection)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
MPI_Comm comm);
-} mv2_allreduce_tuning_element;
+};
-typedef struct {
+struct mv2_allreduce_tuning_table {
int numproc;
int mcast_enabled;
int is_two_level_allreduce[MV2_MAX_NB_THRESHOLDS];
mv2_allreduce_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
int size_intra_table;
mv2_allreduce_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
-} mv2_allreduce_tuning_table;
+};
int (*MV2_Allreducection)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
MPI_Comm comm) = NULL;
mv2_size_allreduce_tuning_table * sizeof(mv2_allreduce_tuning_table));
}
-typedef struct {
+struct mv2_bcast_tuning_element {
int min;
int max;
int (*MV2_pt_Bcast_function)(void* buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm_ptr);
int zcpy_pipelined_knomial_factor;
-} mv2_bcast_tuning_element;
+};
-typedef struct {
+struct mv2_bcast_tuning_table {
int numproc;
int bcast_segment_size;
int intra_node_knomial_factor;
mv2_bcast_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
int size_intra_table;
mv2_bcast_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
-} mv2_bcast_tuning_table;
+};
int mv2_size_bcast_tuning_table = 0;
mv2_bcast_tuning_table* mv2_bcast_thresholds_table = NULL;
/************ Reduce variables and initializers */
-typedef struct {
+struct mv2_reduce_tuning_element {
int min;
int max;
int (*MV2_pt_Reduce_function)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
MPI_Comm comm_ptr);
-} mv2_reduce_tuning_element;
+};
-typedef struct {
+struct mv2_reduce_tuning_table {
int numproc;
int inter_k_degree;
int intra_k_degree;
mv2_reduce_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
int size_intra_table;
mv2_reduce_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
-} mv2_reduce_tuning_table;
+};
int mv2_size_reduce_tuning_table = 0;
mv2_reduce_tuning_table* mv2_reduce_thresholds_table = NULL;
/************ Reduce scatter variables and initializers */
-typedef struct {
+struct mv2_red_scat_tuning_element {
int min;
int max;
int (*MV2_pt_Red_scat_function)(void* sendbuf, void* recvbuf, int* recvcnts, MPI_Datatype datatype, MPI_Op op,
MPI_Comm comm_ptr);
-} mv2_red_scat_tuning_element;
+};
-typedef struct {
+struct mv2_red_scat_tuning_table {
int numproc;
int size_inter_table;
mv2_red_scat_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
-} mv2_red_scat_tuning_table;
+};
int mv2_size_red_scat_tuning_table = 0;
mv2_red_scat_tuning_table* mv2_red_scat_thresholds_table = NULL;
/************ Scatter variables and initializers */
-typedef struct {
+struct mv2_scatter_tuning_element {
int min;
int max;
int (*MV2_pt_Scatter_function)(void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt,
MPI_Datatype recvtype, int root, MPI_Comm comm);
-} mv2_scatter_tuning_element;
+};
-typedef struct {
+struct mv2_scatter_tuning_table {
int numproc;
int size_inter_table;
mv2_scatter_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
int size_intra_table;
mv2_scatter_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
-} mv2_scatter_tuning_table;
+};
int* mv2_scatter_table_ppn_conf = NULL;
int mv2_scatter_num_ppn_conf = 1;
extern XBT_PRIVATE char* smpi_data_exe_start; // start of the data+bss segment of the executable
extern XBT_PRIVATE int smpi_data_exe_size; // size of the data+bss segment of the executable
-typedef enum { shmalloc_none, shmalloc_local, shmalloc_global } shared_malloc_type;
+enum shared_malloc_type { shmalloc_none, shmalloc_local, shmalloc_global };
extern XBT_PRIVATE shared_malloc_type smpi_cfg_shared_malloc; // Whether to activate shared malloc
XBT_PRIVATE void smpi_switch_data_segment(int dest);
// TODO, make this static and expose it more cleanly
-typedef struct s_smpi_privatization_region {
+struct s_smpi_privatization_region_t {
void* address;
int file_descriptor;
-} s_smpi_privatization_region_t;
+};
typedef s_smpi_privatization_region_t* smpi_privatization_region_t;
extern XBT_PRIVATE smpi_privatization_region_t smpi_privatization_regions;
XBT_PUBLIC(smpi_trace_call_location_t*) smpi_trace_get_call_location();
}
-typedef enum {
+enum smpi_priv_strategies {
SMPI_PRIVATIZE_NONE = 0,
SMPI_PRIVATIZE_MMAP = 1,
SMPI_PRIVATIZE_DLOPEN = 2,
SMPI_PRIVATIZE_DEFAULT = SMPI_PRIVATIZE_MMAP
-} smpi_priv_strategies;
+};
extern XBT_PRIVATE int smpi_privatize_global_variables;
namespace simgrid{
namespace smpi{
-struct mpi_coll_description {
+struct s_mpi_coll_description_t {
const char *name;
const char *description;
void *coll;
};
-typedef struct mpi_coll_description s_mpi_coll_description_t;
class Colls{
public:
extern const MPI_Datatype MPI_PTR;
//The following are datatypes for the MPI functions MPI_MAXLOC and MPI_MINLOC.
-typedef struct {
+struct float_int {
float value;
int index;
-} float_int;
-typedef struct {
+};
+struct float_float {
float value;
float index;
-} float_float;
-typedef struct {
+};
+struct long_long {
long value;
long index;
-} long_long;
-typedef struct {
+};
+struct double_double {
double value;
double index;
-} double_double;
-typedef struct {
+};
+struct long_int {
long value;
int index;
-} long_int;
-typedef struct {
+};
+struct double_int {
double value;
int index;
-} double_int;
-typedef struct {
+};
+struct short_int {
short value;
int index;
-} short_int;
-typedef struct {
+};
+struct int_int {
int value;
int index;
-} int_int;
-typedef struct {
+};
+struct long_double_int {
long double value;
int index;
-} long_double_int;
-typedef struct {
+};
+struct integer128_t {
int64_t value;
int64_t index;
-} integer128_t;
-
+};
namespace simgrid{
namespace smpi{
#include <unordered_map>
-typedef struct smpi_delete_fn{
+struct smpi_delete_fn {
MPI_Comm_delete_attr_function *comm_delete_fn;
MPI_Type_delete_attr_function *type_delete_fn;
MPI_Win_delete_attr_function *win_delete_fn;
-} smpi_delete_fn;
+};
-typedef struct smpi_copy_fn{
+struct smpi_copy_fn {
MPI_Comm_copy_attr_function *comm_copy_fn;
MPI_Type_copy_attr_function *type_copy_fn;
MPI_Win_copy_attr_function *win_copy_fn;
-} smpi_copy_fn;
+};
-typedef struct s_smpi_key_elem {
+struct s_smpi_key_elem_t {
smpi_copy_fn copy_fn;
smpi_delete_fn delete_fn;
int refcount;
-} s_smpi_mpi_key_elem_t;
+};
-typedef struct s_smpi_key_elem *smpi_key_elem;
+typedef s_smpi_key_elem_t* smpi_key_elem;
namespace simgrid{
namespace smpi{
template <typename T> int Keyval::keyval_create(smpi_copy_fn copy_fn, smpi_delete_fn delete_fn, int* keyval, void* extra_state){
- smpi_key_elem value = (smpi_key_elem) xbt_new0(s_smpi_mpi_key_elem_t,1);
+ smpi_key_elem value = (smpi_key_elem)xbt_new0(s_smpi_key_elem_t, 1);
value->copy_fn=copy_fn;
value->delete_fn=delete_fn;
typedef short int shortint;
typedef float real;
typedef double doublereal;
-typedef struct {
+struct complex {
real r;
real i;
-} complex;
-typedef struct {
+};
+struct doublecomplex {
doublereal r;
doublereal i;
-} doublecomplex;
+};
extern "C" XBT_PUBLIC(doublereal) smpi_get_host_power_peak_at_(integer *pstate_index);
doublereal smpi_get_host_power_peak_at_(integer *pstate_index)
}
smpi_privatization_regions = static_cast<smpi_privatization_region_t>(
- xbt_malloc(smpi_process_count() * sizeof(struct s_smpi_privatization_region)));
+ xbt_malloc(smpi_process_count() * sizeof(s_smpi_privatization_region_t)));
for (int i=0; i< smpi_process_count(); i++){
// create SIMIX_process_count() mappings of this size with the same data inside
#include "private.hpp"
#include <stack>
-typedef struct s_smpi_static {
+struct s_smpi_static_t {
void *ptr;
void_f_pvoid_t free_fn;
-} s_smpi_static_t;
+};
/**
* \brief Holds a reference to all static variables that were registered
/** @ingroup SURF_storage_interface
* @brief The possible type of action for the storage component
*/
-typedef enum {
+enum e_surf_action_storage_type_t {
READ = 0, /**< Read a file */
WRITE /**< Write in a file */
-} e_surf_action_storage_type_t;
+};
/** @ingroup SURF_storage_interface
* @brief SURF storage action interface class
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_maxmin, surf, "Logging specific to SURF (maxmin)");
-typedef struct s_dyn_light {
+struct s_dyn_light_t {
int *data;
int pos;
int size;
-} s_dyn_light_t;
+};
typedef s_dyn_light_t* dyn_light_t;
double sg_maxmin_precision = 0.00001; /* Change this with --cfg=maxmin/precision:VALUE */
* Basically, each variable will have a set of elements, one for each constraint where it is involved.
* Then, it is used to list all variables involved in constraint through constraint's xxx_element_set lists, or vice-versa list all constraints for a given variable.
*/
-typedef struct lmm_element {
+struct s_lmm_element_t {
/* hookup to constraint */
s_xbt_swag_hookup_t enabled_element_set_hookup;
s_xbt_swag_hookup_t disabled_element_set_hookup;
// - if CPU, then probably 1.
// - If network, then 1 in forward direction and 0.05 backward for the ACKs
double consumption_weight;
-} s_lmm_element_t;
+};
#define make_elem_active(elem) xbt_swag_insert_at_head(elem,&(elem->constraint->active_element_set))
#define make_elem_inactive(elem) xbt_swag_remove(elem,&(elem->constraint->active_element_set))
-typedef struct lmm_constraint_light {
+struct s_lmm_constraint_light_t {
double remaining_over_usage;
lmm_constraint_t cnst;
-} s_lmm_constraint_light_t;
+};
/** @ingroup SURF_lmm
* @brief LMM constraint
* \li Active elements which variable's weight is non-zero (i.e. it is enabled) AND its element value is non-zero. LMM_solve iterates over active elements during resolution, dynamically making them active or unactive.
*
*/
-typedef struct lmm_constraint {
+struct s_lmm_constraint_t {
/* hookup to system */
s_xbt_swag_hookup_t constraint_set_hookup;
s_xbt_swag_hookup_t active_constraint_set_hookup;
double lambda;
double new_lambda;
lmm_constraint_light_t cnst_light;
-} s_lmm_constraint_t;
+};
/** @ingroup SURF_lmm
* @brief LMM variable
*
* When something prevents us from enabling a variable, we "stage" the weight that we would have like to set, so that as soon as possible we enable the variable with desired weight
*/
-typedef struct lmm_variable {
+struct s_lmm_variable_t {
/* hookup to system */
s_xbt_swag_hookup_t variable_set_hookup;
s_xbt_swag_hookup_t saturated_variable_set_hookup;
/* \begin{For Lagrange only} */
double mu;
double new_mu;
- double (*func_f) (struct lmm_variable * var, double x); /* (f) */
- double (*func_fp) (struct lmm_variable * var, double x); /* (f') */
- double (*func_fpi) (struct lmm_variable * var, double x); /* (f')^{-1} */
+ double (*func_f)(s_lmm_variable_t* var, double x); /* (f) */
+ double (*func_fp)(s_lmm_variable_t* var, double x); /* (f') */
+ double (*func_fpi)(s_lmm_variable_t* var, double x); /* (f')^{-1} */
/* \end{For Lagrange only} */
-} s_lmm_variable_t;
+};
/** @ingroup SURF_lmm
* @brief LMM system
*/
-typedef struct lmm_system {
+struct s_lmm_system_t {
int modified;
bool selective_update_active; /* flag to update partially the system only selecting changed portions */
unsigned visited_counter; /* used by lmm_update_modified_set and lmm_remove_modified_set to cleverly (un-)flag the constraints (more details in these functions)*/
xbt_mallocator_t variable_mallocator;
void (*solve_fun)(lmm_system_t self);
-} s_lmm_system_t;
+};
#define extract_variable(sys) xbt_swag_extract(&(sys->variable_set))
#define extract_constraint(sys) xbt_swag_extract(&(sys->constraint_set))
/** @ingroup SURF_interface
* @brief Resource which have a metric handled by a maxmin system
*/
-typedef struct {
+struct s_surf_metric_t {
double peak; /**< The peak of the metric, ie its max value */
double scale; /**< Current availability of the metric according to the traces, in [0,1] */
tmgr_trace_event_t event; /**< The associated trace event associated to the metric */
-} s_surf_metric_t;
+};
namespace simgrid {
namespace surf {
/** @ingroup SURF_interface
* @brief Possible update mechanisms
*/
-typedef enum {
+enum e_UM_t {
UM_FULL, /**< Full update mechanism: the remaining time of every action is recomputed at each step */
UM_LAZY, /**< Lazy update mechanism: only the modified actions get recomputed.
It may be slower than full if your system is tightly coupled to the point where every action
gets recomputed anyway. In that case, you'd better not try to be cleaver with lazy and go for
a simple full update. */
UM_UNDEFINED /**< Mechanism not defined */
-} e_UM_t;
+};
/* Generic functions common to all models */
extern "C" {
/* Iterator within a trace */
-typedef struct tmgr_trace_event {
+struct s_tmgr_trace_event_t {
tmgr_trace_t trace;
unsigned int idx;
sg_resource_t resource;
int free_me;
-} s_tmgr_trace_event_t;
-typedef struct tmgr_trace_event* tmgr_trace_event_t;
+};
+typedef s_tmgr_trace_event_t* tmgr_trace_event_t;
/**
* \brief Free a trace event structure
typedef size_t yy_size_t;
#endif
-typedef enum {
- SURF_CLUSTER_DRAGONFLY=3,
- SURF_CLUSTER_FAT_TREE=2,
- SURF_CLUSTER_FLAT = 1,
- SURF_CLUSTER_TORUS = 0
-} e_surf_cluster_topology_t;
+enum e_surf_cluster_topology_t {
+ SURF_CLUSTER_DRAGONFLY = 3,
+ SURF_CLUSTER_FAT_TREE = 2,
+ SURF_CLUSTER_FLAT = 1,
+ SURF_CLUSTER_TORUS = 0
+};
/* ***************************************** */
/*
* used, instead of malloced structures.
*/
-typedef struct {
+struct s_sg_platf_host_cbarg_t {
const char* id;
std::vector<double> speed_per_pstate;
int pstate;
tmgr_trace_t state_trace;
const char* coord;
std::map<std::string, std::string>* properties;
-} s_sg_platf_host_cbarg_t;
+};
typedef s_sg_platf_host_cbarg_t* sg_platf_host_cbarg_t;
class HostLinkCreationArgs {
tmgr_trace_t state_trace;
};
-typedef struct s_sg_platf_route_cbarg *sg_platf_route_cbarg_t;
-typedef struct s_sg_platf_route_cbarg {
+struct s_sg_platf_route_cbarg_t {
bool symmetrical;
sg_netpoint_t src;
sg_netpoint_t dst;
sg_netpoint_t gw_src;
sg_netpoint_t gw_dst;
std::vector<simgrid::surf::LinkImpl*>* link_list;
-} s_sg_platf_route_cbarg_t;
+};
+typedef s_sg_platf_route_cbarg_t* sg_platf_route_cbarg_t;
class ClusterCreationArgs {
public:
std::string name;
};
-typedef struct s_sg_platf_prop_cbarg *sg_platf_prop_cbarg_t;
-typedef struct s_sg_platf_prop_cbarg {
+struct s_sg_platf_prop_cbarg_t {
const char *id;
const char *value;
-} s_sg_platf_prop_cbarg_t;
+};
+typedef s_sg_platf_prop_cbarg_t* sg_platf_prop_cbarg_t;
class TraceCreationArgs {
public:
std::string element;
};
-typedef struct s_sg_platf_process_cbarg *sg_platf_process_cbarg_t;
-typedef struct s_sg_platf_process_cbarg {
+struct s_sg_platf_process_cbarg_t {
const char **argv;
int argc;
std::map<std::string, std::string>* properties;
double start_time;
double kill_time;
e_surf_process_on_failure_t on_failure;
-} s_sg_platf_process_cbarg_t;
+};
+typedef s_sg_platf_process_cbarg_t* sg_platf_process_cbarg_t;
class ZoneCreationArgs {
public:
};
/* Note: field `unit' for the last element of parameter `units' should be nullptr. */
-static double surf_parse_get_value_with_unit(const char* string, const struct unit_scale* units,
- const char* entity_kind, std::string name, const char* error_msg,
- const char* default_unit)
+static double surf_parse_get_value_with_unit(const char* string, const unit_scale* units, const char* entity_kind,
+ std::string name, const char* error_msg, const char* default_unit)
{
char* ptr;
int i;
double surf_parse_get_time(const char* string, const char* entity_kind, std::string name)
{
- const struct unit_scale units[] = {
- { "w", 7 * 24 * 60 * 60 },
- { "d", 24 * 60 * 60 },
- { "h", 60 * 60 },
- { "m", 60 },
- { "s", 1.0 },
- { "ms", 1e-3 },
- { "us", 1e-6 },
- { "ns", 1e-9 },
- { "ps", 1e-12 },
- { nullptr, 0 }
- };
+ const unit_scale units[] = {{"w", 7 * 24 * 60 * 60},
+ {"d", 24 * 60 * 60},
+ {"h", 60 * 60},
+ {"m", 60},
+ {"s", 1.0},
+ {"ms", 1e-3},
+ {"us", 1e-6},
+ {"ns", 1e-9},
+ {"ps", 1e-12},
+ {nullptr, 0}};
return surf_parse_get_value_with_unit(string, units, entity_kind, name,
"Append 's' to your time to get seconds", "s");
}
double surf_parse_get_size(const char* string, const char* entity_kind, std::string name)
{
- const struct unit_scale units[] = {
- { "EiB", pow(1024, 6) },
- { "PiB", pow(1024, 5) },
- { "TiB", pow(1024, 4) },
- { "GiB", pow(1024, 3) },
- { "MiB", pow(1024, 2) },
- { "KiB", 1024 },
- { "EB", 1e18 },
- { "PB", 1e15 },
- { "TB", 1e12 },
- { "GB", 1e9 },
- { "MB", 1e6 },
- { "kB", 1e3 },
- { "B", 1.0 },
- { "Eib", 0.125 * pow(1024, 6) },
- { "Pib", 0.125 * pow(1024, 5) },
- { "Tib", 0.125 * pow(1024, 4) },
- { "Gib", 0.125 * pow(1024, 3) },
- { "Mib", 0.125 * pow(1024, 2) },
- { "Kib", 0.125 * 1024 },
- { "Eb", 0.125 * 1e18 },
- { "Pb", 0.125 * 1e15 },
- { "Tb", 0.125 * 1e12 },
- { "Gb", 0.125 * 1e9 },
- { "Mb", 0.125 * 1e6 },
- { "kb", 0.125 * 1e3 },
- { "b", 0.125 },
- { nullptr, 0 }
- };
+ const unit_scale units[] = {{"EiB", pow(1024, 6)},
+ {"PiB", pow(1024, 5)},
+ {"TiB", pow(1024, 4)},
+ {"GiB", pow(1024, 3)},
+ {"MiB", pow(1024, 2)},
+ {"KiB", 1024},
+ {"EB", 1e18},
+ {"PB", 1e15},
+ {"TB", 1e12},
+ {"GB", 1e9},
+ {"MB", 1e6},
+ {"kB", 1e3},
+ {"B", 1.0},
+ {"Eib", 0.125 * pow(1024, 6)},
+ {"Pib", 0.125 * pow(1024, 5)},
+ {"Tib", 0.125 * pow(1024, 4)},
+ {"Gib", 0.125 * pow(1024, 3)},
+ {"Mib", 0.125 * pow(1024, 2)},
+ {"Kib", 0.125 * 1024},
+ {"Eb", 0.125 * 1e18},
+ {"Pb", 0.125 * 1e15},
+ {"Tb", 0.125 * 1e12},
+ {"Gb", 0.125 * 1e9},
+ {"Mb", 0.125 * 1e6},
+ {"kb", 0.125 * 1e3},
+ {"b", 0.125},
+ {nullptr, 0}};
return surf_parse_get_value_with_unit(string, units, entity_kind, name,
"Append 'B' to get bytes (or 'b' for bits but 1B = 8b).", "B");
}
double surf_parse_get_bandwidth(const char* string, const char* entity_kind, std::string name)
{
- const struct unit_scale units[] = {
- { "EiBps", pow(1024, 6) },
- { "PiBps", pow(1024, 5) },
- { "TiBps", pow(1024, 4) },
- { "GiBps", pow(1024, 3) },
- { "MiBps", pow(1024, 2) },
- { "KiBps", 1024 },
- { "EBps", 1e18 },
- { "PBps", 1e15 },
- { "TBps", 1e12 },
- { "GBps", 1e9 },
- { "MBps", 1e6 },
- { "kBps", 1e3 },
- { "Bps", 1.0 },
- { "Eibps", 0.125 * pow(1024, 6) },
- { "Pibps", 0.125 * pow(1024, 5) },
- { "Tibps", 0.125 * pow(1024, 4) },
- { "Gibps", 0.125 * pow(1024, 3) },
- { "Mibps", 0.125 * pow(1024, 2) },
- { "Kibps", 0.125 * 1024 },
- { "Tbps", 0.125 * 1e12 },
- { "Gbps", 0.125 * 1e9 },
- { "Mbps", 0.125 * 1e6 },
- { "kbps", 0.125 * 1e3 },
- { "bps", 0.125 },
- { nullptr, 0 }
- };
+ const unit_scale units[] = {{"EiBps", pow(1024, 6)},
+ {"PiBps", pow(1024, 5)},
+ {"TiBps", pow(1024, 4)},
+ {"GiBps", pow(1024, 3)},
+ {"MiBps", pow(1024, 2)},
+ {"KiBps", 1024},
+ {"EBps", 1e18},
+ {"PBps", 1e15},
+ {"TBps", 1e12},
+ {"GBps", 1e9},
+ {"MBps", 1e6},
+ {"kBps", 1e3},
+ {"Bps", 1.0},
+ {"Eibps", 0.125 * pow(1024, 6)},
+ {"Pibps", 0.125 * pow(1024, 5)},
+ {"Tibps", 0.125 * pow(1024, 4)},
+ {"Gibps", 0.125 * pow(1024, 3)},
+ {"Mibps", 0.125 * pow(1024, 2)},
+ {"Kibps", 0.125 * 1024},
+ {"Tbps", 0.125 * 1e12},
+ {"Gbps", 0.125 * 1e9},
+ {"Mbps", 0.125 * 1e6},
+ {"kbps", 0.125 * 1e3},
+ {"bps", 0.125},
+ {nullptr, 0}};
return surf_parse_get_value_with_unit(string, units, entity_kind, name,
"Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps");
}
double surf_parse_get_speed(const char* string, const char* entity_kind, std::string name)
{
- const struct unit_scale units[] = {
- { "yottaflops", 1e24 },
- { "Yf", 1e24 },
- { "zettaflops", 1e21 },
- { "Zf", 1e21 },
- { "exaflops", 1e18 },
- { "Ef", 1e18 },
- { "petaflops", 1e15 },
- { "Pf", 1e15 },
- { "teraflops", 1e12 },
- { "Tf", 1e12 },
- { "gigaflops", 1e9 },
- { "Gf", 1e9 },
- { "megaflops", 1e6 },
- { "Mf", 1e6 },
- { "kiloflops", 1e3 },
- { "kf", 1e3 },
- { "flops", 1.0 },
- { "f", 1.0 },
- { nullptr, 0 }
- };
+ const unit_scale units[] = {{"yottaflops", 1e24}, {"Yf", 1e24}, {"zettaflops", 1e21}, {"Zf", 1e21},
+ {"exaflops", 1e18}, {"Ef", 1e18}, {"petaflops", 1e15}, {"Pf", 1e15},
+ {"teraflops", 1e12}, {"Tf", 1e12}, {"gigaflops", 1e9}, {"Gf", 1e9},
+ {"megaflops", 1e6}, {"Mf", 1e6}, {"kiloflops", 1e3}, {"kf", 1e3},
+ {"flops", 1.0}, {"f", 1.0}, {nullptr, 0}};
return surf_parse_get_value_with_unit(string, units, entity_kind, name,
"Append 'f' or 'flops' to your speed to get flop per second", "f");
}
int size;
};
-static _Unwind_Reason_Code
-backtrace_helper (struct _Unwind_Context *ctx, void *a)
+static _Unwind_Reason_Code backtrace_helper(_Unwind_Context* ctx, void* a)
{
- struct trace_arg *arg = (struct trace_arg *) a;
+ trace_arg* arg = static_cast<trace_arg*>(a);
/* We are first called with address in the __backtrace function.
Skip it. */
xbt_test_unit_t _xbt_test_current_unit = nullptr;
/* test suite test log */
-typedef struct s_xbt_test_log {
+struct s_xbt_test_log {
char *text;
const char *file;
int line;
-} *xbt_test_log_t;
+};
+typedef s_xbt_test_log* xbt_test_log_t;
static void xbt_test_log_dump(xbt_test_log_t log)
{
}
/* test suite test check */
-typedef struct s_xbt_test_test {
+struct s_xbt_test_test {
char *title;
int failed;
int expected_failure;
const char *file;
int line;
xbt_dynar_t logs;
-} *xbt_test_test_t;
+};
+typedef s_xbt_test_test* xbt_test_test_t;
static void xbt_test_test_dump(xbt_test_test_t test)
{
/** @brief create test suite */
xbt_test_suite_t xbt_test_suite_new(const char *name, const char *fmt, ...)
{
- xbt_test_suite_t suite = xbt_new0(struct s_xbt_test_suite, 1);
+ xbt_test_suite_t suite = xbt_new0(s_xbt_test_suite, 1);
va_list ap;
if (_xbt_test_suites == nullptr)
xbt_assert(func);
xbt_assert(fmt);
- unit = xbt_new0(struct s_xbt_test_unit, 1);
+ unit = xbt_new0(s_xbt_test_unit, 1);
va_start(ap, fmt);
unit->title = bvprintf(fmt, ap);
va_end(ap);
xbt_assert(unit);
va_list ap;
- xbt_test_test_t test = xbt_new0(struct s_xbt_test_test, 1);
+ xbt_test_test_t test = xbt_new0(s_xbt_test_test, 1);
va_start(ap, fmt);
test->title = bvprintf(fmt, ap);
va_end(ap);
"Test failed even before being declared (broken unit: %s)", unit->title);
va_list ap;
- xbt_test_log_t log = xbt_new(struct s_xbt_test_log, 1);
+ xbt_test_log_t log = xbt_new(s_xbt_test_log, 1);
va_start(ap, fmt);
log->text = bvprintf(fmt, ap);
va_end(ap);
"Test logged into even before being declared (broken test unit: %s)", unit->title);
va_list ap;
- xbt_test_log_t log = xbt_new(struct s_xbt_test_log, 1);
+ xbt_test_log_t log = xbt_new(s_xbt_test_log, 1);
va_start(ap, fmt);
log->text = bvprintf(fmt, ap);
va_end(ap);
int some_local_variable = 0;
-typedef struct foo {int i;} s_foo;
+struct s_foo {
+ int i;
+};
static void test_type_by_name(simgrid::mc::RemoteClient& process, s_foo my_foo)
{
- assert(process.binary_info->full_types_by_name.find("struct foo") != process.binary_info->full_types_by_name.end());
+ assert(process.binary_info->full_types_by_name.find("struct s_foo") != process.binary_info->full_types_by_name.end());
}
int main(int argc, char** argv)
/* ==l1== L2 ==L3== */
/* ------ */
-typedef enum {
- MAXMIN,
- LAGRANGE_RENO,
- LAGRANGE_VEGAS
-} method_t;
+enum method_t { MAXMIN, LAGRANGE_RENO, LAGRANGE_VEGAS };
static double dichotomy(double func(double), double min, double max, double min_error)
{