XBT_PUBLIC(smx_host_t) simcall_host_get_by_name(const char *name);
XBT_PUBLIC(const char *) simcall_host_get_name(smx_host_t host);
XBT_PUBLIC(xbt_dict_t) simcall_host_get_properties(smx_host_t host);
+XBT_PUBLIC(int) simcall_host_get_core(smx_host_t host);
XBT_PUBLIC(double) simcall_host_get_speed(smx_host_t host);
XBT_PUBLIC(double) simcall_host_get_available_speed(smx_host_t host);
/* Two possible states, 1 - CPU ON and 0 CPU OFF */
return (jdouble) MSG_get_host_speed(host);
}
+
+JNIEXPORT jdouble JNICALL
+Java_org_simgrid_msg_Host_getCore(JNIEnv * env,
+ jobject jhost) {
+ msg_host_t host = jhost_get_native(env, jhost);
+
+ if (!host) {
+ jxbt_throw_notbound(env, "host", jhost);
+ return -1;
+ }
+
+ return (jdouble) MSG_get_host_core(host);
+}
+
JNIEXPORT jint JNICALL
Java_org_simgrid_msg_Host_getLoad(JNIEnv * env, jobject jhost) {
msg_host_t host = jhost_get_native(env, jhost);
*/
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getSpeed
(JNIEnv *, jobject);
+/*
+ * Class org_simgrid_msg_Host
+ * Method getCore
+ * Signature ()D
+ */
+JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCore
+ (JNIEnv *, jobject);
/*
* Class org_simgrid_msg_Host
* Method getLoad
*
*/
public native double getSpeed();
+
+ /**
+ * This method returns the number of core of a host.
+ *
+ * @return The speed of the processor of the host in flops.
+ *
+ */
+ public native double getCore();
+
/**
* Returns the value of a given host property.
*/
surf_action_t(*execute) (void *cpu, double size);
surf_action_t(*sleep) (void *cpu, double duration);
e_surf_resource_state_t(*get_state) (void *cpu);
+ int (*get_core) (void *cpu);
double (*get_speed) (void *cpu, double load);
double (*get_available_speed) (void *cpu);
void (*add_traces) (void);
and create the corresponding action */
surf_action_t(*sleep) (void *workstation, double duration); /**< Make a workstation sleep during a given duration */
e_surf_resource_state_t(*get_state) (void *workstation); /**< Return the CPU state of a workstation */
+ int (*get_core) (void *workstation);
double (*get_speed) (void *workstation, double load); /**< Return the speed of a workstation */
double (*get_available_speed) (void *workstation); /**< Return tha available speed of a workstation */
surf_action_t(*communicate) (void *workstation_src, /**< Execute a communication amount between two workstations */
return (simcall_host_get_speed(h));
}
+
+/** \ingroup m_host_management
+ * \brief Return the number of core.
+ */
+int MSG_get_host_core(msg_host_t h)
+{
+ xbt_assert((h != NULL), "Invalid parameters");
+
+ return (simcall_host_get_core(h));
+}
+
/** \ingroup m_host_management
* \brief Returns the value of a given host property
*
get_speed(host, 1.0);
}
+int SIMIX_pre_host_get_core(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_core(host);
+}
+int SIMIX_host_get_core(smx_host_t host){
+ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
+
+ return surf_workstation_model->extension.workstation.
+ get_core(host);
+}
+
+
+
double SIMIX_pre_host_get_available_speed(smx_simcall_t simcall, smx_host_t host){
return SIMIX_host_get_available_speed(host);
}
void SIMIX_host_restart_processes(smx_host_t host);
void SIMIX_host_autorestart(smx_host_t host);
xbt_dict_t SIMIX_host_get_properties(smx_host_t host);
+int SIMIX_host_get_core(smx_host_t host);
double SIMIX_host_get_speed(smx_host_t host);
double SIMIX_host_get_available_speed(smx_host_t host);
int SIMIX_host_get_state(smx_host_t host);
const char* SIMIX_pre_host_self_get_name(smx_simcall_t);
const char* SIMIX_pre_host_get_name(smx_simcall_t, smx_host_t);
xbt_dict_t SIMIX_pre_host_get_properties(smx_simcall_t, smx_host_t);
+int SIMIX_pre_host_get_core(smx_simcall_t, smx_host_t);
double SIMIX_pre_host_get_speed(smx_simcall_t, smx_host_t);
double SIMIX_pre_host_get_available_speed(smx_simcall_t, smx_host_t);
int SIMIX_pre_host_get_state(smx_simcall_t, smx_host_t);
ACTION(SIMCALL_HOST_GET_BY_NAME, host_get_by_name, WITH_ANSWER, TSPEC(result, smx_host_t), TSTRING(name)) sep \
ACTION(SIMCALL_HOST_GET_NAME, host_get_name, WITH_ANSWER, TSTRING(result), TSPEC(host, smx_host_t)) sep \
ACTION(SIMCALL_HOST_GET_PROPERTIES, host_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(host, smx_host_t)) sep \
+ACTION(SIMCALL_HOST_GET_CORE, host_get_core, WITH_ANSWER, TINT(result), TSPEC(host, smx_host_t)) sep \
ACTION(SIMCALL_HOST_GET_SPEED, host_get_speed, WITH_ANSWER, TDOUBLE(result), TSPEC(host, smx_host_t)) sep \
ACTION(SIMCALL_HOST_GET_AVAILABLE_SPEED, host_get_available_speed, WITH_ANSWER, TDOUBLE(result), TSPEC(host, smx_host_t)) sep \
ACTION(SIMCALL_HOST_GET_STATE, host_get_state, WITH_ANSWER, TINT(result), TSPEC(host, smx_host_t)) sep \
return simcall_BODY_host_get_speed(host);
}
+/**
+ * \ingroup simix_host_management
+ * \brief Returns the number of core of the processor.
+ *
+ * \param host A SIMIX host
+ * \return The number of core
+ */
+int simcall_host_get_core(smx_host_t host)
+{
+ return simcall_BODY_host_get_core(host);
+}
+
+
+
/**
* \ingroup simix_host_management
* \brief Returns the available speed of the processor.
return load * ((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->power_peak;
}
+static int cpu_get_core(void *cpu)
+{
+ return ((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->core;
+}
+
+
static double cpu_get_available_speed(void *cpu)
{
/* number between 0 and 1 */
surf_cpu_model->extension.cpu.sleep = cpu_action_sleep;
surf_cpu_model->extension.cpu.get_state = cpu_get_state;
+ surf_cpu_model->extension.cpu.get_core = cpu_get_core;
surf_cpu_model->extension.cpu.get_speed = cpu_get_speed;
surf_cpu_model->extension.cpu.get_available_speed =
cpu_get_available_speed;
get_speed(workstation, load);
}
+static int ws_get_core(void *workstation)
+{
+ return surf_cpu_model->extension.cpu.
+ get_core(workstation);
+}
+
+
+
static double ws_get_available_speed(void *workstation)
{
return surf_cpu_model->extension.cpu.
surf_workstation_model->extension.workstation.execute = ws_execute;
surf_workstation_model->extension.workstation.sleep = ws_action_sleep;
surf_workstation_model->extension.workstation.get_state = ws_get_state;
+ surf_workstation_model->extension.workstation.get_core = ws_get_core;
surf_workstation_model->extension.workstation.get_speed = ws_get_speed;
surf_workstation_model->extension.workstation.get_available_speed =
ws_get_available_speed;