int master(int argc, char *argv[]) { const char *hostname = MSG_host_get_name(MSG_host_self()); int i; //the hostname has an empty HDD with a capacity of 100000 (bytes) TRACE_host_variable_set(hostname, "HDD_capacity", 100000); TRACE_host_variable_set(hostname, "HDD_utilization", 0); for (i = 0; i < 10; i++) { //create and execute a task just to make the simulated time advance msg_task_t task = MSG_task_create("task", 10000, 0, NULL); MSG_task_execute (task); MSG_task_destroy (task); //ADD: after the execution of this task, the HDD utilization increases by 100 (bytes) TRACE_host_variable_add(hostname, "HDD_utilization", 100); } for (i = 0; i < 10; i++) { //create and execute a task just to make the simulated time advance msg_task_t task = MSG_task_create("task", 10000, 0, NULL); MSG_task_execute (task); MSG_task_destroy (task); //SUB: after the execution of this task, the HDD utilization decreases by 100 (bytes) TRACE_host_variable_sub(hostname, "HDD_utilization", 100); } return 0; }
int minusDatasetAmountT(std::string& host_name, std::string type){ /** Decreases number of datasets on @host_name by one. Parameters: ---------- @host_name -- name of host @type -- DISK or TAPE */ MSG_sem_acquire(sem_link); // O -- Tape if (!type.compare("0")){ TRACE_host_variable_sub(host_name.c_str(), "datasetOnTape", 1); //TRACE_host_variable_set(host_name, "datasetOnTape", dataset_number(host_name, "0")); }else{ TRACE_host_variable_sub(host_name.c_str(), "datasetOnDisk", 1); //TRACE_host_variable_set(host_name, "datasetOnDisk", dataset_number(host_name, "1")); } MSG_sem_release(sem_link); return 0; }