bool isOff() { return !isOn(); }
double speed();
- int core_count();
+ int coresCount();
xbt_dict_t properties();
const char*property(const char*key);
void setProperty(const char*key, const char *value);
xbt_swag_t processes();
- double currentPowerPeak();
- double powerPeakAt(int pstate_index);
+ double getPstateSpeedCurrent();
+ double getPstateSpeed(int pstate_index);
int pstatesCount() const;
void setPstate(int pstate_index);
int pstate();
boost::unordered_map<std::string, Storage*> *mounts = nullptr; // caching
public:
- // FIXME: these should be protected, but it leads to many errors
- // Use the extensions stuff for this? Go through simgrid::surf::Host?
// TODO, this could be a unique_ptr
+ /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */
surf::Cpu *pimpl_cpu = nullptr;
+ /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */
surf::NetCard *pimpl_netcard = nullptr;
public:
package org.simgrid.msg;
-import org.simgrid.msg.Storage;
-
-/*
-Host jacquelin;
-
-try {
- jacquelin = Host.getByName("Jacquelin");
-} catch(HostNotFoundException e) {
- System.err.println(e.toString());
-}
-...
-\endverbatim
- *
- */
public class Host {
/**
* This static method returns all of the hosts of the installed platform.
*/
public native int getLoad();
- /**
- * This method returns the speed of the processor of a host,
- * regardless of the current load of the machine.
- *
- * @return The speed of the processor of the host in flops.
- *
- */
- 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 getCoreNumber();
-
- /**
- * Returns the value of a given host property (set from the platform file).
- */
- public native String getProperty(String name);
-
- /**
- * Change the value of a given host property.
- */
- public native void setProperty(String name, String value);
/** This methods returns the list of storages attached to an host
* @return An array containing all storages (name) attached to the host
* \return the number of cores
*/
int MSG_host_get_core_number(msg_host_t host) {
- return host->core_count();
+ return host->coresCount();
}
/** \ingroup m_host_management
*/
double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) {
xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)");
- return host->powerPeakAt(pstate_index);
+ return host->getPstateSpeed(pstate_index);
}
/** \ingroup m_host_management
*/
double MSG_host_get_current_power_peak(msg_host_t host) {
xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)");
- return host->currentPowerPeak();
+ return host->getPstateSpeedCurrent();
}
/** \ingroup m_host_management
}
/** Get the peak power of a host */
-double Host::currentPowerPeak()
+double Host::getPstateSpeedCurrent()
{
return simgrid::simix::kernel([&] {
- return this->pimpl_cpu->getCurrentPowerPeak();
+ return this->pimpl_cpu->getPstateSpeedCurrent();
});
}
/** Get one power peak (in flops/s) of a host at a given pstate */
-double Host::powerPeakAt(int pstate_index)
+double Host::getPstateSpeed(int pstate_index)
{
return simgrid::simix::kernel([&] {
- return this->pimpl_cpu->getPowerPeakAt(pstate_index);
+ return this->pimpl_cpu->getPstateSpeed(pstate_index);
});
}
return pimpl_cpu->getSpeed(1.0);
}
/** @brief Returns the number of core of the processor. */
-int Host::core_count() {
+int Host::coresCount() {
return pimpl_cpu->getCore();
}
*/
double smpi_get_host_power_peak_at(int pstate_index)
{
- return SIMIX_host_self()->powerPeakAt(pstate_index);
+ return SIMIX_host_self()->getPstateSpeed(pstate_index);
}
/**
*/
double smpi_get_host_current_power_peak(void)
{
- return SIMIX_host_self()->currentPowerPeak();
+ return SIMIX_host_self()->getPstateSpeedCurrent();
}
/**
xbt_dynar_free(&speedPerPstate_);
}
-double Cpu::getCurrentPowerPeak()
+double Cpu::getPstateSpeedCurrent()
{
return speed_.peak;
}
return pstate_;
}
-double Cpu::getPowerPeakAt(int pstate_index)
+double Cpu::getPstateSpeed(int pstate_index)
{
xbt_dynar_t plist = speedPerPstate_;
xbt_assert((pstate_index <= (int)xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
/** @brief Get the available speed of the current Cpu */
virtual double getAvailableSpeed();
- /** @brief Get the current Cpu power peak */
- virtual double getCurrentPowerPeak();
-
- virtual double getPowerPeakAt(int pstate_index);
+ /** @brief Get the current Cpu computational speed */
+ virtual double getPstateSpeedCurrent();
+ virtual double getPstateSpeed(int pstate_index);
virtual int getNbPStates();
virtual void setPState(int pstate_index);
for (i = 0; i < totalHosts; i++) {
printf(" <host id=\"%s\" speed=\"%.0f\"", sg_host_get_name(hosts[i]), sg_host_speed(hosts[i]));
props = sg_host_get_properties(hosts[i]);
- if (hosts[i]->core_count()>1) {
- printf(" core=\"%d\"", hosts[i]->core_count());
+ if (hosts[i]->coresCount()>1) {
+ printf(" core=\"%d\"", hosts[i]->coresCount());
}
if (props && !xbt_dict_is_empty(props)) {
printf(">\n");