From: Martin Quinson Date: Mon, 16 May 2016 04:30:30 +0000 (+0200) Subject: Doc example: model-based ones + add many TODO X-Git-Tag: v3_14~1224 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/366b63fceb713f0b87e9783640066d822e7e3e65 Doc example: model-based ones + add many TODO --- diff --git a/examples/msg/README.doc b/examples/msg/README.doc index d88123ad0b..61f9559667 100644 --- a/examples/msg/README.doc +++ b/examples/msg/README.doc @@ -12,7 +12,8 @@ documentation, but it should remain readable directly. - @ref msg_ex_tracing - @ref msg_ex_tracing_user_variables - @ref msg_ex_models - - @ref msg_ex_io + - @ref msg_ex_ns3 + - @ref msg_ex_io - @ref msg_ex_actions - @ref msg_ex_full_apps - @ref msg_ex_misc @@ -84,6 +85,8 @@ shipped in the archive: You can specify a start time and a kill time in the deployment file. See all *_d.xml files in this directory. +TODO: add an example using @ref MSG_process_create() + @section msg_ex_tracing Tracing and visualization features Tracing can be activated by various configuration options which @@ -127,7 +130,12 @@ are illustrated in these example. See also the options to that extend: @verbatim -cfg=tracing:yes --cfg=tracing/msg/process:yes @endverbatim - + +TODO: These tracing examples should be integrated in the examples to +not dupplicate the C files. A full command line to see the result in +the right tool (viva/vite/FrameSoc) should be given along with some +screenshots. + @subsection msg_ex_tracing_user_variables Tracing user variables You can also attach your own variables to a any resource described in @@ -149,11 +157,48 @@ They have to be run with the following options: It is often easier to update a given variable for all links of a given network path (identified by its source and destination hosts) instead of knowing the name of each specific link. + +TODO: rename trace-user-variables to trace-host-user-variables + +TODO: rename trace-link-srcdst-user-variables to trace-route-user-variables + +@section msg_ex_models Models-related examples + +@subsection msg_ex_ns3 NS3 as a SimGrid Network Model + +This example demonstrates how to use the bindings to the Network +Simulator, as explained in @ref pls. The most +interesting is probably not the C files since they are unchanged from +the other simulations, but the associated files, such as the platform +file to see how to declare a platform to be used with the PLS bindings +of SimGrid and the tesh file to see how to actually start a simulation +in these settings. + + - @ref examples/msg/network-ns3/network-ns3.c. Simple ping-pong using + ns-3 instead of the SimGrid network models. + +TODO: merge the C files + +TODO: show the XML files instead if it's what is interesting. On a "XML example files" page that does not exist yet. + +@subsection msg_ex_io Simulating disks and files + +The examples of this section demonstrate how to interact with the +simulated storages. + + - Basic example. + @ref examples/msg/io-storage/io-storage.c \n + All main storage and file functions are demoed. + + - File Management. @ref examples/msg/io-file/io-file.c \n + This example illustrates the use of operations on file + (@ref MSG_file_open, @ref MSG_file_read, @ref MSG_file_write, + or @ref MSG_file_close). - - @ref examples/msg/network-ns3/network-ns3.c \n - - @ref examples/msg/io-storage/io-storage.c \n - - @ref examples/msg/io-file/io-file.c \n - - @ref examples/msg/io-remote/io-remote.c \n + - Remote I/O. @ref examples/msg/io-remote/io-remote.c \n + I/O operations can also be done in a remote, i.e. when the + accessed disk is not mounted on the caller's host. + - @ref examples/msg/actions-comm/actions-comm.c \n - @ref examples/msg/actions-storage/actions-storage.c \n - @ref examples/msg/app-pmm/app-pmm.c \n @@ -196,6 +241,7 @@ example file). @example examples/msg/trace-link-srcdst-user-variables/trace-link-srcdst-user-variables.c @example examples/msg/network-ns3/network-ns3.c + @example examples/msg/io-storage/io-storage.c @example examples/msg/io-file/io-file.c @example examples/msg/io-remote/io-remote.c @@ -229,30 +275,6 @@ Basic examples and features MSG_task_set_priority() to change the computation priority of a given task. -Models-related examples -======================= - -Packet level simulators ------------------------ -These examples demonstrate how to use the bindings to classical -Packet-Level Simulators (PLS), as explained in the relevant part of -the web documentation. The most interesting is probably not the C -files since they are unchanged from the other simulations, but the -associated files, such as the platform files to see how to declare a -platform to be used with the PLS bindings of SimGrid and the tesh -files to see how to actually start a simulation in these settings. - - * ns3: Simple ping-pong using ns3 instead of the SimGrid models - * gtnets Simple ping-pong using GTNeTs instead of the SimGrid models - -Other resource kinds --------------------- -This section contains some sparse examples of how to use the other -kind of resources, such as disk. These resources are quite -experimental for now, but here we go anyway. - - * io/file.c Example with the disk resource - Trace driven simulations ======================== diff --git a/examples/msg/io-file/io-file.c b/examples/msg/io-file/io-file.c index 0cc2868207..f5fdb14a9b 100644 --- a/examples/msg/io-file/io-file.c +++ b/examples/msg/io-file/io-file.c @@ -1,15 +1,8 @@ -/* Copyright (c) 2008-2010, 2012-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2008-2016. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -/** @addtogroup MSG_examples - * - * - File management: io-file/io-file.c. This example illustrates the use of operations on file - * (@ref MSG_file_open, @ref MSG_file_read, @ref MSG_file_write, or @ref MSG_file_close). - */ - #define FILENAME1 "/home/doc/simgrid/examples/platforms/g5k.xml" #define FILENAME2 "c:\\Windows\\setupact.log" #define FILENAME3 "/home/doc/simgrid/examples/platforms/g5k_cabinets.xml" diff --git a/examples/msg/io-remote/io-remote.c b/examples/msg/io-remote/io-remote.c index 1e8f7d6d18..4be05a2f8d 100644 --- a/examples/msg/io-remote/io-remote.c +++ b/examples/msg/io-remote/io-remote.c @@ -1,14 +1,8 @@ -/* Copyright (c) 2014-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2014-2016. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -/** @addtogroup MSG_examples - * - * - Remote I/O: io-remote/io-remote.c. I/O operations can also be done in a remote, which is illustrated here. - */ - #include "simgrid/msg.h" #define INMEGA (1024*1024) diff --git a/examples/msg/io-storage/io-storage.c b/examples/msg/io-storage/io-storage.c index f06bf84228..6792f1d816 100644 --- a/examples/msg/io-storage/io-storage.c +++ b/examples/msg/io-storage/io-storage.c @@ -1,18 +1,8 @@ -/* Copyright (c) 2006-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2006-2016. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -/** @addtogroup MSG_examples - * - * @section msg_ex_io Simulation disks and files - * - * This section lists some examples of storage simulation. This part of SimGrid is still preliminary. - * - * - Basic example: io-storage/io-storage.c. This example implements all main storage and file functions. - */ - #include "simgrid/msg.h" XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation"); @@ -20,7 +10,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation"); static int host(int argc, char *argv[]){ const char* host_name = MSG_host_get_name(MSG_host_self()); - /** - Display information on the disks mounted by the current host */ + /* - Display information on the disks mounted by the current host */ XBT_INFO("*** Storage info on %s ***", host_name); xbt_dict_cursor_t cursor = NULL; @@ -28,11 +18,11 @@ static int host(int argc, char *argv[]){ char* storage_name; msg_storage_t storage = NULL; - /** - Retrieve all mount points of current host */ + /* - Retrieve all mount points of current host */ xbt_dict_t storage_list = MSG_host_get_mounted_storage_list(MSG_host_self()); xbt_dict_foreach(storage_list,cursor,mount_name,storage_name) { - /** - For each disk mounted on host: + /* - For each disk mounted on host: - Retrieve disk's information */ XBT_INFO("Storage name: %s, mount name: %s", storage_name, mount_name); storage = MSG_storage_get_by_name(storage_name); @@ -47,28 +37,28 @@ static int host(int argc, char *argv[]){ } xbt_dict_free(&storage_list); - /** - Create a 200,000 bytes file named './tmp/data.txt' on /sd1 */ + /* - Create a 200,000 bytes file named './tmp/data.txt' on /sd1 */ char* file_name = xbt_strdup("/home/tmp/data.txt"); msg_file_t file = NULL; sg_size_t write, read, file_size; - /** - Open an non-existing file which amounts to create it. */ + /* - Open an non-existing file which amounts to create it. */ file = MSG_file_open(file_name, NULL); write = MSG_file_write(file, 200000); // Write 200,000 bytes XBT_INFO("Create a %llu bytes file named '%s' on /sd1", write, file_name); MSG_file_dump(file); - /** - Check that sizes have changed */ + /* - Check that sizes have changed */ XBT_INFO("Free size: %llu bytes", MSG_storage_get_free_size(storage)); XBT_INFO("Used size: %llu bytes", MSG_storage_get_used_size(storage)); - /** - Retrieve the size of created file and read it completely */ + /* - Retrieve the size of created file and read it completely */ file_size = MSG_file_get_size(file); MSG_file_seek(file, 0, SEEK_SET); read = MSG_file_read(file, file_size); XBT_INFO("Read %llu bytes on %s", read, file_name); - /** - Then write 100,000 bytes in tmp/data.txt */ + /* - Then write 100,000 bytes in tmp/data.txt */ write = MSG_file_write(file, 100000); // Write 100,000 bytes XBT_INFO("Write %llu bytes on %s", write, file_name); MSG_file_dump(file); @@ -76,20 +66,20 @@ static int host(int argc, char *argv[]){ storage_name = xbt_strdup("Disk4"); storage = MSG_storage_get_by_name(storage_name); - /** - Move file from ./tmp/data.txt to ./tmp/simgrid.readme */ + /* - Move file from ./tmp/data.txt to ./tmp/simgrid.readme */ XBT_INFO("*** Move '/tmp/data.txt' into '/tmp/simgrid.readme'"); MSG_file_move(file, "/home/tmp/simgrid.readme"); - /** - Attach some user data to the file */ + /* - Attach some user data to the file */ MSG_file_set_data(file, xbt_strdup("777")); - /** - Then retrieve this data */ + /* - Then retrieve this data */ char *data = MSG_file_get_data(file); XBT_INFO("User data attached to the file: %s", data); MSG_file_close(file); free(file_name); - /** - Attach some user data to disk1 */ + /* - Attach some user data to disk1 */ XBT_INFO("*** Get/set data for storage element: %s ***",storage_name); data = MSG_storage_get_data(storage); @@ -102,7 +92,7 @@ static int host(int argc, char *argv[]){ xbt_free(data); xbt_free(storage_name); - /** - Finally dump disks contents */ + /* - Finally dump disks contents */ XBT_INFO("*** Dump content of %s ***",MSG_host_get_name(MSG_host_self())); xbt_dict_t contents = NULL; contents = MSG_host_get_storage_content(MSG_host_self()); // contents is a dict of dicts diff --git a/examples/msg/network-ns3/network-ns3.c b/examples/msg/network-ns3/network-ns3.c index 66ff05ba8c..19b95c880b 100644 --- a/examples/msg/network-ns3/network-ns3.c +++ b/examples/msg/network-ns3/network-ns3.c @@ -1,5 +1,4 @@ -/* Copyright (c) 2007-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -8,20 +7,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); -/** @addtogroup MSG_examples - * - * @section msg_ex_models Models-related examples - * - * @subsection MSG_ex_PLS Packet level simulators - * - * This example demonstrates how to use the bindings to a classical Packet-Level Simulators (PLS), as explained in - * \ref pls. The most interesting is probably not the C files since they are unchanged from the other simulations, - * but the associated files, such as the platform file to see how to declare a platform to be used with the PLS - * bindings of SimGrid and the tesh file to see how to actually start a simulation in these settings. - * - * - ns-3: network-ns3/network-ns3.c. Simple ping-pong using ns-3 instead of the SimGrid network models. - */ - int timer_start; //set as 1 in the master process //keep a pointer to all surf running tasks.