foreach(x app-masterworker app-pingpong app-token-ring
cloud-capping cloud-masterworker cloud-migration cloud-simple cloud-two-tasks
dht-pastry energy-consumption energy-onoff energy-pstate energy-vm platform-failures
- io-file io-remote io-storage task-priority
+ io-file io-remote task-priority
plugin-hostload
process-create process-join
platform-properties process-startkilltime synchro-semaphore trace-categories
foreach(x app-chainsend app-masterworker app-pingpong app-token-ring
cloud-capping cloud-masterworker cloud-migration cloud-simple
- cloud-two-tasks dht-pastry dht-kademlia platform-failures io-file io-remote io-storage task-priority
+ cloud-two-tasks dht-pastry dht-kademlia platform-failures io-file io-remote task-priority
energy-consumption energy-onoff energy-pstate energy-vm
plugin-hostload
process-create process-join process-startkilltime
The examples of this section demonstrate how to interact with the
simulated storages.
- - <b>Basic example</b>.
- @ref examples/msg/io-storage/io-storage.c \n
- All main storage and file functions are demoed.
-
- <b>File Management</b>. @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,
foreach (example actions-comm actions-storage
actor-create actor-daemon actor-execute actor-kill actor-lifetime actor-migration actor-suspend actor-priority actor-yield
app-masterworker app-pingpong app-token-ring
- async-wait async-waitany async-waitall
- energy-link energy-ptask
- plugin-hostload io mutex)
+ async-wait async-waitany async-waitall
+ energy-link energy-ptask
+ io io-file-remote io-storage-raw
+ platform-properties plugin-hostload mutex)
add_executable (s4u-${example} ${example}/s4u-${example}.cpp)
target_link_libraries(s4u-${example} simgrid)
set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/actions-storage/s4u-actions-storage_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/actor-create/s4u-actor-create_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/actor-priority/s4u-actor-priority_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/s4u-actor-yield_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-waitall/s4u-async-waitall_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-wait/s4u-async-wait_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/io-file-remote/s4u-io-file-remote_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/platform-properties/s4u-platform-properties_d.xml
PARENT_SCOPE)
set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm-split-p0.txt
${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm-split-p1.txt
foreach(example actions-comm actions-storage
actor-create actor-daemon actor-execute actor-kill actor-lifetime actor-migration actor-suspend actor-priority actor-yield
app-bittorrent app-masterworker app-pingpong app-token-ring
- async-wait async-waitall async-waitany
- dht-chord
- energy-link energy-ptask
- plugin-hostload io mutex)
+ async-wait async-waitall async-waitany
+ dht-chord
+ energy-link energy-ptask
+ platform-properties plugin-hostload mutex
+ io io-file-remote io-storage-raw)
ADD_TESH_FACTORIES(s4u-${example} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example} s4u-${example}.tesh)
endforeach()
Presents a set of event handlers reproducing classical I/O
primitives (open, read, close).
+@subsection s4u_ex_io Simulating disks and files
+
+The examples of this section demonstrate how to interact with the
+simulated storages.
+
+ - <b>Access to raw storage devices </b>.
+ @ref examples/s4u/io-raw-storage/s4u-io-raw-storage.cpp \n
+ This example illustrates how to simply read and write data on a
+ simulated storage resource.
+
+ - <b>Remote I/O</b>.
+ @ref examples/s4u/io-file-remote/s4u-io-file-remote.cpp \n
+ I/O operations on files can also be done in a remote fashion,
+ i.e. when the accessed disk is not mounted on the caller's host.
+
*/
/**
@example examples/s4u/app-token-ring/s4u-app-token-ring.cpp
@example examples/s4u/app-masterworker/s4u-app-masterworker.cpp
@example examples/s4u/app-pingpong/s4u-app-pingpong.cpp
-
+@example examples/s4u/io-file-remote/s4u-io-file-remote.cpp
+@example examples/s4u/io-raw-storage/s4u-io-raw-storage.cpp
@example examples/s4u/mutex/s4u-mutex.cpp
*/
\ No newline at end of file
--- /dev/null
+/* 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. */
+
+#include <simgrid/s4u.hpp>
+#include <src/plugins/file_system/FileSystem.hpp>
+#include <string>
+
+#define INMEGA (1024 * 1024)
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(remote_io, "Messages specific for this io example");
+
+static int host(int argc, char* argv[])
+{
+ simgrid::s4u::File* file = new simgrid::s4u::File(argv[1], nullptr);
+ const char* filename = file->getPath();
+ XBT_INFO("Opened file '%s'", filename);
+ file->dump();
+
+ XBT_INFO("Try to read %llu from '%s'", file->size(), filename);
+ sg_size_t read = file->read(file->size());
+ XBT_INFO("Have read %llu from '%s'. Offset is now at: %llu", read, filename, file->tell());
+ XBT_INFO("Seek back to the begining of the stream...");
+ file->seek(0, SEEK_SET);
+ XBT_INFO("Offset is now at: %llu", file->tell());
+
+ delete file;
+
+ if (argc > 5) {
+ file = new simgrid::s4u::File(argv[2], nullptr);
+ filename = file->getPath();
+ XBT_INFO("Opened file '%s'", filename);
+ XBT_INFO("Try to write %llu MiB to '%s'", file->size() / 1024, filename);
+ sg_size_t write = file->write(file->size() * 1024);
+ XBT_INFO("Have written %llu bytes to '%s'.", write, filename);
+
+ if (std::stoi(argv[5]) != 0) {
+ XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename, file->size(),
+ simgrid::s4u::Host::current()->getCname(), argv[3]);
+ file->remoteMove(simgrid::s4u::Host::by_name(argv[3]), argv[4]);
+ } else {
+ XBT_INFO("Copy '%s' (of size %llu) from '%s' to '%s'", filename, file->size(),
+ simgrid::s4u::Host::current()->getCname(), argv[3]);
+ file->remoteCopy(simgrid::s4u::Host::by_name(argv[3]), argv[4]);
+ delete file;
+ }
+ }
+
+ return 0;
+}
+
+int main(int argc, char** argv)
+{
+ simgrid::s4u::Engine e(&argc, argv);
+ sg_storage_file_system_init();
+ e.loadPlatform(argv[1]);
+ e.registerFunction("host", host);
+ e.loadDeployment(argv[2]);
+
+ for (auto const& s : *simgrid::s4u::allStorages()) {
+ XBT_INFO("Init: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s.second) / INMEGA,
+ sg_storage_get_size_free(s.second) / INMEGA, s.second->getCname());
+ }
+
+ e.run();
+
+ for (auto const& s : *simgrid::s4u::allStorages()) {
+ XBT_INFO("End: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s.second) / INMEGA,
+ sg_storage_get_size_free(s.second) / INMEGA, s.second->getCname());
+ }
+
+ XBT_INFO("Simulation time %g", simgrid::s4u::Engine::getClock());
+ return 0;
+}
--- /dev/null
+#! ./tesh
+
+$ ${bindir:=.}/s4u-io-file-remote$EXEEXT ${srcdir:=.}/storage/remote_io.xml ${srcdir:=.}/../s4u/io-file-remote/s4u-io-file-remote_d.xml "--log=root.fmt:[%10.6r]%e(%i@%5h)%e%m%n"
+> [ 0.000000] (0@ ) Init: 12/476824 MiB used/free on 'Disk1'
+> [ 0.000000] (0@ ) Init: 2280/474556 MiB used/free on 'Disk2'
+> [ 0.000000] (1@alice) Opened file 'c:\Windows\setupact.log'
+> [ 0.000000] (1@alice) File Descriptor information:
+> Full path: 'c:\Windows\setupact.log'
+> Size: 101663
+> Mount point: 'c:'
+> Storage Id: 'Disk2'
+> Storage Type: 'SATA-II_HDD'
+> File Descriptor Id: 0
+> [ 0.000000] (1@alice) Try to read 101663 from 'c:\Windows\setupact.log'
+> [ 0.000000] (2@ bob) Opened file '/scratch/lib/libsimgrid.so.3.6.2'
+> [ 0.000000] (2@ bob) File Descriptor information:
+> Full path: '/scratch/lib/libsimgrid.so.3.6.2'
+> Size: 12710497
+> Mount point: '/scratch'
+> Storage Id: 'Disk1'
+> Storage Type: 'SATA-II_HDD'
+> File Descriptor Id: 0
+> [ 0.000000] (2@ bob) Try to read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'
+> [ 0.000000] (3@ carl) Opened file '/scratch/lib/libsimgrid.so.3.6.2'
+> [ 0.000000] (3@ carl) File Descriptor information:
+> Full path: '/scratch/lib/libsimgrid.so.3.6.2'
+> Size: 12710497
+> Mount point: '/scratch'
+> Storage Id: 'Disk1'
+> Storage Type: 'SATA-II_HDD'
+> File Descriptor Id: 0
+> [ 0.000000] (3@ carl) Try to read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'
+> [ 0.000000] (4@ dave) Opened file 'c:\Windows\bootstat.dat'
+> [ 0.000000] (4@ dave) File Descriptor information:
+> Full path: 'c:\Windows\bootstat.dat'
+> Size: 67584
+> Mount point: 'c:'
+> Storage Id: 'Disk2'
+> Storage Type: 'SATA-II_HDD'
+> File Descriptor Id: 0
+> [ 0.000000] (4@ dave) Try to read 67584 from 'c:\Windows\bootstat.dat'
+> [ 0.001469] (4@ dave) Have read 67584 from 'c:\Windows\bootstat.dat'. Offset is now at: 67584
+> [ 0.001469] (4@ dave) Seek back to the begining of the stream...
+> [ 0.001469] (4@ dave) Offset is now at: 0
+> [ 0.001469] (4@ dave) Opened file 'c:\Windows\Professional.xml'
+> [ 0.001469] (4@ dave) Try to write 31 MiB to 'c:\Windows\Professional.xml'
+> [ 0.003741] (1@alice) Have read 101663 from 'c:\Windows\setupact.log'. Offset is now at: 101663
+> [ 0.003741] (1@alice) Seek back to the begining of the stream...
+> [ 0.003741] (1@alice) Offset is now at: 0
+> [ 0.276315] (3@ carl) Have read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'. Offset is now at: 12710497
+> [ 0.276315] (3@ carl) Seek back to the begining of the stream...
+> [ 0.276315] (3@ carl) Offset is now at: 0
+> [ 0.387036] (2@ bob) Have read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'. Offset is now at: 12710497
+> [ 0.387036] (2@ bob) Seek back to the begining of the stream...
+> [ 0.387036] (2@ bob) Offset is now at: 0
+> [ 0.387036] (2@ bob) Opened file '/scratch/doc/simgrid/examples/platforms/g5k.xml'
+> [ 0.387036] (2@ bob) Try to write 16 MiB to '/scratch/doc/simgrid/examples/platforms/g5k.xml'
+> [ 0.528211] (4@ dave) Have written 32646144 bytes to 'c:\Windows\Professional.xml'.
+> [ 0.528211] (4@ dave) Move 'c:\Windows\Professional.xml' (of size 32646144) from 'dave' to 'carl'
+> [ 0.819921] (2@ bob) Have written 17436672 bytes to '/scratch/doc/simgrid/examples/platforms/g5k.xml'.
+> [ 0.819921] (2@ bob) Copy '/scratch/doc/simgrid/examples/platforms/g5k.xml' (of size 17436672) from 'bob' to 'alice'
+> [ 1.843969] (0@ ) End: 60/476776 MiB used/free on 'Disk1'
+> [ 1.843969] (0@ ) End: 2297/474539 MiB used/free on 'Disk2'
+> [ 1.843969] (0@ ) Simulation time 1.84397
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
+<platform version="4.1">
+ <actor host="alice" function="host">
+ <argument value = "c:\Windows\setupact.log"/>
+ </actor>
+ <actor host="bob" function="host">
+ <argument value = "/scratch/lib/libsimgrid.so.3.6.2"/>
+ <argument value = "/scratch/doc/simgrid/examples/platforms/g5k.xml"/>
+ <argument value = "alice"/>
+ <argument value = "c:\Windows\Platforms\g5k.xml"/>
+ <argument value = "0"/>
+ </actor>
+ <actor host="carl" function="host">
+ <argument value = "/scratch/lib/libsimgrid.so.3.6.2"/>
+ </actor>
+ <actor host="dave" function="host">
+ <argument value = "c:\Windows\bootstat.dat"/>
+ <argument value = "c:\Windows\Professional.xml"/>
+ <argument value = "carl"/>
+ <argument value = "/scratch/mailbox/Professional.xml"/>
+ <argument value = "1"/>
+ </actor>
+</platform>
--- /dev/null
+/* Copyright (c) 2017. 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. */
+
+#include "simgrid/s4u.hpp"
+#include <string>
+#include <unordered_map>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(storage, "Messages specific for this simulation");
+
+static void host()
+{
+ /* - Display information on the disks mounted by the current host */
+ XBT_INFO("*** Storage info on %s ***", simgrid::s4u::Host::current()->getCname());
+
+ /* - Retrieve all mount points of current host */
+ std::unordered_map<std::string, simgrid::s4u::Storage*> const& storage_list =
+ simgrid::s4u::Host::current()->getMountedStorages();
+
+ /* - For each disk mounted on host, display disk name and mount point */
+ for (auto const& kv : storage_list)
+ XBT_INFO("Storage name: %s, mount name: %s", kv.second->getCname(), kv.first.c_str());
+
+ /* - Write 200,000 bytes on Disk4 */
+ simgrid::s4u::Storage* storage = simgrid::s4u::Storage::byName("Disk4");
+ sg_size_t write = storage->write(200000);
+ XBT_INFO("Wrote %llu bytes on 'Disk4'", write);
+
+ /* - Now read 200,000 bytes */
+ sg_size_t read = storage->read(200000);
+ XBT_INFO("Read %llu bytes on 'Disk4'", read);
+
+ /* - Attach some user data to disk1 */
+ XBT_INFO("*** Get/set data for storage element: Disk4 ***");
+
+ char* data = static_cast<char*>(storage->getUserdata());
+
+ XBT_INFO("Get storage data: '%s'", data);
+
+ storage->setUserdata(xbt_strdup("Some user data"));
+ data = static_cast<char*>(storage->getUserdata());
+ XBT_INFO("Set and get data: '%s'", data);
+ xbt_free(data);
+}
+
+int main(int argc, char** argv)
+{
+ simgrid::s4u::Engine e(&argc, argv);
+ e.loadPlatform(argv[1]);
+
+ simgrid::s4u::Actor::createActor("", simgrid::s4u::Host::by_name("denise"), host);
+
+ e.run();
+ XBT_INFO("Simulated time: %g", simgrid::s4u::Engine::getClock());
+
+ return 0;
+}
--- /dev/null
+#! ./tesh
+
+$ ${bindir:=.}/s4u-io-storage-raw$EXEEXT ${srcdir:=.}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (1:@denise) *** Storage info on denise ***
+> [ 0.000000] (1:@denise) Storage name: Disk2, mount name: c:
+> [ 0.000000] (1:@denise) Storage name: Disk4, mount name: /home
+> [ 0.003333] (1:@denise) Wrote 200000 bytes on 'Disk4'
+> [ 0.004333] (1:@denise) Read 200000 bytes on 'Disk4'
+> [ 0.004333] (1:@denise) *** Get/set data for storage element: Disk4 ***
+> [ 0.004333] (1:@denise) Get storage data: '(null)'
+> [ 0.004333] (1:@denise) Set and get data: 'Some user data'
+> [ 0.004333] (0:maestro@) Simulated time: 0.00433333
--- /dev/null
+/* Copyright (c) 2017. 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. */
+
+#include <simgrid/s4u.hpp>
+#include <string>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Property test");
+
+static void test_host(std::string hostname)
+{
+ simgrid::s4u::Host* thehost = simgrid::s4u::Host::by_name(hostname);
+ std::map<std::string, std::string>* props = thehost->getProperties();
+ const char* noexist = "Unknown";
+ const char* exist = "Hdd";
+ const char* value;
+
+ XBT_INFO("== Print the properties of the host '%s'", hostname.c_str());
+ for (const auto& kv : *props)
+ XBT_INFO(" Host property: '%s' -> '%s'", kv.first.c_str(), kv.second.c_str());
+
+ XBT_INFO("== Try to get a host property that does not exist");
+ value = thehost->getProperty(noexist);
+ xbt_assert(not value, "The key exists (it's not supposed to)");
+
+ XBT_INFO("== Try to get a host property that does exist");
+ value = thehost->getProperty(exist);
+ xbt_assert(value, "\tProperty %s is undefined (where it should)", exist);
+ xbt_assert(!strcmp(value, "180"), "\tValue of property %s is defined to %s (where it should be 180)", exist, value);
+ XBT_INFO(" Property: %s old value: %s", exist, value);
+
+ XBT_INFO("== Trying to modify a host property");
+ thehost->setProperty(exist, "250");
+
+ /* Test if we have changed the value */
+ value = thehost->getProperty(exist);
+ xbt_assert(value, "Property %s is undefined (where it should)", exist);
+ xbt_assert(!strcmp(value, "250"), "Value of property %s is defined to %s (where it should be 250)", exist, value);
+ XBT_INFO(" Property: %s old value: %s", exist, value);
+
+ /* Restore the value for the next test */
+ thehost->setProperty(exist, "180");
+}
+
+static int alice(int argc, char* argv[])
+{
+ /* Dump what we have on the current host */
+ test_host("host1");
+ return 0;
+}
+
+static int carole(int argc, char* argv[])
+{
+ /* Dump what we have on a remote host */
+ simgrid::s4u::this_actor::sleep_for(1); // Wait for alice to be done with its experiment
+ test_host("host1");
+ return 0;
+}
+
+static int david(int argc, char* argv[])
+{
+ /* Dump what we have on a remote host */
+ simgrid::s4u::this_actor::sleep_for(2); // Wait for alice and carole to be done with its experiment
+ test_host("node-0.acme.org");
+ return 0;
+}
+
+static int bob(int argc, char* argv[])
+{
+ /* this host also tests the properties of the AS*/
+ simgrid::s4u::NetZone* root = simgrid::s4u::Engine::getInstance()->getNetRoot();
+ XBT_INFO("== Print the properties of the zone");
+ XBT_INFO(" Zone property: filename -> %s", root->getProperty("filename"));
+ XBT_INFO(" Zone property: date -> %s", root->getProperty("date"));
+ XBT_INFO(" Zone property: author -> %s", root->getProperty("author"));
+
+ /* Get the property list of current bob process */
+ std::map<std::string, std::string>* props = simgrid::s4u::Actor::self()->getProperties();
+ const char* noexist = "UnknownProcessProp";
+ XBT_ATTRIB_UNUSED const char* value;
+
+ XBT_INFO("== Print the properties of the actor");
+ for (const auto& kv : *props)
+ XBT_INFO(" Actor property: %s -> %s", kv.first.c_str(), kv.second.c_str());
+
+ XBT_INFO("== Try to get an actor property that does not exist");
+
+ value = simgrid::s4u::Actor::self()->getProperty(noexist);
+ xbt_assert(not value, "The property is defined (it shouldnt)");
+ return 0;
+}
+
+int main(int argc, char* argv[])
+{
+ simgrid::s4u::Engine e(&argc, argv);
+ e.loadPlatform(argv[1]);
+
+ e.registerFunction("alice", alice);
+ e.registerFunction("bob", bob);
+ e.registerFunction("carole", carole);
+ e.registerFunction("david", david);
+
+ size_t totalHosts = sg_host_count();
+
+ XBT_INFO("There are %zu hosts in the environment", totalHosts);
+ simgrid::s4u::Host** hosts = sg_host_list();
+ for (unsigned int i = 0; i < totalHosts; i++)
+ XBT_INFO("Host '%s' runs at %.0f flops/s", hosts[i]->getCname(), hosts[i]->getSpeed());
+
+ e.loadDeployment(argv[2]);
+ e.run();
+
+ return 0;
+}
--- /dev/null
+#! ./tesh
+
+p Testing a S4U application with properties in the XML for Hosts, Links and Actors
+
+! output sort 19
+$ $SG_TEST_EXENV ${bindir:=.}/s4u-platform-properties$EXEEXT ${srcdir:=.}/prop.xml ${srcdir:=.}/../s4u/platform-properties/s4u-platform-properties_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (0:maestro@) There are 7 hosts in the environment
+> [ 0.000000] (0:maestro@) Host 'host1' runs at 1000000000 flops/s
+> [ 0.000000] (0:maestro@) Host 'host2' runs at 1000000000 flops/s
+> [ 0.000000] (0:maestro@) Host 'node-0.acme.org' runs at 1000000000 flops/s
+> [ 0.000000] (0:maestro@) Host 'node-1.acme.org' runs at 1000000000 flops/s
+> [ 0.000000] (0:maestro@) Host 'node-2.acme.org' runs at 1000000000 flops/s
+> [ 0.000000] (0:maestro@) Host 'node-3.acme.org' runs at 1000000000 flops/s
+> [ 0.000000] (0:maestro@) Host 'node-4.acme.org' runs at 1000000000 flops/s
+> [ 0.000000] (2:bob@host1) == Print the properties of the zone
+> [ 0.000000] (2:bob@host1) Zone property: filename -> prop.xml
+> [ 0.000000] (2:bob@host1) Zone property: date -> 31-08-12
+> [ 0.000000] (2:bob@host1) Zone property: author -> pnavarro
+> [ 0.000000] (2:bob@host1) == Print the properties of the actor
+> [ 0.000000] (2:bob@host1) Actor property: SomeProp -> SomeValue
+> [ 0.000000] (2:bob@host1) == Try to get an actor property that does not exist
+> [ 0.000000] (1:alice@host1) == Print the properties of the host 'host1'
+> [ 0.000000] (1:alice@host1) Host property: 'Hdd' -> '180'
+> [ 0.000000] (1:alice@host1) Host property: 'mem' -> '4'
+> [ 0.000000] (1:alice@host1) == Try to get a host property that does not exist
+> [ 0.000000] (1:alice@host1) == Try to get a host property that does exist
+> [ 0.000000] (1:alice@host1) Property: Hdd old value: 180
+> [ 0.000000] (1:alice@host1) == Trying to modify a host property
+> [ 0.000000] (1:alice@host1) Property: Hdd old value: 250
+> [ 1.000000] (3:carole@host2) == Print the properties of the host 'host1'
+> [ 1.000000] (3:carole@host2) Host property: 'Hdd' -> '180'
+> [ 1.000000] (3:carole@host2) Host property: 'mem' -> '4'
+> [ 1.000000] (3:carole@host2) == Try to get a host property that does not exist
+> [ 1.000000] (3:carole@host2) == Try to get a host property that does exist
+> [ 1.000000] (3:carole@host2) Property: Hdd old value: 180
+> [ 1.000000] (3:carole@host2) == Trying to modify a host property
+> [ 1.000000] (3:carole@host2) Property: Hdd old value: 250
+> [ 2.000000] (4:david@host2) == Print the properties of the host 'node-0.acme.org'
+> [ 2.000000] (4:david@host2) Host property: 'Hdd' -> '180'
+> [ 2.000000] (4:david@host2) Host property: 'bla' -> 'acme cluster'
+> [ 2.000000] (4:david@host2) Host property: 'mem' -> '42'
+> [ 2.000000] (4:david@host2) == Try to get a host property that does not exist
+> [ 2.000000] (4:david@host2) == Try to get a host property that does exist
+> [ 2.000000] (4:david@host2) Property: Hdd old value: 180
+> [ 2.000000] (4:david@host2) == Trying to modify a host property
+> [ 2.000000] (4:david@host2) Property: Hdd old value: 250
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
+<platform version="4.1">
+ <actor host="host1" function="alice" />
+ <actor host="host1" function="bob">
+ <prop id="SomeProp" value="SomeValue"/>
+ </actor>
+ <actor host="host2" function="carole" />
+ <actor host="host2" function="david" />
+</platform>
#include <simgrid/s4u/Host.hpp>
#include <simgrid/s4u/Link.hpp>
#include <simgrid/s4u/Mailbox.hpp>
+#include <simgrid/s4u/NetZone.hpp>
#include <simgrid/s4u/Comm.hpp>
#include <simgrid/s4u/ConditionVariable.hpp>
simix::ActorImpl* getImpl();
/** Retrieve the property value (or nullptr if not set) */
+ std::map<std::string, std::string>* getProperties();
const char* getProperty(const char* key);
void setProperty(const char* key, const char* value);
Actor* restart();
simcall_process_killall(resetPid);
}
+std::map<std::string, std::string>* Actor::getProperties()
+{
+ return simgrid::simix::kernelImmediate([this] { return this->pimpl_->getProperties(); });
+}
+
/** Retrieve the property value (or nullptr if not set) */
const char* Actor::getProperty(const char* key)
{
cloud-sharing get_sender host_on_off host_on_off_recv host_on_off_processes
process-daemon process-kill process-migration process-suspend process-yield
energy-ptask
+ io-raw-storage
trace_integration)
add_executable (${x} ${x}/${x}.c)
target_link_libraries(${x} simgrid)
task_destroy_cancel task_listen_from task_progress
process-daemon process-kill process-migration process-suspend process-yield
energy-ptask
+ io-raw-storage
trace_integration)
ADD_TESH_FACTORIES(tesh-msg-${x} "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}/${x}.tesh)
endforeach()
#include "simgrid/msg.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation");
+XBT_LOG_NEW_DEFAULT_CATEGORY(storage, "Messages specific for this simulation");
-static int host(int argc, char *argv[]){
+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 */
/* - Write 200,000 bytes on Disk4 */
msg_storage_t storage = MSG_storage_get_by_name("Disk4");
- sg_size_t write = MSG_storage_write(storage, 200000); // Write 200,000 bytes
+ sg_size_t write = MSG_storage_write(storage, 200000); // Write 200,000 bytes
XBT_INFO("Wrote %llu bytes on 'Disk4'", write);
/* - Now read 200,000 bytes */
return 1;
}
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
MSG_init(&argc, argv);
MSG_create_environment(argv[1]);
MSG_function_register("host", host);
- xbt_dynar_t hosts = MSG_hosts_as_dynar();
+ xbt_dynar_t hosts = MSG_hosts_as_dynar();
MSG_process_create(NULL, host, NULL, xbt_dynar_get_as(hosts, 3, msg_host_t));
xbt_dynar_free(&hosts);
#! ./tesh
-$ ${bindir:=.}/io-storage$EXEEXT ${platfdir}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ./io-raw-storage$EXEEXT ${platfdir}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:@denise) *** Storage info on denise ***
> [ 0.000000] (1:@denise) Storage name: Disk2, mount name: c:
> [ 0.000000] (1:@denise) Storage name: Disk4, mount name: /home