{
msg_file_t file = NULL;
char* mount = xbt_strdup("/home");
- sg_storage_size_t read,write;
+ sg_size_t read,write;
if(!strcmp(MSG_process_get_name(MSG_process_self()),"0")){
file = MSG_file_open(mount,FILENAME1, NULL);
{
msg_file_t file = NULL;
char* mount = xbt_strdup("/home");
- sg_storage_size_t write;
+ sg_size_t write;
// First open
XBT_INFO("\tOpen file '%s'",FILENAME1);
#include "xbt/log.h"
#include "xbt/dict.h"
- /* To use PRIu64 format specifier for printing uint64_t (sg_storage_size_t) */
+ /* To use PRIu64 format specifier for printing uint64_t (sg_size_t) */
#include <inttypes.h>
XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation");
storage = MSG_storage_get_by_name(storage_name);
// Retrieve disk's information
- sg_storage_size_t free_size = MSG_storage_get_free_size(mount_name);
- sg_storage_size_t used_size = MSG_storage_get_used_size(mount_name);
- sg_storage_size_t size = MSG_storage_get_size(storage);
+ sg_size_t free_size = MSG_storage_get_free_size(mount_name);
+ sg_size_t used_size = MSG_storage_get_used_size(mount_name);
+ sg_size_t size = MSG_storage_get_size(storage);
XBT_INFO("Total size: %"PRIu64" bytes", size);
XBT_INFO("Free size: %"PRIu64" bytes", free_size);
char* mount = xbt_strdup("/home");
char* file_name = xbt_strdup("./tmp/data.txt");
msg_file_t file = NULL;
- sg_storage_size_t write, read, file_size;
+ sg_size_t write, read, file_size;
// Open an non-existing file amounts to create it!
file = MSG_file_open(mount, file_name, NULL);
char* mountname;
xbt_dict_t content;
char* path;
- sg_storage_size_t *size;
+ sg_size_t *size;
xbt_dict_foreach(contents, curs, mountname, content){
XBT_INFO("Print the content of mount point: %s",mountname);
xbt_dict_foreach(content,curs2,path,size){
- XBT_INFO("%s size: %"PRIu64" bytes", path,*((sg_storage_size_t*)size));
+ XBT_INFO("%s size: %"PRIu64" bytes", path,*((sg_size_t*)size));
}
xbt_dict_free(&content);
}
typedef struct simdata_file *simdata_file_t;
typedef struct s_msg_file_info {
- sg_storage_size_t size;
+ sg_size_t size;
char* mount_point;
char* storageId;
char* storage_type;
XBT_PUBLIC(xbt_dynar_t) MSG_environment_as_get_hosts(msg_as_t as);
/************************** File handling ***********************************/
-XBT_PUBLIC(sg_storage_size_t) MSG_file_read(msg_file_t fd, sg_storage_size_t size);
-XBT_PUBLIC(sg_storage_size_t) MSG_file_write(msg_file_t fd, sg_storage_size_t size);
+XBT_PUBLIC(sg_size_t) MSG_file_read(msg_file_t fd, sg_size_t size);
+XBT_PUBLIC(sg_size_t) MSG_file_write(msg_file_t fd, sg_size_t size);
XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path,
void* data);
XBT_PUBLIC(void*) MSG_file_get_data(msg_file_t fd);
XBT_PUBLIC(msg_error_t) MSG_file_set_data(msg_file_t fd, void * data);
XBT_PUBLIC(int) MSG_file_close(msg_file_t fd);
-XBT_PUBLIC(sg_storage_size_t) MSG_file_get_size(msg_file_t fd);
+XBT_PUBLIC(sg_size_t) MSG_file_get_size(msg_file_t fd);
XBT_PUBLIC(void) MSG_file_dump(msg_file_t fd);
XBT_PUBLIC(int) MSG_file_unlink(msg_file_t fd);
XBT_PUBLIC(xbt_dict_t) MSG_file_ls(const char *mount, const char *path);
-XBT_PUBLIC(msg_error_t) MSG_file_seek(msg_file_t fd, sg_storage_size_t offset, int whence);
+XBT_PUBLIC(msg_error_t) MSG_file_seek(msg_file_t fd, sg_size_t offset, int whence);
XBT_PUBLIC(void) __MSG_file_get_info(msg_file_t fd);
/************************** Storage handling ***********************************/
XBT_PUBLIC(msg_host_t) MSG_get_storage_by_name(const char *name);
XBT_PUBLIC(const char *) MSG_storage_get_name(msg_storage_t storage);
-XBT_PUBLIC(sg_storage_size_t) MSG_storage_get_free_size(const char* name);
-XBT_PUBLIC(sg_storage_size_t) MSG_storage_get_used_size(const char* name);
+XBT_PUBLIC(sg_size_t) MSG_storage_get_free_size(const char* name);
+XBT_PUBLIC(sg_size_t) MSG_storage_get_used_size(const char* name);
XBT_PUBLIC(msg_storage_t) MSG_storage_get_by_name(const char *name);
XBT_PUBLIC(xbt_dict_t) MSG_storage_get_properties(msg_storage_t storage);
XBT_PUBLIC(void) MSG_storage_set_property_value(msg_storage_t storage, const char *name, char *value,void_f_pvoid_t free_ctn);
XBT_PUBLIC(msg_error_t) MSG_storage_set_data(msg_storage_t host, void *data);
XBT_PUBLIC(void *) MSG_storage_get_data(msg_storage_t storage);
XBT_PUBLIC(xbt_dict_t) MSG_storage_get_content(msg_storage_t storage);
-XBT_PUBLIC(sg_storage_size_t) MSG_storage_get_size(msg_storage_t storage);
+XBT_PUBLIC(sg_size_t) MSG_storage_get_size(msg_storage_t storage);
XBT_PUBLIC(msg_error_t) MSG_storage_file_move(msg_file_t fd, msg_host_t dest, char* mount, char* fullname);
XBT_PUBLIC(msg_error_t) MSG_storage_file_rename(msg_storage_t storage, const char* src, const char* dest);
/************************** AS Router handling ************************************/
#define SG_PLATF_H
#include <xbt.h>
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
typedef void *sg_routing_link_t; /* FIXME:The actual type is model-dependent so use void* instead*/
typedef struct RoutingEdge *sg_routing_edge_t;
static inline char* sg_storage_name(sg_storage_t storage) {
return storage->key;
}
-/* Type for any integer storage size */
-typedef uint64_t sg_storage_size_t;
-
+/* Type for any simgrid size size */
+typedef uint64_t sg_size_t;
/*
* Platform creation functions. Instead of passing 123 arguments to the creation functions
const char* content;
const char* content_type;
xbt_dict_t properties;
- sg_storage_size_t size;
+ sg_size_t size;
} s_sg_platf_storage_type_cbarg_t, *sg_platf_storage_type_cbarg_t;
#define SG_PLATF_STORAGE_TYPE_INITIALIZER {NULL,NULL,NULL,NULL,NULL}
/***************************** File **********************************/
XBT_PUBLIC(void *) simcall_file_get_data(smx_file_t fd);
XBT_PUBLIC(void) simcall_file_set_data(smx_file_t fd, void *data);
-XBT_PUBLIC(sg_storage_size_t) simcall_file_read(smx_file_t fd, sg_storage_size_t size);
-XBT_PUBLIC(sg_storage_size_t) simcall_file_write(smx_file_t fd, sg_storage_size_t size);
+XBT_PUBLIC(sg_size_t) simcall_file_read(smx_file_t fd, sg_size_t size);
+XBT_PUBLIC(sg_size_t) simcall_file_write(smx_file_t fd, sg_size_t size);
XBT_PUBLIC(smx_file_t) simcall_file_open(const char* storage, const char* path);
XBT_PUBLIC(int) simcall_file_close(smx_file_t fd);
XBT_PUBLIC(int) simcall_file_unlink(smx_file_t fd);
XBT_PUBLIC(xbt_dict_t) simcall_file_ls(const char* mount, const char* path);
-XBT_PUBLIC(sg_storage_size_t) simcall_file_get_size(smx_file_t fd);
+XBT_PUBLIC(sg_size_t) simcall_file_get_size(smx_file_t fd);
XBT_PUBLIC(xbt_dynar_t) simcall_file_get_info(smx_file_t fd);
/***************************** Storage **********************************/
-XBT_PUBLIC(sg_storage_size_t) simcall_storage_get_free_size (const char* name);
-XBT_PUBLIC(sg_storage_size_t) simcall_storage_get_used_size (const char* name);
+XBT_PUBLIC(sg_size_t) simcall_storage_get_free_size (const char* name);
+XBT_PUBLIC(sg_size_t) simcall_storage_get_used_size (const char* name);
XBT_PUBLIC(xbt_dict_t) simcall_storage_get_properties(smx_storage_t storage);
XBT_PUBLIC(void*) SIMIX_storage_get_data(smx_storage_t storage);
XBT_PUBLIC(void) SIMIX_storage_set_data(smx_storage_t storage, void *data);
XBT_PUBLIC(xbt_dict_t) SIMIX_storage_get_content(smx_storage_t storage);
XBT_PUBLIC(xbt_dict_t) simcall_storage_get_content(smx_storage_t storage);
XBT_PUBLIC(const char*) SIMIX_storage_get_name(smx_host_t host);
-XBT_PUBLIC(sg_storage_size_t) SIMIX_storage_get_size(smx_storage_t storage);
+XBT_PUBLIC(sg_size_t) SIMIX_storage_get_size(smx_storage_t storage);
XBT_PUBLIC(void) simcall_storage_file_rename(smx_storage_t storage, const char* src, const char* dest);
/************************** AS router **********************************/
XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name);
JNIEXPORT jlong JNICALL
Java_org_simgrid_msg_File_read(JNIEnv *env, jobject jfile, jlong jsize) {
msg_file_t file = jfile_get_native(env, jfile);
- return (jlong)MSG_file_read(file, (sg_storage_size_t)jsize);
+ return (jlong)MSG_file_read(file, (sg_size_t)jsize);
}
JNIEXPORT jlong JNICALL
Java_org_simgrid_msg_File_write(JNIEnv *env, jobject jfile, jlong jsize) {
msg_file_t file = jfile_get_native(env, jfile);
- return (jlong)MSG_file_write(file, (sg_storage_size_t)jsize);
+ return (jlong)MSG_file_write(file, (sg_size_t)jsize);
}
JNIEXPORT void JNICALL
Java_org_simgrid_msg_File_close(JNIEnv *env, jobject jfile) {
typedef struct ws_params {
int ncpus;
- long ramsize;
+ sg_size_t ramsize;
int overcommit;
/* The size of other states than memory pages, which is out-of-scope of dirty
surf_action_t surf_workstation_sleep(surf_resource_t resource, double duration);
surf_action_t surf_workstation_open(surf_resource_t workstation, const char* mount, const char* path);
surf_action_t surf_workstation_close(surf_resource_t workstation, surf_file_t fd);
-surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size);
-surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size);
+surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_size_t size);
+surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_size_t size);
xbt_dynar_t surf_workstation_get_info(surf_resource_t resource, surf_file_t fd);
-sg_storage_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name);
-sg_storage_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name);
+sg_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name);
+sg_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name);
xbt_dynar_t surf_workstation_get_vms(surf_resource_t resource);
void surf_workstation_get_params(surf_resource_t resource, ws_params_t params);
void surf_workstation_set_params(surf_resource_t resource, ws_params_t params);
double surf_network_link_get_bandwidth(surf_cpp_resource_t link);
double surf_network_link_get_latency(surf_cpp_resource_t link);
xbt_dict_t surf_storage_get_content(surf_resource_t resource);
-sg_storage_size_t surf_storage_get_size(surf_resource_t resource);
+sg_size_t surf_storage_get_size(surf_resource_t resource);
void surf_storage_rename(surf_resource_t resource, const char* src, const char* dest);
void *surf_action_get_data(surf_action_t action);
void surf_action_set_data(surf_action_t action, void *data);
/********************************* File **************************************/
void __MSG_file_get_info(msg_file_t fd){
xbt_dynar_t info = simcall_file_get_info(fd->simdata->smx_file);
- sg_storage_size_t *psize;
+ sg_size_t *psize;
fd->info->content_type = xbt_dynar_pop_as(info, char *);
fd->info->storage_type = xbt_dynar_pop_as(info, char *);
fd->info->storageId = xbt_dynar_pop_as(info, char *);
fd->info->mount_point = xbt_dynar_pop_as(info, char *);
- psize = xbt_dynar_pop_as(info, sg_storage_size_t*);
+ psize = xbt_dynar_pop_as(info, sg_size_t*);
fd->info->size = *psize;
xbt_free(psize);
xbt_dynar_free_container(&info);
* \param fd is a the file descriptor
* \return the number of bytes successfully read
*/
-sg_storage_size_t MSG_file_read(msg_file_t fd, sg_storage_size_t size)
+sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size)
{
return simcall_file_read(fd->simdata->smx_file, size);
}
* \param fd is a the file descriptor
* \return the number of bytes successfully write
*/
-sg_storage_size_t MSG_file_write(msg_file_t fd, sg_storage_size_t size)
+sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size)
{
return simcall_file_write(fd->simdata->smx_file, size);
}
* \brief Return the size of a file
*
* \param fd is the file descriptor (#msg_file_t)
- * \return the size of the file (as a sg_storage_size_t)
+ * \return the size of the file (as a sg_size_t)
*/
-sg_storage_size_t MSG_file_get_size(msg_file_t fd){
+sg_size_t MSG_file_get_size(msg_file_t fd){
return simcall_file_get_size(fd->simdata->smx_file);
}
* Set the file position indicator in the msg_file_t by adding offset bytes
* to the position specified by whence (either SEEK_SET, SEEK_CUR, or SEEK_END).
*/
-msg_error_t MSG_file_seek (msg_file_t fd, sg_storage_size_t offset, int whence)
+msg_error_t MSG_file_seek (msg_file_t fd, sg_size_t offset, int whence)
{
THROW_UNIMPLEMENTED;
return MSG_OK;
/** \ingroup msg_storage_management
* \brief Returns the free space size of a storage element
* \param name the name of a storage
- * \return the free space size of the storage element (as a sg_storage_size_t)
+ * \return the free space size of the storage element (as a sg_size_t)
*/
-sg_storage_size_t MSG_storage_get_free_size(const char* name){
+sg_size_t MSG_storage_get_free_size(const char* name){
return simcall_storage_get_free_size(name);
}
/** \ingroup msg_storage_management
* \brief Returns the used space size of a storage element
* \param name the name of a storage
- * \return the used space size of the storage element (as a sg_storage_size_t)
+ * \return the used space size of the storage element (as a sg_size_t)
*/
-sg_storage_size_t MSG_storage_get_used_size(const char* name){
+sg_size_t MSG_storage_get_used_size(const char* name){
return simcall_storage_get_used_size(name);
}
return SIMIX_storage_get_content(storage);
}
-sg_storage_size_t MSG_storage_get_size(msg_storage_t storage)
+sg_size_t MSG_storage_get_size(msg_storage_t storage)
{
return SIMIX_storage_get_size(storage);
}
#include "msg_private.h"
#include "xbt/sysdep.h"
#include "xbt/log.h"
+#include "simgrid/platf.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_vm, msg,
"Cloud-oriented parts of the MSG API");
static void send_migration_data(const char *vm_name, const char *src_pm_name, const char *dst_pm_name,
- double size, char *mbox, int stage, int stage2_round, double mig_speed, double xfer_cpu_overhead)
+ sg_size_t size, char *mbox, int stage, int stage2_round, double mig_speed, double xfer_cpu_overhead)
{
char *task_name = get_mig_task_name(vm_name, src_pm_name, dst_pm_name, stage);
msg_task_t task = MSG_task_create(task_name, 0, size, NULL);
if (stage == 2){
- XBT_DEBUG("mig-stage%d.%d: sent %f duration %f actual_speed %f (target %f) cpu %f", stage, stage2_round, size, duration, actual_speed, mig_speed, cpu_utilization);}
+ XBT_DEBUG("mig-stage%d.%d: sent %" PRIu64 " duration %f actual_speed %f (target %f) cpu %f", stage, stage2_round, size, duration, actual_speed, mig_speed, cpu_utilization);}
else{
- XBT_DEBUG("mig-stage%d: sent %f duration %f actual_speed %f (target %f) cpu %f", stage, size, duration, actual_speed, mig_speed, cpu_utilization);
+ XBT_DEBUG("mig-stage%d: sent %" PRIu64 " duration %f actual_speed %f (target %f) cpu %f", stage, size, duration, actual_speed, mig_speed, cpu_utilization);
}
xbt_free(task_name);
}
static double send_stage1(msg_host_t vm, const char *src_pm_name, const char *dst_pm_name,
- long ramsize, double mig_speed, double xfer_cpu_overhead, double dp_rate, double dp_cap, double dpt_cpu_overhead)
+ sg_size_t ramsize, double mig_speed, double xfer_cpu_overhead, double dp_rate, double dp_cap, double dpt_cpu_overhead)
{
const char *vm_name = MSG_host_get_name(vm);
char *mbox = get_mig_mbox_src_dst(vm_name, src_pm_name, dst_pm_name);
// const long chunksize = 1024 * 1024 * 100;
- const unsigned long chunksize = 1024u * 1024u * 100000;
- long remaining = ramsize;
+ const sg_size_t chunksize = 1024L * 1024 * 100000;
+ sg_size_t remaining = ramsize;
double computed_total = 0;
while (remaining > 0) {
- long datasize = chunksize;
+ sg_size_t datasize = chunksize;
if (remaining < chunksize)
datasize = remaining;
s_ws_params_t params;
simcall_host_get_params(vm, ¶ms);
- const long ramsize = params.ramsize;
+ const sg_size_t ramsize = params.ramsize;
const long devsize = params.devsize;
const int skip_stage1 = params.skip_stage1;
const int skip_stage2 = params.skip_stage2;
}
//SIMIX FILE READ
-void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_storage_size_t size)
+void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size)
{
smx_action_t action = SIMIX_file_read(simcall->issuer, fd, size);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
-smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_storage_size_t size)
+smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_size_t size)
{
smx_action_t action;
smx_host_t host = process->smx_host;
}
//SIMIX FILE WRITE
-void SIMIX_pre_file_write(smx_simcall_t simcall, smx_file_t fd, sg_storage_size_t size)
+void SIMIX_pre_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size)
{
smx_action_t action = SIMIX_file_write(simcall->issuer, fd, size);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
-smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_storage_size_t size)
+smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_size_t size)
{
smx_action_t action;
smx_host_t host = process->smx_host;
return action;
}
-sg_storage_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd)
+sg_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd)
{
return SIMIX_file_get_size(simcall->issuer, fd);
}
-sg_storage_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd)
+sg_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd)
{
smx_host_t host = process->smx_host;
return surf_workstation_get_size(host, fd->surf_file);
return surf_storage_rename(storage, src, dest);
}
-sg_storage_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, const char* name)
+sg_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, const char* name)
{
return SIMIX_storage_get_free_size(simcall->issuer, name);
}
-sg_storage_size_t SIMIX_storage_get_free_size(smx_process_t process, const char* name)
+sg_size_t SIMIX_storage_get_free_size(smx_process_t process, const char* name)
{
smx_host_t host = process->smx_host;
return surf_workstation_get_free_size(host, name);
}
-sg_storage_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall, const char* name)
+sg_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall, const char* name)
{
return SIMIX_storage_get_used_size(simcall->issuer, name);
}
-sg_storage_size_t SIMIX_storage_get_used_size(smx_process_t process, const char* name)
+sg_size_t SIMIX_storage_get_used_size(smx_process_t process, const char* name)
{
smx_host_t host = process->smx_host;
return surf_workstation_get_used_size(host, name);
return surf_storage_get_content(storage);
}
-sg_storage_size_t SIMIX_storage_get_size(smx_storage_t storage){
+sg_size_t SIMIX_storage_get_size(smx_storage_t storage){
xbt_assert((storage != NULL), "Invalid parameters (simix storage is NULL)");
return surf_storage_get_size(storage);
}
void SIMIX_storage_destroy(void *s);
void* SIMIX_pre_file_get_data(smx_simcall_t simcall,smx_file_t fd);
void SIMIX_pre_file_set_data(smx_simcall_t simcall, smx_file_t fd, void *data);
-void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_storage_size_t size);
-void SIMIX_pre_file_write(smx_simcall_t simcall,smx_file_t fd, sg_storage_size_t size);
+void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size);
+void SIMIX_pre_file_write(smx_simcall_t simcall,smx_file_t fd, sg_size_t size);
void SIMIX_pre_file_open(smx_simcall_t simcall, const char* mount,
const char* path);
void SIMIX_pre_file_close(smx_simcall_t simcall, smx_file_t fd);
int SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd);
void SIMIX_pre_file_ls(smx_simcall_t simcall,
const char* mount, const char* path);
-sg_storage_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd);
+sg_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd);
xbt_dynar_t SIMIX_pre_file_get_info(smx_simcall_t simcall, smx_file_t fd);
void SIMIX_pre_storage_file_rename(smx_simcall_t simcall,smx_storage_t storage, const char* src, const char* dest);
void* SIMIX_file_get_data(smx_file_t fd);
void SIMIX_file_set_data(smx_file_t fd, void *data);
-smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_storage_size_t size);
-smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_storage_size_t size);
+smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_size_t size);
+smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_size_t size);
smx_action_t SIMIX_file_open(smx_process_t process, const char* storage,
const char* path);
smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fd);
int SIMIX_file_unlink(smx_process_t process, smx_file_t fd);
smx_action_t SIMIX_file_ls(smx_process_t process, const char *mount,
const char *path);
-sg_storage_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd);
+sg_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd);
xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd);
void SIMIX_storage_file_rename(smx_process_t process, smx_storage_t storage, const char* src, const char* dest);
-sg_storage_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall,const char* name);
-sg_storage_size_t SIMIX_storage_get_free_size(smx_process_t process,const char* name);
+sg_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall,const char* name);
+sg_size_t SIMIX_storage_get_free_size(smx_process_t process,const char* name);
-sg_storage_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall,const char* name);
-sg_storage_size_t SIMIX_storage_get_used_size(smx_process_t process,const char* name);
+sg_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall,const char* name);
+sg_size_t SIMIX_storage_get_used_size(smx_process_t process,const char* name);
xbt_dict_t SIMIX_storage_get_properties(smx_storage_t storage);
xbt_dict_t SIMIX_pre_storage_get_properties(smx_simcall_t, smx_storage_t);
#define TFPTR(n) (n, FPtr, fp, FPtr)
#define TCPTR(n) (n, const void*, cp)
#define TSIZE(n) (n, size_t, si)
-#define TSGSTSIZE(n) (n, sg_storage_size_t, sgstsi)
+#define TSGSTSIZE(n) (n, sg_size_t, sgstsi)
#define TVOID(n) (n, void)
#define TDSPEC(n,t) (n, t, dp, void*)
#define TFSPEC(n,t) (n, t, fp, FPtr)
float f;
double d;
size_t si;
- sg_storage_size_t sgstsi;
+ sg_size_t sgstsi;
void* dp;
FPtr fp;
const void* cp;
* \ingroup simix_file_management
*
*/
-sg_storage_size_t simcall_file_read(smx_file_t fd, sg_storage_size_t size)
+sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size)
{
return simcall_BODY_file_read(fd, size);
}
* \ingroup simix_file_management
*
*/
-sg_storage_size_t simcall_file_write(smx_file_t fd, sg_storage_size_t size)
+sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size)
{
return simcall_BODY_file_write(fd, size);
}
* \ingroup simix_file_management
*
*/
-sg_storage_size_t simcall_file_get_size (smx_file_t fd){
+sg_size_t simcall_file_get_size (smx_file_t fd){
return simcall_BODY_file_get_size(fd);
}
* \ingroup simix_storage_management
* \brief Returns the free space size on a given storage element.
* \param storage name
- * \return Return the free space size on a given storage element (as sg_storage_size_t)
+ * \return Return the free space size on a given storage element (as sg_size_t)
*/
-sg_storage_size_t simcall_storage_get_free_size (const char* name){
+sg_size_t simcall_storage_get_free_size (const char* name){
return simcall_BODY_storage_get_free_size(name);
}
* \ingroup simix_storage_management
* \brief Returns the used space size on a given storage element.
* \param storage name
- * \return Return the used space size on a given storage element (as sg_storage_size_t)
+ * \return Return the used space size on a given storage element (as sg_size_t)
*/
-sg_storage_size_t simcall_storage_get_used_size (const char* name){
+sg_size_t simcall_storage_get_used_size (const char* name){
return simcall_BODY_storage_get_used_size(name);
}
xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775);
}
-NetworkCm02Model::NetworkCm02Model() : Model("network"){
+NetworkCm02Model::NetworkCm02Model() : NetworkCm02Model("network"){
}
NetworkCm02Model::NetworkCm02Model(string name) : Model(name){
#include "surf_private.h"
#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
extern "C" {
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf,
(void *) xbt_strdup(storage->type_id));
}
-static xbt_dict_t parse_storage_content(char *filename, sg_storage_size_t *used_size)
+static xbt_dict_t parse_storage_content(char *filename, sg_size_t *used_size)
{
*used_size = 0;
if ((!filename) || (strcmp(filename, "") == 0))
size_t len = 0;
ssize_t read;
char path[1024];
- sg_storage_size_t size;
+ sg_size_t size;
while ((read = xbt_getline(&line, &len, file)) != -1) {
if (read){
if(sscanf(line,"%s %" SCNu64, path, &size) == 2) {
*used_size += size;
- sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1);
+ sg_size_t *psize = xbt_new(sg_size_t, 1);
*psize = size;
xbt_dict_set(parse_content,path,psize,NULL);
} else {
// For each action of type write
double rate = lmm_variable_getvalue(action->p_variable);
/* Hack to avoid rounding differences between x86 and x86_64
- * (note that the next sizes are of type sg_storage_size_t). */
+ * (note that the next sizes are of type sg_size_t). */
long incr = delta * rate + MAXMIN_PRECISION;
action->p_storage->m_usedSize += incr; // disk usage
action->p_file->size += incr; // file size
- sg_storage_size_t *psize = xbt_new(sg_storage_size_t,1);
+ sg_size_t *psize = xbt_new(sg_size_t,1);
*psize = action->p_file->size;
xbt_dict_t content_dict = action->p_storage->p_content;
size_t len = 0;
ssize_t read;
char path[1024];
- sg_storage_size_t size;
+ sg_size_t size;
while ((read = xbt_getline(&line, &len, file)) != -1) {
if (read){
if(sscanf(line,"%s %" SCNu64, path, &size) == 2) {
m_usedSize += size;
- sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1);
+ sg_size_t *psize = xbt_new(sg_size_t, 1);
*psize = size;
xbt_dict_set(parse_content,path,psize,NULL);
} else {
xbt_dict_t ls_dict = xbt_dict_new_homogeneous(xbt_free);
char* key;
- sg_storage_size_t size = 0;
+ sg_size_t size = 0;
xbt_dict_cursor_t cursor = NULL;
xbt_dynar_t dyn = NULL;
// file
if(xbt_dynar_length(dyn) == 1){
- sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1);
+ sg_size_t *psize = xbt_new(sg_size_t, 1);
*psize=size;
xbt_dict_set(ls_dict, file, psize, NULL);
}
StorageActionPtr StorageLmm::open(const char* mount, const char* path)
{
XBT_DEBUG("\tOpen file '%s'",path);
- sg_storage_size_t size, *psize;
- psize = (sg_storage_size_t*) xbt_dict_get_or_null(p_content, path);
+ sg_size_t size, *psize;
+ psize = (sg_size_t*) xbt_dict_get_or_null(p_content, path);
// if file does not exist create an empty file
if(psize)
size = *psize;
else {
- psize = xbt_new(sg_storage_size_t,1);
+ psize = xbt_new(sg_size_t,1);
size = 0;
*psize = size;
xbt_dict_set(p_content, path, psize, NULL);
return action;
}
-StorageActionPtr StorageLmm::read(surf_file_t fd, sg_storage_size_t size)
+StorageActionPtr StorageLmm::read(surf_file_t fd, sg_size_t size)
{
if(size > fd->size)
size = fd->size;
return action;
}
-StorageActionPtr StorageLmm::write(surf_file_t fd, sg_storage_size_t size)
+StorageActionPtr StorageLmm::write(surf_file_t fd, sg_size_t size)
{
char *filename = fd->name;
XBT_DEBUG("\tWrite file '%s' size '%" PRIu64 "/%" PRIu64 "'",filename,size,fd->size);
void StorageLmm::rename(const char *src, const char *dest)
{
- sg_storage_size_t *psize, *new_psize;
- psize = (sg_storage_size_t*) xbt_dict_get_or_null(p_content,src);
- new_psize = xbt_new(sg_storage_size_t, 1);
+ sg_size_t *psize, *new_psize;
+ psize = (sg_size_t*) xbt_dict_get_or_null(p_content,src);
+ new_psize = xbt_new(sg_size_t, 1);
*new_psize = *psize;
if (psize){// src file exists
xbt_dict_remove(p_content, src);
xbt_dict_t content_dict = xbt_dict_new_homogeneous(NULL);
xbt_dict_cursor_t cursor = NULL;
char *file;
- sg_storage_size_t *psize;
+ sg_size_t *psize;
xbt_dict_foreach(p_content, cursor, file, psize){
xbt_dict_set(content_dict,file,psize,NULL);
return content_dict;
}
-sg_storage_size_t StorageLmm::getSize(){
+sg_size_t StorageLmm::getSize(){
return m_size;
}
xbt_dict_t p_content;
char* p_contentType;
- sg_storage_size_t m_size;
- sg_storage_size_t m_usedSize;
+ sg_size_t m_size;
+ sg_size_t m_usedSize;
char * p_typeId;
virtual StorageActionPtr open(const char* mount, const char* path)=0;
virtual StorageActionPtr close(surf_file_t fd)=0;
//virtual StorageActionPtr unlink(surf_file_t fd)=0;
virtual StorageActionPtr ls(const char *path)=0;
- virtual StorageActionPtr read(surf_file_t fd, sg_storage_size_t size)=0;
- virtual StorageActionPtr write(surf_file_t fd, sg_storage_size_t size)=0;
+ virtual StorageActionPtr read(surf_file_t fd, sg_size_t size)=0;
+ virtual StorageActionPtr write(surf_file_t fd, sg_size_t size)=0;
virtual void rename(const char *src, const char *dest)=0;
virtual xbt_dict_t getContent()=0;
- virtual sg_storage_size_t getSize()=0;
+ virtual sg_size_t getSize()=0;
xbt_dict_t parseContent(char *filename);
//StorageActionPtr unlink(surf_file_t fd);
StorageActionPtr ls(const char *path);
xbt_dict_t getContent();
- sg_storage_size_t getSize();
- StorageActionPtr read(surf_file_t fd, sg_storage_size_t size);//FIXME:why we have a useless param ptr ??
- StorageActionPtr write(surf_file_t fd, sg_storage_size_t size);//FIXME:why we have a useless param ptr ??
+ sg_size_t getSize();
+ StorageActionPtr read(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param ptr ??
+ StorageActionPtr write(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param ptr ??
void rename(const char *src, const char *dest);
lmm_constraint_t p_constraintWrite; /* Constraint for maximum write bandwidth*/
char *content_type;
char *type_id;
xbt_dict_t properties;
- sg_storage_size_t size;
+ sg_size_t size;
} s_storage_type_t, *storage_type_t;
typedef struct s_mount {
typedef struct surf_file {
char *name;
char *mount;
- sg_storage_size_t size;
+ sg_size_t size;
} s_surf_file_t;
return get_casted_workstation(workstation)->getSize(fd);
}
-surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size){
+surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_size_t size){
return get_casted_workstation(resource)->read(fd, size);
}
-surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size){
+surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_size_t size){
return get_casted_workstation(resource)->write(fd, size);
}
return get_casted_workstation(resource)->getInfo(fd);
}
-sg_storage_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name){
+sg_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name){
return get_casted_workstation(resource)->getFreeSize(name);
}
-sg_storage_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name){
+sg_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name){
return get_casted_workstation(resource)->getUsedSize(name);
}
return dynamic_cast<StoragePtr>(static_cast<ResourcePtr>(surf_storage_resource_priv(resource)))->getContent();
}
-sg_storage_size_t surf_storage_get_size(surf_resource_t resource){
+sg_size_t surf_storage_get_size(surf_resource_t resource){
return dynamic_cast<StoragePtr>(static_cast<ResourcePtr>(surf_storage_resource_priv(resource)))->getSize();
}
return st->close(fd);
}
-ActionPtr WorkstationCLM03::read(surf_file_t fd, sg_storage_size_t size) {
+ActionPtr WorkstationCLM03::read(surf_file_t fd, sg_size_t size) {
StoragePtr st = findStorageOnMountList(fd->mount);
XBT_DEBUG("READ on disk '%s'",st->m_name);
return st->read(fd, size);
}
-ActionPtr WorkstationCLM03::write(surf_file_t fd, sg_storage_size_t size) {
+ActionPtr WorkstationCLM03::write(surf_file_t fd, sg_size_t size) {
StoragePtr st = findStorageOnMountList(fd->mount);
XBT_DEBUG("WRITE on disk '%s'",st->m_name);
return st->write(fd, size);
return st->ls(path);
}
-sg_storage_size_t WorkstationCLM03::getSize(surf_file_t fd){
+sg_size_t WorkstationCLM03::getSize(surf_file_t fd){
return fd->size;
}
xbt_dynar_t WorkstationCLM03::getInfo( surf_file_t fd)
{
StoragePtr st = findStorageOnMountList(fd->mount);
- sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1);
+ sg_size_t *psize = xbt_new(sg_size_t, 1);
*psize = fd->size;
xbt_dynar_t info = xbt_dynar_new(sizeof(void*), NULL);
- xbt_dynar_push_as(info, sg_storage_size_t *, psize);
+ xbt_dynar_push_as(info, sg_size_t *, psize);
xbt_dynar_push_as(info, void *, fd->mount);
xbt_dynar_push_as(info, void *, (void *)st->m_name);
xbt_dynar_push_as(info, void *, st->p_typeId);
return info;
}
-sg_storage_size_t WorkstationCLM03::getFreeSize(const char* name)
+sg_size_t WorkstationCLM03::getFreeSize(const char* name)
{
StoragePtr st = findStorageOnMountList(name);
return st->m_size - st->m_usedSize;
}
-sg_storage_size_t WorkstationCLM03::getUsedSize(const char* name)
+sg_size_t WorkstationCLM03::getUsedSize(const char* name)
{
StoragePtr st = findStorageOnMountList(name);
return st->m_usedSize;
ActionPtr close(surf_file_t fd);
int unlink(surf_file_t fd);
ActionPtr ls(const char* mount, const char *path);
- sg_storage_size_t getSize(surf_file_t fd);
- ActionPtr read(surf_file_t fd, sg_storage_size_t size);
- ActionPtr write(surf_file_t fd, sg_storage_size_t size);
+ sg_size_t getSize(surf_file_t fd);
+ ActionPtr read(surf_file_t fd, sg_size_t size);
+ ActionPtr write(surf_file_t fd, sg_size_t size);
xbt_dynar_t getInfo( surf_file_t fd);
- sg_storage_size_t getFreeSize(const char* name);
- sg_storage_size_t getUsedSize(const char* name);
+ sg_size_t getFreeSize(const char* name);
+ sg_size_t getUsedSize(const char* name);
bool isUsed();
//bool isShared();
void storage_info(msg_host_t host);
void display_storage_properties(msg_storage_t storage);
int hsm_put(const char *remote_host, const char *src, const char *dest);
-sg_storage_size_t write_local_file(char *dest, sg_storage_size_t file_size);
-sg_storage_size_t read_local_file(const char *src);
+sg_size_t write_local_file(char *dest, sg_size_t file_size);
+sg_size_t read_local_file(const char *src);
void display_storage_info(msg_host_t host);
void dump_storage_by_name(char *name);
void display_storage_content(msg_storage_t storage);
{
XBT_INFO("Storage name: %s, mount name: %s", storage_name, mount_name);
- sg_storage_size_t free_size = MSG_storage_get_free_size(mount_name);
- sg_storage_size_t used_size = MSG_storage_get_used_size(mount_name);
+ sg_size_t free_size = MSG_storage_get_free_size(mount_name);
+ sg_size_t used_size = MSG_storage_get_used_size(mount_name);
XBT_INFO("Free size: %" PRIu64 " bytes", free_size);
XBT_INFO("Used size: %" PRIu64 " bytes", used_size);
int hsm_put(const char *remote_host, const char *src, const char *dest){
// Read local src file, and return the size that was actually read
- sg_storage_size_t read_size = read_local_file(src);
+ sg_size_t read_size = read_local_file(src);
// Send file
XBT_INFO("%s sends %" PRIu64 " to %s",MSG_host_get_name(MSG_host_self()),read_size,remote_host);
return 1;
}
-sg_storage_size_t write_local_file(char *dest, sg_storage_size_t file_size)
+sg_size_t write_local_file(char *dest, sg_size_t file_size)
{
- sg_storage_size_t write;
+ sg_size_t write;
msg_file_t file = MSG_file_open("/sd1",dest, NULL);
write = MSG_file_write(file, file_size);
MSG_file_close(file);
return write;
}
-sg_storage_size_t read_local_file(const char *src)
+sg_size_t read_local_file(const char *src)
{
- sg_storage_size_t read, file_size;
+ sg_size_t read, file_size;
msg_file_t file = MSG_file_open("/sd1",src, NULL);
file_size = MSG_file_get_size(file);
XBT_INFO("Print the content of the storage element: %s",MSG_storage_get_name(storage));
xbt_dict_cursor_t cursor = NULL;
char *file;
- sg_storage_size_t *psize;
+ sg_size_t *psize;
xbt_dict_t content = MSG_storage_get_content(storage);
if (content){
xbt_dict_foreach(content, cursor, file, psize)
else if(!strcmp(task_name,"hsm_put")){// Receive file to save
// Write file on local disk
char *dest = MSG_task_get_data(to_execute);
- sg_storage_size_t size_to_write = (sg_storage_size_t)MSG_task_get_data_size(to_execute);
+ sg_size_t size_to_write = (sg_size_t)MSG_task_get_data_size(to_execute);
write_local_file(dest, size_to_write);
}