From 614c681fbb931bf120a2f4ddd6a0c682df021041 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 16 May 2016 07:33:58 +0200 Subject: [PATCH] doc example: change trace-simple into process-create trace-simple was really brain dead, and we were missing an explicit process-create example --- .gitignore | 2 +- doc/doxygen/inside_cmake.doc | 4 +- examples/msg/CMakeLists.txt | 4 +- examples/msg/README.doc | 15 +- .../process-create.c} | 7 +- .../msg/process-create/process-create.tesh | 4 + examples/msg/trace-simple/trace-simple.tesh | 232 ------------------ 7 files changed, 21 insertions(+), 247 deletions(-) rename examples/msg/{trace-simple/trace-simple.c => process-create/process-create.c} (67%) create mode 100644 examples/msg/process-create/process-create.tesh delete mode 100644 examples/msg/trace-simple/trace-simple.tesh diff --git a/.gitignore b/.gitignore index 96971ad6f3..6093dcfd95 100644 --- a/.gitignore +++ b/.gitignore @@ -170,6 +170,7 @@ examples/msg/synchro-semaphore/synchro-semaphore examples/msg/app-pingpong/app-pingpong examples/msg/maestro-set/maestro-set examples/msg/simulation.trace +examples/msg/process-create/process-create examples/msg/process-startkilltime/process-startkilltime examples/msg/process-suspend/process-suspend examples/msg/app-token-ring/app-token-ring @@ -178,7 +179,6 @@ examples/msg/trace-link-srcdst-user-variables/trace-link-srcdst-user-variables examples/msg/trace-link-user-variables/trace-link-user-variables examples/msg/trace-masterworker/trace-masterworker examples/msg/trace-process-migration/trace-process-migration -examples/msg/trace-simple/trace-simple examples/msg/trace-platform/trace-platform examples/msg/trace-user-variables/trace-user-variables examples/s4u/basic/s4u_basic diff --git a/doc/doxygen/inside_cmake.doc b/doc/doxygen/inside_cmake.doc index fef7924343..75bfa5cd76 100644 --- a/doc/doxygen/inside_cmake.doc +++ b/doc/doxygen/inside_cmake.doc @@ -80,10 +80,10 @@ instance, examples/msg/CMakeLists.txt starts with a loop over all the (currently foreach(x actions-comm actions-storage app-masterworker app-pingpong app-pmm app-token-ring async-wait async-waitall async-waitany cloud-capping cloud-masterworker cloud-migration cloud-multicore cloud-simple cloud-two-tasks dht-chord dht-pastry energy-consumption energy-onoff energy-pstate energy-ptask energy-vm - platform-failures io-file io-remote io-storage task-priority process-kill process-migration + platform-failures io-file io-remote io-storage task-priority process-create process-kill process-migration process-suspend platform-properties maestro-set process-startkilltime synchro-semaphore trace-categories trace-link-srcdst-user-variables trace-link-user-variables trace-masterworker trace-platform - trace-process-migration trace-simple trace-user-variables) + trace-process-migration trace-user-variables) add_executable (${x} ${x}/${x}.c) target_link_libraries(${x} simgrid) set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) diff --git a/examples/msg/CMakeLists.txt b/examples/msg/CMakeLists.txt index d821cd083a..b6e8d4a926 100644 --- a/examples/msg/CMakeLists.txt +++ b/examples/msg/CMakeLists.txt @@ -1,10 +1,10 @@ foreach(x actions-comm actions-storage app-masterworker app-pingpong app-pmm app-token-ring async-wait async-waitall async-waitany cloud-capping cloud-masterworker cloud-migration cloud-multicore cloud-simple cloud-two-tasks dht-chord dht-pastry energy-consumption energy-onoff energy-pstate energy-ptask energy-vm platform-failures - io-file io-remote io-storage task-priority process-kill process-migration process-suspend + io-file io-remote io-storage task-priority process-create process-kill process-migration process-suspend platform-properties maestro-set process-startkilltime synchro-semaphore trace-categories trace-link-srcdst-user-variables trace-link-user-variables trace-masterworker trace-platform - trace-process-migration trace-simple trace-user-variables) + trace-process-migration trace-user-variables) add_executable (${x} ${x}/${x}.c) target_link_libraries(${x} simgrid) set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) diff --git a/examples/msg/README.doc b/examples/msg/README.doc index 1ee4a2e5da..c2c9b0a08c 100644 --- a/examples/msg/README.doc +++ b/examples/msg/README.doc @@ -67,6 +67,11 @@ shipped in the archive: @section msg_ex_process Acting on Processes + - Creating processes. + @ref examples/msg/process-create/process-create.c \n + Most processes are started from the deployment XML file, but they + can also be used with the @ref MSG_process_create() function. + - Suspend and Resume processes. @ref examples/msg/process-suspend/process-suspend.c \n Processes can be suspended and resumed during their executions @@ -85,18 +90,14 @@ 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 are illustrated in these example. See also the @ref tracing_tracing_options "full list of options related to tracing". - - Basic example. @ref examples/msg/trace-simple/trace-simple.c \n - In this very simple program, each process creates, executes, - and destroy a task. Recommanded options: - @verbatim --cfg=tracing:yes --cfg=tracing/uncategorized:yes @endverbatim +It is interesting to run the process-create example with the following +options to see the task executions: - Platform tracing. @ref examples/msg/trace-platform/trace-platform.c \n @@ -281,12 +282,12 @@ top of the example file). @example examples/msg/async-waitall/async-waitall.c @example examples/msg/async-waitall/async-waitany.c +@example examples/msg/process-create/process-create.c @example examples/msg/process-suspend/process-suspend.c @example examples/msg/process-kill/process-kill.c @example examples/msg/process-migration/process-migration.c @example examples/msg/process-startkilltime/process-startkilltime.c -@example examples/msg/trace-simple/trace-simple.c @example examples/msg/trace-platform/trace-platform.c @example examples/msg/trace-categories/trace-categories.c @example examples/msg/trace-masterworker/trace-masterworker.c diff --git a/examples/msg/trace-simple/trace-simple.c b/examples/msg/process-create/process-create.c similarity index 67% rename from examples/msg/trace-simple/trace-simple.c rename to examples/msg/process-create/process-create.c index a53e51fb15..956c2f9161 100644 --- a/examples/msg/trace-simple/trace-simple.c +++ b/examples/msg/process-create/process-create.c @@ -5,7 +5,8 @@ #include "simgrid/msg.h" -static int simple_func(int argc, char *argv[]) +/* Main function of the process I want to start manually */ +static int process_function(int argc, char *argv[]) { msg_task_t task = MSG_task_create("task", 100, 0, NULL); MSG_task_execute (task); @@ -19,8 +20,8 @@ int main(int argc, char *argv[]) xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]); MSG_create_environment(argv[1]); - MSG_process_create("simple_func", simple_func, NULL, MSG_get_host_by_name("Tremblay")); - MSG_process_create("simple_func", simple_func, NULL, MSG_get_host_by_name("Fafard")); + MSG_process_create("simple_func", process_function, NULL, MSG_get_host_by_name("Tremblay")); + MSG_process_create("simple_func", process_function, NULL, MSG_get_host_by_name("Fafard")); MSG_main(); return 0; diff --git a/examples/msg/process-create/process-create.tesh b/examples/msg/process-create/process-create.tesh new file mode 100644 index 0000000000..ad1a9e65e7 --- /dev/null +++ b/examples/msg/process-create/process-create.tesh @@ -0,0 +1,4 @@ +#! ./tesh + +p Start remote processes +$ $SG_TEST_EXENV ${bindir:=.}/process-create$EXEEXT diff --git a/examples/msg/trace-simple/trace-simple.tesh b/examples/msg/trace-simple/trace-simple.tesh deleted file mode 100644 index 401af57c90..0000000000 --- a/examples/msg/trace-simple/trace-simple.tesh +++ /dev/null @@ -1,232 +0,0 @@ -#! ./tesh - -p Simple tracing example -$ $SG_TEST_EXENV ${bindir:=.}/trace-simple$EXEEXT --cfg=tracing:yes --cfg=tracing/filename:trace-simple.trace --cfg=tracing/uncategorized:yes ${srcdir:=.}/small_platform.xml -> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to 'yes' -> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/filename' to 'trace-simple.trace' -> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/uncategorized' to 'yes' - -$ tail -n +3 trace-simple.trace -> %EventDef PajeDefineContainerType 0 -> % Alias string -> % Type string -> % Name string -> %EndEventDef -> %EventDef PajeDefineVariableType 1 -> % Alias string -> % Type string -> % Name string -> % Color color -> %EndEventDef -> %EventDef PajeDefineStateType 2 -> % Alias string -> % Type string -> % Name string -> %EndEventDef -> %EventDef PajeDefineEventType 3 -> % Alias string -> % Type string -> % Name string -> %EndEventDef -> %EventDef PajeDefineLinkType 4 -> % Alias string -> % Type string -> % StartContainerType string -> % EndContainerType string -> % Name string -> %EndEventDef -> %EventDef PajeDefineEntityValue 5 -> % Alias string -> % Type string -> % Name string -> % Color color -> %EndEventDef -> %EventDef PajeCreateContainer 6 -> % Time date -> % Alias string -> % Type string -> % Container string -> % Name string -> %EndEventDef -> %EventDef PajeDestroyContainer 7 -> % Time date -> % Type string -> % Name string -> %EndEventDef -> %EventDef PajeSetVariable 8 -> % Time date -> % Type string -> % Container string -> % Value double -> %EndEventDef -> %EventDef PajeAddVariable 9 -> % Time date -> % Type string -> % Container string -> % Value double -> %EndEventDef -> %EventDef PajeSubVariable 10 -> % Time date -> % Type string -> % Container string -> % Value double -> %EndEventDef -> %EventDef PajeSetState 11 -> % Time date -> % Type string -> % Container string -> % Value string -> %EndEventDef -> %EventDef PajePushState 12 -> % Time date -> % Type string -> % Container string -> % Value string -> %EndEventDef -> %EventDef PajePopState 13 -> % Time date -> % Type string -> % Container string -> %EndEventDef -> %EventDef PajeResetState 14 -> % Time date -> % Type string -> % Container string -> %EndEventDef -> %EventDef PajeStartLink 15 -> % Time date -> % Type string -> % Container string -> % Value string -> % StartContainer string -> % Key string -> %EndEventDef -> %EventDef PajeEndLink 16 -> % Time date -> % Type string -> % Container string -> % Value string -> % EndContainer string -> % Key string -> %EndEventDef -> %EventDef PajeNewEvent 17 -> % Time date -> % Type string -> % Container string -> % Value string -> %EndEventDef -> 0 1 0 HOST -> 6 0 1 1 0 "Tremblay" -> 1 2 1 power "1 1 1" -> 1 3 1 power_used "0.5 0.5 0.5" -> 6 0 2 1 0 "Jupiter" -> 6 0 3 1 0 "Fafard" -> 6 0 4 1 0 "Ginette" -> 6 0 5 1 0 "Bourassa" -> 0 4 0 LINK -> 6 0 6 4 0 "6" -> 1 5 4 bandwidth "1 1 1" -> 1 6 4 latency "1 1 1" -> 1 7 4 bandwidth_used "0.5 0.5 0.5" -> 6 0 7 4 0 "3" -> 6 0 8 4 0 "7" -> 6 0 9 4 0 "9" -> 6 0 10 4 0 "2" -> 6 0 11 4 0 "8" -> 6 0 12 4 0 "1" -> 6 0 13 4 0 "4" -> 6 0 14 4 0 "0" -> 6 0 15 4 0 "5" -> 6 0 16 4 0 "loopback" -> 4 8 0 4 4 0-LINK4-LINK4 -> 4 9 0 1 4 0-HOST1-LINK4 -> 4 10 0 4 1 0-LINK4-HOST1 -> 8 0 2 1 98095000.000000 -> 8 0 2 2 76296000.000000 -> 8 0 2 3 76296000.000000 -> 8 0 2 4 48492000.000000 -> 8 0 2 5 48492000.000000 -> 8 0 5 6 41279125.000000 -> 8 0 6 6 0.000060 -> 8 0 5 7 34285625.000000 -> 8 0 6 7 0.000514 -> 8 0 5 8 11618875.000000 -> 8 0 6 8 0.000190 -> 8 0 5 9 7209750.000000 -> 8 0 6 9 0.001462 -> 8 0 5 10 118682500.000000 -> 8 0 6 10 0.000137 -> 8 0 5 11 8158000.000000 -> 8 0 6 11 0.000271 -> 8 0 5 12 34285625.000000 -> 8 0 6 12 0.000514 -> 8 0 5 13 10099625.000000 -> 8 0 6 13 0.000480 -> 8 0 5 14 41279125.000000 -> 8 0 6 14 0.000060 -> 8 0 5 15 27946250.000000 -> 8 0 6 15 0.000278 -> 8 0 5 16 498000000.000000 -> 8 0 6 16 0.000015 -> 15 0 8 0 topology 13 0 -> 16 0 8 0 topology 7 0 -> 15 0 8 0 topology 6 1 -> 16 0 8 0 topology 8 1 -> 15 0 9 0 topology 1 2 -> 16 0 9 0 topology 13 2 -> 15 0 9 0 topology 1 3 -> 16 0 9 0 topology 9 3 -> 15 0 10 0 topology 9 4 -> 16 0 10 0 topology 2 4 -> 15 0 8 0 topology 10 5 -> 16 0 8 0 topology 14 5 -> 15 0 8 0 topology 12 6 -> 16 0 8 0 topology 11 6 -> 15 0 8 0 topology 9 7 -> 16 0 8 0 topology 13 7 -> 15 0 10 0 topology 8 8 -> 16 0 10 0 topology 5 8 -> 15 0 8 0 topology 14 9 -> 16 0 8 0 topology 12 9 -> 15 0 10 0 topology 15 10 -> 16 0 10 0 topology 4 10 -> 15 0 8 0 topology 10 11 -> 16 0 8 0 topology 15 11 -> 15 0 8 0 topology 7 12 -> 16 0 8 0 topology 15 12 -> 15 0 10 0 topology 11 13 -> 16 0 10 0 topology 3 13 -> 15 0 8 0 topology 7 14 -> 16 0 8 0 topology 10 14 -> 15 0 8 0 topology 12 15 -> 16 0 8 0 topology 6 15 -> 15 0 8 0 topology 11 16 -> 16 0 8 0 topology 6 16 -> 8 0 3 1 0.000000 -> 9 0 3 1 98095000.000000 -> 10 0 3 1 98095000.000000 -> 8 0 3 3 0.000000 -> 9 0 3 3 76296000.000000 -> 10 0 3 3 76296000.000000 -> 9 0 3 1 98095000.000000 -> 9 0 3 3 76296000.000000 -> 10 0.000001 3 1 98095000.000000 -> 10 0.000001 3 3 76296000.000000 -> 7 0.000001 1 3 -> 7 0.000001 1 1 -> 7 0.000001 4 16 -> 7 0.000001 4 14 -> 7 0.000001 4 12 -> 7 0.000001 4 10 -> 7 0.000001 4 7 -> 7 0.000001 4 13 -> 7 0.000001 4 15 -> 7 0.000001 4 6 -> 7 0.000001 4 8 -> 7 0.000001 4 11 -> 7 0.000001 4 9 -> 7 0.000001 1 5 -> 7 0.000001 1 2 -> 7 0.000001 1 4 - -$ rm -f trace-simple.trace -- 2.20.1