1 /* Copyright (c) 2008, 2009, 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #include "simix/simix.h"
11 #include "surf/surf_private.h"
13 int host(int argc, char *argv[]);
15 XBT_LOG_NEW_DEFAULT_CATEGORY(file,
16 "Messages specific for this simix example");
18 int host(int argc, char *argv[])
20 size_t read = simcall_file_read(NULL,0,0,NULL);
21 XBT_INFO("Host '%s' read %ld",MSG_host_get_name(MSG_host_self()),read);
22 size_t write = simcall_file_write(NULL,0,0,NULL);
23 XBT_INFO("Host '%s' write %ld",MSG_host_get_name(MSG_host_self()), write);
27 int main(int argc, char **argv)
30 MSG_global_init(&argc, argv);
31 MSG_create_environment(argv[1]);
32 m_host_t *host_table = MSG_get_host_table();
33 int number_of_hosts = MSG_get_host_number();
34 MSG_function_register("host", host);
36 XBT_INFO("Number of host '%d'",number_of_hosts);
37 for(i = 0 ; i<number_of_hosts; i++)
39 char* name_host = bprintf("%d",i);
40 MSG_process_create( name_host, host, NULL, host_table[i] );
46 XBT_INFO("Simulation time %g", MSG_get_clock());