string(REPLACE ".fig" ".png" tmp_file ${file})
string(REPLACE "${CMAKE_HOME_DIRECTORY}/doc/fig/" "${CMAKE_HOME_DIRECTORY}/doc/html/" tmp_file ${tmp_file})
ADD_CUSTOM_COMMAND(TARGET simgrid_documentation
- COMMAND ${FIG2DEV_PATH}/fig2dev -Lpng ${file} ${tmp_file}
+ COMMAND ${FIG2DEV_PATH}/fig2dev -Lpng -S 4 ${file} ${tmp_file}
)
endforeach(file ${DOC_FIGS})
\verbatim
simgrid.register_application();
\endverbatim
-Yes, Here too you have to resgiter your application before running the simulation.
+Yes, Here too you have to register your application before running the simulation.
the full example is distributed in the file examples/lua/master_slave_bypass.lua
-#FIG 3.2 Produced by xfig version 3.2.5
+#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
Single
-2
1200 2
-0 32 #84e373
-0 33 #ffcb84
-0 34 #adbeff
-0 35 #ff4952
-0 36 #a5a6a5
-0 37 #ff9700
+0 32 #83e273
+0 33 #feca83
+0 34 #acbdfe
+0 35 #fe4952
+0 36 #a4a5a4
+0 37 #fe9600
6 -360 2340 1305 3105
-4 1 0 50 -1 4 14 0.0000 2 165 540 472 2520 MSG\001
-4 1 0 50 -1 4 12 0.0000 2 195 1650 472 2835 Simple application-\001
-4 1 0 50 -1 4 12 0.0000 2 150 1260 472 3105 level simulator\001
+4 1 0 50 -1 4 14 0.0000 2 135 270 472 2520 MSG\001
+4 1 0 50 -1 4 12 0.0000 2 165 1710 472 2835 Simple application-\001
+4 1 0 50 -1 4 12 0.0000 2 135 1350 472 3105 level simulator\001
-6
6 1845 2295 3915 3240
-4 1 0 50 -1 4 14 0.0000 2 165 690 2430 2475 GRAS\001
-4 1 0 50 -1 4 12 0.0000 2 150 960 2430 2745 Framework\001
-4 1 0 50 -1 4 12 0.0000 2 195 960 2430 2970 to develop\001
-4 1 0 50 -1 4 12 0.0000 2 195 2055 2880 3195 distributed applications\001
+4 1 0 50 -1 4 14 0.0000 2 135 360 2430 2475 GRAS\001
+4 1 0 50 -1 4 12 0.0000 2 135 810 2430 2745 Framework\001
+4 1 0 50 -1 4 12 0.0000 2 165 990 2430 2970 to develop\001
+4 1 0 50 -1 4 12 0.0000 2 165 2250 2880 3195 distributed applications\001
-6
6 3060 2205 4095 2835
# href="group__AMOK__API.html" ALT="AMOK"
2 2 0 1 0 27 60 -1 20 0.000 0 0 -1 0 0 5
3082 2205 4072 2205 4072 2835 3082 2835 3082 2205
-4 1 0 50 -1 4 12 0.0000 2 150 630 3577 2745 toolbox\001
-4 1 0 50 -1 4 14 0.0000 2 165 705 3577 2475 AMOK\001
+4 1 0 50 -1 4 12 0.0000 2 135 630 3577 2745 toolbox\001
+4 1 0 50 -1 4 14 0.0000 2 135 360 3577 2475 AMOK\001
-6
6 -675 3510 9045 4365
6 3082 3645 5287 4185
-4 1 0 50 -1 4 12 0.0000 2 195 2145 4184 4102 virtual platform simulator\001
-4 1 0 50 -1 4 14 0.0000 2 165 675 4184 3847 SURF\001
+4 1 0 50 -1 4 12 0.0000 2 165 2340 4184 4102 virtual platform simulator\001
+4 1 0 50 -1 4 14 0.0000 2 135 360 4184 3847 SURF\001
-6
# href="group__SURF__API.html" ALT="SMPI"
2 2 0 1 0 34 60 -1 20 0.000 0 0 -1 0 0 5
-675 3510 9045 3510 9045 4365 -675 4365 -675 3510
-6
6 6840 2340 8865 3150
-4 1 0 50 -1 4 14 0.0000 2 210 870 7852 2520 SimDag\001
-4 1 0 50 -1 4 12 0.0000 2 150 1245 7852 2835 Framework for\001
-4 1 0 50 -1 4 12 0.0000 2 195 1965 7852 3105 DAGs of parallel tasks\001
+4 1 0 50 -1 4 14 0.0000 2 165 540 7852 2520 SimDag\001
+4 1 0 50 -1 4 12 0.0000 2 135 1170 7852 2835 Framework for\001
+4 1 0 50 -1 4 12 0.0000 2 165 1980 7852 3105 DAGs of parallel tasks\001
-6
6 -158 4590 7987 5085
-4 1 0 50 -1 4 12 0.0000 2 195 8085 3914 5025 Grounding features (logging, etc.), usual data structures (lists, sets, etc.) and portability layer\001
-4 1 0 50 -1 4 14 0.0000 2 165 480 3914 4770 XBT\001
+4 1 0 50 -1 4 12 0.0000 2 180 8910 3914 5025 Grounding features (logging, etc.), usual data structures (lists, sets, etc.) and portability layer\001
+4 1 0 50 -1 4 14 0.0000 2 135 270 3914 4770 XBT\001
-6
-6 -810 1215 9135 1935
-6 5670 1305 8370 1800
+6 5435 1305 8318 1800
# href="/contrib.html" ALT="Contrib"
2 2 0 1 0 37 55 -1 20 0.000 0 0 -1 0 0 5
- 5670 1800 8370 1800 8370 1305 5670 1305 5670 1800
-4 1 0 50 -1 4 14 0.0000 2 165 780 7020 1635 Contrib\001
--6
-2 2 0 1 0 31 70 -1 20 0.000 0 0 -1 0 0 5
- -810 1935 9135 1935 9135 1215 -810 1215 -810 1935
-4 1 0 50 -1 4 14 0.0000 2 165 1155 3914 1650 User Code\001
+ 5435 1800 8318 1800 8318 1305 5435 1305 5435 1800
+4 1 0 50 -1 4 15 0.0000 2 135 630 6876 1635 Contrib\001
-6
# href="group__MSG__API.html" ALT="MSG"
2 2 0 1 0 32 60 -1 20 0.000 0 0 -1 0 0 5
# href="group__SMPI__API.html" ALT="SMPI"
2 2 0 1 0 36 60 -1 20 0.000 0 0 -1 0 0 5
4230 2205 6570 2205 6570 3375 4230 3375 4230 2205
-# href="group__SD__API.html" ALT="SimDag"
-2 2 0 1 0 23 60 -1 30 0.000 0 0 -1 0 0 5
- 6705 2205 9045 2205 9045 3375 6705 3375 6705 2205
+2 2 0 1 0 31 70 -1 20 0.000 0 0 -1 0 0 5
+ -810 1935 9855 1935 9855 1215 -810 1215 -810 1935
# href="group__XBT__API.html" ALT="XBT"
2 3 0 1 0 33 80 -1 20 0.000 0 0 -1 0 0 5
-810 2160 -810 5220 9135 5220 9135 2160 -810 2160
-4 1 0 50 -1 4 12 0.0000 2 195 1860 5400 2955 applications on top of\001
-4 1 0 50 -1 4 12 0.0000 2 150 1815 5400 3210 a virtual environment\001
-4 1 0 50 -1 4 12 0.0000 2 195 1560 5400 2745 Library to run MPI\001
-4 1 0 50 -1 4 14 0.0000 2 165 585 5400 2520 SMPI\001
+# href="group__SD__API.html" ALT="SimDag"
+2 2 0 1 0 23 60 -1 30 0.000 0 0 -1 0 0 5
+ 6705 2205 9045 2205 9045 3375 6705 3375 6705 2205
+# href="group__TRACE__API.html" ALT="TRACE"
+2 2 0 1 0 3 50 -1 30 0.000 0 0 -1 0 0 5
+ 9270 2160 9810 2160 9810 5220 9270 5220 9270 2160
+4 1 0 50 -1 4 12 0.0000 2 165 1980 5400 2955 applications on top of\001
+4 1 0 50 -1 4 12 0.0000 2 135 1890 5400 3210 a virtual environment\001
+4 1 0 50 -1 4 12 0.0000 2 165 1620 5400 2745 Library to run MPI\001
+4 1 0 50 -1 4 15 0.0000 2 135 810 3560 1650 User Code\001
+4 0 0 50 -1 4 15 1.5708 2 135 450 9630 5085 TRACE\001
+4 1 0 50 -1 4 14 0.0000 2 135 360 5400 2520 SMPI\001
+4 0 0 50 -1 4 12 1.5708 2 165 1620 9585 4050 Tracing simulation\001
See the \ref XBT_API section for more details.
+\subsection lucas_layer Tracing simulation
+Finally, a transversal module allows you to trace your simulation. More documentation in the section \ref TRACE_doc
+
\htmlonly <!-- ______BODY_BEGIN______ --!> \endhtmlonly
<br>
The SimGrid software package can be downloaded from
-/*! \page platform Platform description
+/*! \page platform Platform Description
\htmlinclude .platform.doc.toc
application, and finally it needs something to know where to deploy what.
For the latest 2 entries, you have basically 2 ways to give it as an input :
-\li You can program it, either using the Lua console or if you're using MSG some
-of its platform and deployments functions. If you want to use it, please refer
+\li You can program it, either using the Lua console (\ref MSG_Lua_funct) or if you're using MSG some
+of its platform and deployments functions(\ref msg_easier_life). If you want to use it, please refer
to its doc. (you can also check the section \ref pf_flexml_bypassing but this is strongly deprecated, as there is a new way to do it properly, but not yet documented).
\li You can use two XML files: a platform description file and a deployment
description one.
\li <b>state_file</b>: Same mechanism as availability_file, similar syntax for value.
\li <b>coordinates</b>: you'll have to give it if you choose the vivaldi, coordinate-based routing model for the AS the host belongs to. More details about it in the P2P coordinate based section.
+An host can contain some <b>mount</b> that defines mounting points between some storage resource and the <b>host</b>. Please refer to the storage doc for more information.
+
An host can also contain the <b>prop</b> tag. the prop tag allows you to define additional informations on this host following the attribute/value schema. You may want to use it to give information to the tool you use for rendering your simulation, for example.
<b>host example</b>
\subsubsection pf_peer peer
A <b>peer</b> represents a peer, as in Peer-to-Peer (P2P). Basically, as cluster, <b>A PEER IS INTERNALLY INTERPRETED AS AN \<AS\></b>. It's just a kind of shortcut that does the following :
-\li It creates an host that has coordinates
+\li It creates an host
\li Two links : one for download and one for upload. This is convenient to use and simulate stuff under the last mile model (as ADSL peers).
+\li It creates a gateway that serve as entry point for this peer zone. This router has coordinates.
<b>peer</b> attributes :
\li <b>id (mandatory)</b>: the identifier of the peer to be used when referring to it.
-\li <b>power CDATA (mandatory)</b>:
-\li <b>bw_in CDATA (mandatory)</b>:
-\li <b>bw_out CDATA (mandatory)</b>:
-\li <b>lat CDATA (mandatory)</b>:
-\li <b>coordinates</b>:
+\li <b>power CDATA (mandatory)</b>: as in host
+\li <b>bw_in CDATA (mandatory)</b>: bandwidth in.
+\li <b>bw_out CDATA (mandatory)</b>:bandwidth out.
+\li <b>lat CDATA (mandatory)</b>: Latency for in and out links.
+\li <b>coordinates</b>: coordinates of the gateway for this peer.
\li <b>sharing_policy</b>: sharing policy for links. Can be SHARED or FULLDUPLEX, FULLDUPLEX is the default. See <b>link</b> description for details.
\li <b>availability_file</b>: availability file for the peer. Same as host availability file. See <b>host</b> description for details.
\li <b>state_file </b>: state file for the peer. Same as host state file. See <b>host</b> description for details.
at 100µs for one second.
<b>link</b> attributes :
-\li <b>id (mandatory)</b>: the identifier of the cluster to be used when referring to it.
+\li <b>id (mandatory)</b>: the identifier of the link to be used when referring to it.
\li <b>bandwidth (mandatory)</b>: bandwidth for the link.
\li <b>lat </b>: latency for the link. Default is 0.0.
\li <b>sharing_policy</b>: sharing policy for the link.
\subsection pf_storage Storage
+<b>Note : This is a prototype version that should evolve quickly, this is just some doc valuable only at the time of writing this doc</b>
+This section describes the storage management under SimGrid ; nowadays it's only usable with MSG. It relies basically on linux-like concepts. You also may want to have a look to its corresponding section in \ref m_file_management ; functions access are organized as a POSIX-like interface.
+
+\subsubsection pf_sto_conc Storage Main concepts
+Basically there is 3 different entities to know :
+\li the <b>storage_type</b>: here you define some kind of storage that you will instantiate many type on your platform. Think of it like a definition of throughput of a specific disk.
+\li the <b>storage</b>: instance of a <b>storage_type</b>. Defines a new storage of <b>storage_type</b>
+\li the <b>mount</b>: says that the storage is located into this specific resource.
+
+the content of a storage has to be defined in a content file that contains the content. The path to this file has to be passed within the <b>content</b> attribute . Here is a way to generate it:
+\verbatim
+find /path/you/want -type f -exec ls -l {} \; 2>/dev/null > ./content.txt
+\endverbatim
+
+\subsubsection pf_sto_sttp storage_type
+
+
+<b>storage_type</b> attributes :
+\li <b>id (mandatory)</b>: the identifier of the storage_type to be used when referring to it.
+\li <b>model (mandatory)</b>: Unused for now by the simulator (but mandatory, ok)
+\li <b>content</b>: default value 0. The file containing the disk content. (may be moved soon or later to <b>storage</b> tag.
+
+The tag must contains some predefined prop, as may do some other resources tags. This should moved to attributes soon or later.
+<b>storage_type</b> mandatory <b>prop</b> :
+\li <b>Bwrite</b>: value in B/s. Write throughput
+\li <b>Bread</b>: value in B/s. Read throughput
+\li <b>Bconnexion</b>: value in B/s. Connection throughput (i.e. the throughput of the storage connector).
+
+\subsubsection pf_sto_st storage
+
+<b>storage_type</b> attributes :
+\li <b>id (mandatory)</b>: the identifier of the storage to be used when referring to it.
+\li <b>typeId (mandatory)</b>: the identifier of the storage_type that this storage belongs to.
-At the time of writing this doc, a storage protoype has been implemented. While it is not stable, no doc for it, sorry.
+
+\subsubsection pf_sto_mo mount
+
+
+<b>mount</b> attributes :
+\li <b>id (mandatory)</b>: the id of the <b>storage</b> that must be mounted on that computer.
+\li <b>name (mandatory)</b>: the name that will be the logical reference to this disk (the mount point).
+
+\subsubsection pf_sto_mst mstorage
+<b>Note : unused for now</b>
+<b>mstorage</b> attributes :
+\li <b>typeId (mandatory)</b>: the id of the <b>storage</b> that must be mounted on that computer.
+\li <b>name (mandatory)</b>: the name that will be the logical reference to this disk (the mount point).
\section pf_routing Routing
-In order to run fast, it has been chosen to use static routing within SimGrid. By static, it means that it is calculated once, and will not change during execution. We chose to do that because it is rare to have a real deficience of a resource ; most of the time, a communication fails because the links are too overloaded, and so your connection stops before the time out, or because the computer at the other end is not answering.
+In order to run fast, it has been chosen to use static routing within SimGrid. By static, it means that it is calculated once (or almost), and will not change during execution. We chose to do that because it is rare to have a real deficience of a resource ; most of the time, a communication fails because the links are too overloaded, and so your connection stops before the time out, or because the computer at the other end is not answering.
We also chose to use shortests paths algorithms in order to emulate routing. Doing so is consistent with the reality: RIP, OSPF, BGP are all calculating shortest paths. They have some convergence time, but at the end, so when the platform is stable (and this should be the moment you want to simulate something using SimGrid) your packets will follow the shortest paths.
\subsubsection pf_rm_sh Shortest-path based models
Here is the complete list of such models, that computes routes using classic shortest-paths algorithms. How to choose the best suited algorithm is discussed later in the section devoted to it.
-\li <b>Floyd</b>: Floyd routing data
-\li <b>Dijkstra</b>: Dijkstra routing data
-\li <b>DijkstraCache</b>: Dijkstra routing data
+\li <b>Floyd</b>: Floyd routing data. Pre-calculates all routes once.
+\li <b>Dijkstra</b>: Dijkstra routing data ,calculating routes when necessary.
+\li <b>DijkstraCache</b>: Dijkstra routing data. Handle some cache for already calculated routes.
+
+All those shortest-path models are instanciated the same way. Here are some example of it:
Floyd example :
\verbatim
Dijsktra example :
\verbatim
-XXX?
+ <AS id="AS_2" routing="Dijsktra">
+ <host id="AS_2_host1" power="1000000000"/>
+ <host id="AS_2_host2" power="1000000000"/>
+ <host id="AS_2_host3" power="1000000000"/>
+ <link id="AS_2_link1" bandwidth="1250000000" latency="5E-4"/>
+ <link id="AS_2_link2" bandwidth="1250000000" latency="5E-4"/>
+ <link id="AS_2_link3" bandwidth="1250000000" latency="5E-4"/>
+ <link id="AS_2_link4" bandwidth="1250000000" latency="5E-4"/>
+ <router id="central_router"/>
+ <router id="AS_2_gateway"/>
+ <!-- routes providing topological information -->
+ <route src="central_router" dst="AS_2_host1"><link_ctn id="AS_2_link1"/></route>
+ <route src="central_router" dst="AS_2_host2"><link_ctn id="AS_2_link2"/></route>
+ <route src="central_router" dst="AS_2_host3"><link_ctn id="AS_2_link3"/></route>
+ <route src="central_router" dst="AS_2_gateway"><link_ctn id="AS_2_link4"/></route>
+ </AS>
\endverbatim
DijsktraCache example :
\verbatim
-XXX?
+<AS id="AS_2" routing="DijsktraCache">
+ <host id="AS_2_host1" power="1000000000"/>
+ ...
+(platform unchanged compared to upper example)
\endverbatim
\subsubsection pf_rm_me Manually-entered route models
</AS>
\endverbatim
-The example upper contains $1. Those $1 are evaluated as follow XXX?
+The example upper contains $1src and $1dst. It's simply a reference to string matching regexp enclosed by "()" within respectively <b>src</b> and <b>dst</b> attributes. If they were more than 1 "()", then you could referer to it as $2src, $3src and so on.
\subsubsection pf_rm_sf Simple/fast models
\li <b>none</b>: No routing (Unless you know what you are doing, avoid using this mode in combination with a non Constant network model).
None Example :
\verbatim
-XXX?
-\endverbatim
+<AS id="exitAS" routing="none">
+ <router id="exit_gateway"/>
+</AS>\endverbatim
\li <b>Vivaldi</b>: Vivaldi routing, so when you want to use coordinates. See the corresponding section P2P below for details.
\li <b>Cluster</b>: Cluster routing, specific to cluster tag, should not be used, except internally.
\subsection pb_baroex Basic Routing Example
-Let's say you have an AS named AS_Big that contains two other AS, AS_1 and AS_2. If you want to make an host (h1) from AS_1 with another one (h2) from AS_2 and you did not have choosen to use some routing model that compute routes automatically, then you'll have to proceed as follow:
+Let's say you have an AS named AS_Big that contains two other AS, AS_1 and AS_2. If you want to make an host (h1) from AS_1 with another one (h2) from AS_2 then you'll have to proceed as follow:
\li First, you have to ensure that a route is defined from h1 to the AS_1's exit gateway and from h2 to AS_2's exit gateway.
-\li Then, you'll have to define a route between AS_1 to AS_2. As those AS are both resources belonging to AS_Big, then it has to be done at AS_big level. To define such a route, you have to give the source AS (AS_1), the destination AS (AS_2), and their respective gateway (as the route is effectively defined between those two entry/exit points). Elements of this route can only be elements belonging to AS_Big, so links and routers in this route should be defined inside AS_Big.
+\li Then, you'll have to define a route between AS_1 to AS_2. As those AS are both resources belonging to AS_Big, then it has to be done at AS_big level. To define such a route, you have to give the source AS (AS_1), the destination AS (AS_2), and their respective gateway (as the route is effectively defined between those two entry/exit points). Elements of this route can only be elements belonging to AS_Big, so links and routers in this route should be defined inside AS_Big. If you choose some shortest-path model, this route will be computed automatically.
As said before, there are mainly 2 tags for routing :
\li <b>ASroute</b>: to define routes between two <b>AS</b>
\li <b>route</b>: to define routes between two <b>host/router</b>
-As we are dealing with routes between AS, it means that those we'll have some definition at AS_Big level. Let consider AS_1 and AS_2 contains 1 host, 1 link and one router.
+As we are dealing with routes between AS, it means that those we'll have some definition at AS_Big level. Let consider AS_1 contains 1 host, 1 link and one router and AS_2 3 hosts, 4 links and one router. There will be a central router, and a cross-like topology. At the end of the crosses arms, you'll find the 3 hosts and the router that will act as a gateway. We have to define routes inside those two AS. Let say that AS_1 contains full routes, and AS_2 contains some Floyd routing (as we don't want to bother with defining all routes). As we're using some shortest path algorithms to route into AS_2, we'll then have to define some <b>route</b> to gives some topological information to SimGrid. Here is a file doing it all :
+
+\verbatim
+<AS id="AS_Big" routing="Dijsktra">
+ <AS id="AS_1" routing="Full">
+ <host id="AS_1_host1" power="1000000000"/>
+ <link id="AS_1_link" bandwidth="1250000000" latency="5E-4"/>
+ <router id="AS_1_gateway"/>
+ <route src="AS_1_host1" dst="AS_1_gateway">
+ <link_ctn id="AS_1_link"/>
+ </route>
+ </AS>
+ <AS id="AS_2" routing="Floyd">
+ <host id="AS_2_host1" power="1000000000"/>
+ <host id="AS_2_host2" power="1000000000"/>
+ <host id="AS_2_host3" power="1000000000"/>
+ <link id="AS_2_link1" bandwidth="1250000000" latency="5E-4"/>
+ <link id="AS_2_link2" bandwidth="1250000000" latency="5E-4"/>
+ <link id="AS_2_link3" bandwidth="1250000000" latency="5E-4"/>
+ <link id="AS_2_link4" bandwidth="1250000000" latency="5E-4"/>
+ <router id="central_router"/>
+ <router id="AS_2_gateway"/>
+ <!-- routes providing topological information -->
+ <route src="central_router" dst="AS_2_host1"><link_ctn id="AS_2_link1"/></route>
+ <route src="central_router" dst="AS_2_host2"><link_ctn id="AS_2_link2"/></route>
+ <route src="central_router" dst="AS_2_host3"><link_ctn id="AS_2_link3"/></route>
+ <route src="central_router" dst="AS_2_gateway"><link_ctn id="AS_2_link4"/></route>
+ </AS>
+ <link id="backbone" bandwidth="1250000000" latency="5E-4"/>
+
+ <ASroute src="AS_1" dst="AS_2"
+ gw_src="AS_1_gateway"
+ gw_dst="AS_2_gateway">
+ <link_ctn id="backbone"/>
+ </ASroute>
+</AS>
+\endverbatim
\section pf_other_tags Tags not (directly) describing the platform
Choosing wisely the routing model to use can significantly fasten your simulation/save your time when writing the platform/save tremendeous disk space. Here is the list of available model and their characteristics (lookup : time to resolve a route):
\li <b>Full</b>: Full routing data (fast, large memory requirements, fully expressive)
-\li <b>Floyd</b>: Floyd routing data (slow initialization, fast lookup, lesser memory requirements, shortest path routing only)
-\li <b>Dijkstra</b>: Dijkstra routing data (fast initialization, slow lookup, small memory requirements, shortest path routing only)
-\li <b>DijkstraCache</b>: Dijkstra routing data (fast initialization, fast lookup, small memory requirements, shortest path routing only)
-\li <b>none</b>: No routing (usable with Constant network only)
-\li <b>RuleBased</b>: Rule-Based routing data (...)
+\li <b>Floyd</b>: Floyd routing data (slow initialization, fast lookup, lesser memory requirements, shortest path routing only). Calculates all routes at once at the beginning.
+\li <b>Dijkstra</b>: Dijkstra routing data (fast initialization, slow lookup, small memory requirements, shortest path routing only). Calculates a route when necessary.
+\li <b>DijkstraCache</b>: Dijkstra routing data (fast initialization, fast lookup, small memory requirements, shortest path routing only). Same as Dijkstra, except it handles a cache for latest used routes.
+\li <b>none</b>: No routing (usable with Constant network only). Defines that there is no routes, so if you try to determine a route without constant network within this AS, SimGrid will raie an exception.
+\li <b>RuleBased</b>: Rule-Based routing data (fast initialisation, relatively slow lookup, moderate memory requirements, fully expressive): uses regexp to define routes;
\li <b>Vivaldi</b>: Vivaldi routing, so when you want to use coordinates
\li <b>Cluster</b>: Cluster routing, specific to cluster tag, should not be used.
int host(int argc, char *argv[])
{
- m_file_t file;
+ msg_file_t file = NULL;
+ s_msg_stat_t stat;
+
char* mount = bprintf("C:");
size_t read,write;
if(!strcmp(MSG_process_get_name(MSG_process_self()),"0"))
read = MSG_file_read(mount,NULL,10000000,sizeof(char*),file); // Read for 10Mo
XBT_INFO("\tHaving read %Zu \ton %s",read,file->name);
-// res = MSG_file_stat(mount,0,NULL);
-// XBT_INFO("Host '%s' stat %d",MSG_host_get_name(MSG_host_self()), res);
+ MSG_file_stat(mount,file,&stat);
+ XBT_INFO("\tFile %s Size %d",file->name,(int)stat.size);
XBT_INFO("\tClose file '%s'",file->name);
MSG_file_close(mount,file);
<storage_type id="samsung" model="RAID5" content="content/storage_content.txt">
<prop id="Bwrite" value="30000000" /> <!-- 30Mo/s -->
<prop id="Bread" value="100000000" /> <!-- 100Mo/s -->
- <prop id="Bconnexion" value="6000000000" /> <!-- 6Go/s -->
+ <prop id="Bconnection" value="6000000000" /> <!-- 6Go/s -->
</storage_type>
<storage_type id="crucial" model="SSD" content="content/storage_content.txt">
<prop id="Bwrite" value="30000000" />
<prop id="Bread" value="100000000" />
- <prop id="Bconnexion" value="6000000000" />
+ <prop id="Bconnection" value="6000000000" />
</storage_type>
<storage_type id="wdigital" model="RAID0" content="content/storage_content.txt">
<prop id="Bwrite" value="30000000" />
<prop id="Bread" value="100000000" />
- <prop id="Bconnexion" value="6000000000" />
+ <prop id="Bconnection" value="6000000000" />
</storage_type>
<storage id="Disk1" typeId="crucial"/>
#ifndef MSG_DATATYPE_H
#define MSG_DATATYPE_H
#include "xbt/misc.h"
+#include "xbt/file_stat.h"
#include "simgrid_config.h" // for HAVE_TRACING
SG_BEGIN_DECL()
@{ */
typedef struct m_task *m_task_t;
+/* ******************************** File ************************************ */
+
+typedef struct simdata_file *simdata_file_t;
+
+/** @brief File datatype
+ @ingroup m_datatypes_management_details */
+typedef struct msg_file {
+ char *name; /**< @brief file name */
+ simdata_file_t simdata; /**< @brief simulator data */
+ void *data; /**< @brief user data */
+} s_msg_file_t;
+/** @brief File datatype
+ @ingroup m_datatypes_management_details */
+
+typedef struct msg_file *msg_file_t;
+
+typedef s_file_stat_t s_msg_stat_t, *msg_stat_t;
+
/*************** Begin GPU ***************/
typedef struct simdata_gpu_task *simdata_gpu_task_t;
/************************** File handling ***********************************/
-XBT_PUBLIC(size_t) MSG_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream);
-XBT_PUBLIC(size_t) MSG_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream);
-XBT_PUBLIC(m_file_t) MSG_file_open(const char* storage, const char* path, const char* mode);
-XBT_PUBLIC(int) MSG_file_close(const char* storage, m_file_t fp);
-XBT_PUBLIC(int) MSG_file_stat(const char* storage, int fd, void* buf);
+XBT_PUBLIC(size_t) MSG_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, msg_file_t stream);
+XBT_PUBLIC(size_t) MSG_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, msg_file_t stream);
+XBT_PUBLIC(msg_file_t) MSG_file_open(const char* storage, const char* path, const char* mode);
+XBT_PUBLIC(int) MSG_file_close(const char* storage, msg_file_t fp);
+XBT_PUBLIC(int) MSG_file_stat(const char* storage, msg_file_t fd, s_msg_stat_t *buf);
/************************** Host handling ***********************************/
typedef struct s_smx_timer* smx_timer_t;
-
/* ******************************** Synchro ************************************ */
typedef struct s_smx_mutex *smx_mutex_t;
typedef struct s_smx_cond *smx_cond_t;
typedef struct s_smx_sem *smx_sem_t;
+/********************************** File *************************************/
+typedef struct s_smx_file *smx_file_t;
+typedef struct s_smx_stat *smx_stat_t;
+
/********************************** Action *************************************/
typedef struct s_smx_action *smx_action_t; /* FIXME: replace by specialized action handlers */
#include "xbt/misc.h"
#include "xbt/fifo.h"
#include "xbt/dict.h"
+#include "xbt/file_stat.h"
#include "xbt/function_types.h"
#include "simix/datatypes.h"
#include "simix/context.h"
XBT_PUBLIC(unsigned int) simcall_sem_acquire_any(xbt_dynar_t sems);
XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
-XBT_PUBLIC(size_t) simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream);
-XBT_PUBLIC(size_t) simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream);
-XBT_PUBLIC(m_file_t) simcall_file_open(const char* storage, const char* path, const char* mode);
-XBT_PUBLIC(int) simcall_file_close(const char* storage, m_file_t fp);
-XBT_PUBLIC(int) simcall_file_stat(const char* storage, int fd, void* buf);
+XBT_PUBLIC(size_t) simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream);
+XBT_PUBLIC(size_t) simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream);
+XBT_PUBLIC(smx_file_t) simcall_file_open(const char* storage, const char* path, const char* mode);
+XBT_PUBLIC(int) simcall_file_close(const char* storage, smx_file_t fp);
+XBT_PUBLIC(int) simcall_file_stat(const char* storage, smx_file_t fd, s_file_stat_t *buf);
SG_END_DECL()
#endif /* _SIMIX_SIMIX_H */
--- /dev/null
+/*
+ * file_stat.h
+ *
+ * Created on: 3 avr. 2012
+ * Author: navarro
+ */
+
+#ifndef _FILE_STAT_H
+#define _FILE_STAT_H
+
+#include "xbt/sysdep.h"
+
+typedef struct file_stat {
+ char *user_rights;
+ char *user;
+ char *group;
+ char *date; /* FIXME: update to time_t or double */
+ char *time; /* FIXME: update to time_t or double */
+ size_t size;
+} s_file_stat_t, *file_stat_t;
+
+static XBT_INLINE void file_stat_copy(s_file_stat_t *src, s_file_stat_t *dst)
+{
+ dst->date = xbt_strdup(src->date);
+ dst->group = xbt_strdup(src->group);
+ dst->size = src->size;
+ dst->time = xbt_strdup(src->time);
+ dst->user = xbt_strdup(src->user);
+ dst->user_rights = xbt_strdup(src->user_rights);
+}
+
+#endif /* _FILE_STAT_H */
#define TRUE 1
#define FALSE 0
-#define XBT_MAX_CHANNEL 10 /* FIXME: killme */
/*! C++ users need love */
#ifndef SG_BEGIN_DECL
# ifdef __cplusplus
#define XBT_BACKTRACE_SIZE 10 /* FIXME: better place? Do document */
-/** @brief File datatype
- @ingroup m_datatypes_management_details */
-typedef struct m_file {
- char *name; /**< @brief file name */
- void *content; /**< @brief user data */
-} s_m_file_t;
-/** @brief File datatype
- @ingroup m_datatypes_management_details */
-typedef struct m_file *m_file_t;
-
-
SG_END_DECL()
#endif /* XBT_MISC_H */
* It is represented as a cost, a priority, a duration and a state.
*/
typedef struct surf_action *surf_action_t;
-
+typedef struct surf_file *surf_file_t;
+typedef struct surf_stat *surf_stat_t;
typedef struct lmm_element *lmm_element_t;
typedef struct lmm_variable *lmm_variable_t;
#include "xbt/dynar.h"
#include "xbt/dict.h"
#include "xbt/misc.h"
+#include "xbt/file_stat.h"
#include "portable.h"
#include "xbt/config.h"
#include "surf/datatypes.h"
#ifdef HAVE_TRACING
char *category; /**< tracing category for categorized resource utilization monitoring */
#endif
- void* file; /**< m_file_t for storage model */
- size_t read_write;
+ surf_file_t file; /**< surf_file_t for storage model */
+ s_file_stat_t stat; /**< surf_file_t for storage model */
} s_surf_action_t;
typedef struct surf_action_lmm {
typedef struct surf_storage_model_extension_public {
surf_action_t(*open) (void *storage, const char* path, const char* mode);
- surf_action_t(*close) (void *storage, m_file_t fp);
- surf_action_t(*read) (void *storage, void* ptr, size_t size, size_t nmemb, m_file_t stream);
- surf_action_t(*write) (void *storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream);
- surf_action_t(*stat) (void *storage, int fd, void* buf);
+ surf_action_t(*close) (void *storage, surf_file_t fp);
+ surf_action_t(*read) (void *storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+ surf_action_t(*write) (void *storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+ surf_action_t(*stat) (void *storage, surf_file_t stream);
void* (*create_resource) (const char* id, const char* model,const char* type_id);
} s_surf_model_extension_storage_t;
double (*get_link_bandwidth) (const void *link); /**< Return the current bandwidth of a network link */
double (*get_link_latency) (const void *link); /**< Return the current latency of a network link */
surf_action_t(*open) (void *workstation, const char* storage, const char* path, const char* mode);
- surf_action_t(*close) (void *workstation, const char* storage, m_file_t fp);
- surf_action_t(*read) (void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream);
- surf_action_t(*write) (void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream);
- surf_action_t(*stat) (void *workstation, const char* storage, int fd, void* buf);
+ surf_action_t(*close) (void *workstation, const char* storage, surf_file_t fp);
+ surf_action_t(*read) (void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+ surf_action_t(*write) (void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+ surf_action_t(*stat) (void *workstation, const char* storage, surf_file_t stream);
int (*link_shared) (const void *link);
xbt_dict_t(*get_properties) (const void *resource);
void* (*link_create_resource) (const char *name,
xbt_dict_t properties;
} s_surf_resource_t, *surf_resource_t;
-/**
- * Storage struct
- */
-typedef struct s_storage_type {
- char *model;
- xbt_dict_t content;
- char *type_id;
- xbt_dict_t properties;
-} s_storage_type_t, *storage_type_t;
-
-typedef struct s_mount {
- void *id;
- char *name;
-} s_mount_t, *mount_t;
-
-typedef struct s_content {
- char *user_rights;
- char *user;
- char *group;
- char *date;
- char *time;
- size_t size;
-} s_content_t, *content_t;
-
/**
* Resource which have a metric handled by a maxmin system
*/
res->properties = props;
return res;
}
-static XBT_INLINE void routing_storage_type_free(void *r)
-{
- storage_type_t stype = r;
- free(stype->model);
- free(stype->type_id);
- xbt_dict_free(&(stype->properties));
- xbt_dict_free(&(stype->content));
- free(stype);
-}
-
-static XBT_INLINE void routing_storage_host_free(void *r)
-{
- xbt_dynar_t dyn = r;
- xbt_dynar_free(&dyn);
-}
static XBT_INLINE void surf_resource_free(void *r)
{
NULL, NULL);
/* tracing buffer */
- int default_buffer = 0;
+ int default_buffer = 1;
xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_BUFFER,
"Buffer trace events to put them in temporal order.",
xbt_cfgelm_int, &default_buffer, 0, 1,
//create new container on the new_host location
msg = PJ_container_new(instr_process_id(process, str, len), INSTR_MSG_PROCESS, PJ_container_get(new_host->name));
- //set the state of this new container
- type = PJ_type_get ("MSG_PROCESS_STATE", msg->type);
- val_t value = PJ_value_get ("executing", type);
- new_pajeSetState (MSG_get_clock(), msg, type, value);
-
//end link
msg = PJ_container_get(instr_process_id(process, str, len));
type = PJ_type_get ("MSG_PROCESS_LINK", PJ_type_get_root());
char str[INSTR_DEFAULT_STR_SIZE];
container_t host_container = PJ_container_get (host->name);
- container_t msg = PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), INSTR_MSG_PROCESS, host_container);
-
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", msg->type);
- val_t value = PJ_value_get ("executing", type);
- new_pajeSetState (MSG_get_clock(), msg, type, value);
+ PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), INSTR_MSG_PROCESS, host_container);
}
}
if (msg_process == NULL){
msg_process = PJ_type_container_new("MSG_PROCESS", new->type);
type_t state = PJ_type_state_new ("MSG_PROCESS_STATE", msg_process);
- PJ_value_new ("executing", "0 1 0", state);
PJ_value_new ("suspend", "1 0 1", state);
PJ_value_new ("sleep", "1 1 0", state);
PJ_value_new ("receive", "1 0 0", state);
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "msg_private.h"
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_io, simix,
+ "Logging specific to MSG (io)");
/** @addtogroup m_file_management
* \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="File" --> \endhtmlonly
- * (#m_file_t) and the functions for managing it.
+ * (#msg_file_t) and the functions for managing it.
*
- * \see #m_file_t
+ * \see #msg_file_t
*/
/********************************* File **************************************/
* \param stream to read
* \return the number of items successfully read
*/
-size_t MSG_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream)
+size_t MSG_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, msg_file_t stream)
{
- return simcall_file_read(storage, ptr, size, nmemb, (m_file_t)stream);
+ return simcall_file_read(storage, ptr, size, nmemb, stream->simdata->smx_file);
}
/** \ingroup m_file_management
* \param stream to write
* \return the number of items successfully write
*/
-size_t MSG_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream)
+size_t MSG_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, msg_file_t stream)
{
- return simcall_file_write(storage, ptr, size, nmemb, (m_file_t)stream);
+ return simcall_file_write(storage, ptr, size, nmemb, stream->simdata->smx_file);
}
/** \ingroup m_file_management
* a+ Open for reading and appending (writing at end of file). The file is created if it does not exist. The initial file position for reading
* is at the beginning of the file, but output is always appended to the end of the file.
*
- * \return An #m_file_t associated to the file
+ * \return An #msg_file_t associated to the file
*/
-m_file_t MSG_file_open(const char* storage, const char* path, const char* mode)
+msg_file_t MSG_file_open(const char* storage, const char* path, const char* mode)
{
- return (m_file_t) simcall_file_open(storage, path, mode);
+ msg_file_t file = xbt_new(s_msg_file_t,1);
+ file->name = strdup(path);
+ file->simdata = xbt_new0(s_simdata_file_t,1);
+ file->simdata->smx_file = simcall_file_open(storage, path, mode);
+ return file;
}
/** \ingroup m_file_management
* \param fp is the file to close
* \return 0 on success or 1 on error
*/
-int MSG_file_close(const char* storage, m_file_t fp)
+int MSG_file_close(const char* storage, msg_file_t fp)
{
- return simcall_file_close(storage, (m_file_t)fp);
+ return simcall_file_close(storage, fp->simdata->smx_file);
}
/** \ingroup m_file_management
* \brief Stats the file pointed by fd
*
* \param storage is the name where find the stream
- * \param fd is the file descriptor
+ * \param fd is the file descriptor (#msg_file_t)
* \param buf is the return structure with informations
* \return 0 on success or 1 on error
*/
-int MSG_file_stat(const char* storage, int fd, void* buf)
+int MSG_file_stat(const char* storage, msg_file_t fd, s_msg_stat_t *buf)
{
- return simcall_file_stat(storage, fd, buf);
+ int res;
+ res = simcall_file_stat(storage, fd->simdata->smx_file, buf);
+ return res;
}
double *comm_amount;
} s_simdata_task_t;
+/********************************* File **************************************/
+typedef struct simdata_file {
+ smx_file_t smx_file;
+} s_simdata_file_t;
/*************** Begin GPU ***************/
typedef struct simdata_gpu_task {
simcall->file_read.stream);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
- simcall->file_read.result = (action->io.surf_io)->read_write;
}
-smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream)
+smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream)
{
smx_action_t action;
smx_host_t host = process->smx_host;
#endif
action->io.host = host;
- action->io.surf_io = surf_workstation_model->extension.workstation.read(host->host, storage, ptr, size, nmemb, stream),
+ action->io.surf_io = surf_workstation_model->extension.workstation.read(host->host, storage, ptr, size, nmemb, stream->surf_file),
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
simcall->file_write.stream);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
- simcall->file_write.result = (action->io.surf_io)->read_write;
}
-smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream)
+smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream)
{
smx_action_t action;
smx_host_t host = process->smx_host;
#endif
action->io.host = host;
- action->io.surf_io = surf_workstation_model->extension.workstation.write(host->host, storage, ptr, size, nmemb, stream);
+ action->io.surf_io = surf_workstation_model->extension.workstation.write(host->host, storage, ptr, size, nmemb, stream->surf_file);
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
simcall->file_open.mode);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
- simcall->file_open.result = (action->io.surf_io)->file;
}
smx_action_t SIMIX_file_open(smx_process_t process ,const char* storage, const char* path, const char* mode)
simcall->file_close.fp);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
- simcall->file_close.result = 0;
}
-smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, m_file_t fp)
+smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, smx_file_t fp)
{
smx_action_t action;
smx_host_t host = process->smx_host;
#endif
action->io.host = host;
- action->io.surf_io = surf_workstation_model->extension.workstation.close(host->host, storage, fp);
+ action->io.surf_io = surf_workstation_model->extension.workstation.close(host->host, storage, fp->surf_file);
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
simcall->file_stat.buf);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
- simcall->file_stat.result = 0;
}
-smx_action_t SIMIX_file_stat(smx_process_t process ,const char* storage, int fd, void* buf)
+smx_action_t SIMIX_file_stat(smx_process_t process ,const char* storage, smx_file_t fd, s_file_stat_t buf)
{
smx_action_t action;
smx_host_t host = process->smx_host;
-
/* check if the host is active */
if (surf_workstation_model->extension.
workstation.get_state(host->host) != SURF_RESOURCE_ON) {
#endif
action->io.host = host;
- action->io.surf_io = surf_workstation_model->extension.workstation.stat(host->host, storage, fd, buf);
+ action->io.surf_io = surf_workstation_model->extension.workstation.stat(host->host, storage, fd->surf_file);
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
void SIMIX_post_io(smx_action_t action)
{
+ xbt_fifo_item_t i;
+ smx_simcall_t simcall;
+
+ xbt_fifo_foreach(action->simcalls,i,simcall,smx_simcall_t) {
+ switch (simcall->call) {
+ case SIMCALL_FILE_OPEN:
+ simcall->file_open.result = xbt_new(s_smx_file_t,1);
+ simcall->file_open.result->surf_file = (action->io.surf_io)->file;
+ break;
+ case SIMCALL_FILE_CLOSE:
+ simcall->file_read.result = 0;
+ break;
+ case SIMCALL_FILE_WRITE:
+ simcall->file_write.result = (action->io.surf_io)->cost;
+ break;
+ case SIMCALL_FILE_READ:
+ simcall->file_read.result = (action->io.surf_io)->cost;
+ break;
+ case SIMCALL_FILE_STAT:
+ simcall->file_stat.result = 0;
+ s_file_stat_t *dst = &(simcall->file_stat.buf);
+ s_file_stat_t *src = &((action->io.surf_io)->stat);
+ file_stat_copy(src,dst);
+ break;
+ default:
+ break;
+ }
+ }
+
switch (surf_workstation_model->action_state_get(action->io.surf_io)) {
case SURF_ACTION_FAILED:
void SIMIX_pre_file_close(smx_simcall_t simcall);
void SIMIX_pre_file_stat(smx_simcall_t simcall);
-smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream);
-smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream);
+smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream);
+smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream);
smx_action_t SIMIX_file_open(smx_process_t process, const char* storage, const char* path, const char* mode);
-smx_action_t SIMIX_file_close(smx_process_t process, const char* storage, m_file_t fp);
-smx_action_t SIMIX_file_stat(smx_process_t process, const char* storage, int fd, void* buf);
+smx_action_t SIMIX_file_close(smx_process_t process, const char* storage, smx_file_t fp);
+smx_action_t SIMIX_file_stat(smx_process_t process, const char* storage, smx_file_t fd, s_file_stat_t buf);
void SIMIX_post_io(smx_action_t action);
void SIMIX_io_destroy(smx_action_t action);
#define SMX_THROW() RETHROW
+/* ******************************** File ************************************ */
+typedef struct s_smx_file {
+ surf_file_t surf_file;
+} s_smx_file_t;
+
+typedef struct s_smx_stat {
+ s_file_stat_t surf_stat;
+} s_smx_stat_t, *smx_stat_t;
+
/*********************************** Time ************************************/
/** @brief Timer datatype */
SIMIX_COMM_DONE
} e_smx_comm_type_t;
+typedef enum {
+ SIMIX_IO_OPEN,
+ SIMIX_IO_WRITE,
+ SIMIX_IO_READ,
+ SIMIX_IO_STAT
+} e_smx_io_type_t;
+
/** @brief Action datatype */
typedef struct s_smx_action {
void *ptr;
size_t size;
size_t nmemb;
- m_file_t stream;
+ smx_file_t stream;
size_t result;
} file_read;
const void *ptr;
size_t size;
size_t nmemb;
- m_file_t stream;
+ smx_file_t stream;
size_t result;
} file_write;
const char* storage;
const char* path;
const char* mode;
- m_file_t result;
+ smx_file_t result;
} file_open;
struct {
const char* storage;
- m_file_t fp;
+ smx_file_t fp;
int result;
} file_close;
struct {
const char* storage;
- int fd;
- //Next should be struct stat* buf
- void* buf;
+ smx_file_t fd;
+ s_file_stat_t buf;
int result;
} file_stat;
return simcall->sem_get_capacity.result;
}
-size_t simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream)
+size_t simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream)
{
smx_simcall_t simcall = SIMIX_simcall_mine();
return simcall->file_read.result;
}
-size_t simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream)
+size_t simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream)
{
smx_simcall_t simcall = SIMIX_simcall_mine();
return simcall->file_write.result;
}
-m_file_t simcall_file_open(const char* storage, const char* path, const char* mode)
+smx_file_t simcall_file_open(const char* storage, const char* path, const char* mode)
{
smx_simcall_t simcall = SIMIX_simcall_mine();
return simcall->file_open.result;
}
-int simcall_file_close(const char* storage, m_file_t fp)
+int simcall_file_close(const char* storage, smx_file_t fp)
{
smx_simcall_t simcall = SIMIX_simcall_mine();
return simcall->file_close.result;
}
-int simcall_file_stat(const char* storage, int fd, void* buf)
+int simcall_file_stat(const char* storage, smx_file_t fd, s_file_stat_t *buf)
{
smx_simcall_t simcall = SIMIX_simcall_mine();
-
simcall->call = SIMCALL_FILE_STAT;
simcall->file_stat.storage = storage;
simcall->file_stat.fd = fd;
- simcall->file_stat.buf = buf;
+
SIMIX_simcall_push(simcall->issuer);
+ *buf = simcall->file_stat.buf;
+
return simcall->file_stat.result;
}
#define make_elem_active(elem) xbt_swag_insert_at_head(elem,&(elem->constraint->active_element_set))
#define make_elem_inactive(elem) xbt_swag_remove(elem,&(elem->constraint->active_element_set))
+//typedef struct lmm_constraint_light {
+// double remaining_over_usage;
+// lmm_constraint_t cnst;
+//} s_lmm_constraint_light_t;
+
typedef struct lmm_constraint {
/* hookup to system */
s_xbt_swag_hookup_t constraint_set_hookup;
s_xbt_swag_t element_set; /* a list of lmm_element_t */
s_xbt_swag_t active_element_set; /* a list of lmm_element_t */
- double bound;
- double lambda;
- double new_lambda;
double remaining;
double usage;
+ double bound;
+ int shared;
void *id;
int id_int;
- int shared;
+ double lambda;
+ double new_lambda;
} s_lmm_constraint_t;
typedef struct lmm_variable {
#include "xbt/ex.h"
#include "xbt/dict.h"
+#include "xbt/file_stat.h"
#include "portable.h"
#include "surf_private.h"
#include "storage_private.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf,
"Logging specific to the SURF storage module");
+xbt_lib_t storage_lib;
+int ROUTING_STORAGE_LEVEL; //Routing for storagelevel
+int ROUTING_STORAGE_HOST_LEVEL;
+int SURF_STORAGE_LEVEL;
+xbt_lib_t storage_type_lib;
+int ROUTING_STORAGE_TYPE_LEVEL; //Routing for storage_type level
+
+xbt_dynar_t mount_list = NULL; /* temporary store of current mount storage */
+
surf_model_t surf_storage_model = NULL;
lmm_system_t storage_maxmin_system = NULL;
static int storage_selective_update = 0;
#define GENERIC_LMM_ACTION(action) action->generic_lmm_action
#define GENERIC_ACTION(action) GENERIC_LMM_ACTION(action).generic_action
-typedef enum {
- READ = 0,
- WRITE = 1,
- DEFAULT = 2
-} STORAGE_execute_type_t;
-
typedef struct surf_storage {
s_surf_resource_t generic_resource;
const char* type;
} s_surf_storage_t, *surf_storage_t;
static void storage_action_state_set(surf_action_t action, e_surf_action_state_t state);
-static surf_action_t storage_action_sleep (void *storage, double duration);
-static surf_action_t storage_action_execute (void *storage, size_t size, STORAGE_execute_type_t type);
+static surf_action_t storage_action_execute (void *storage, size_t size, e_surf_action_storage_type_t type);
+
+static surf_action_t storage_action_stat(void *storage, surf_file_t stream)
+{
+ surf_action_t action = storage_action_execute(storage,0, STAT);
+ action->file = stream;
+ action->stat = stream->content->stat;
+ return action;
+}
static surf_action_t storage_action_open(void *storage, const char* path, const char* mode)
{
ROUTING_STORAGE_LEVEL);
storage_type_t storage_type = xbt_lib_get_or_null(storage_type_lib, storage_type_id,ROUTING_STORAGE_TYPE_LEVEL);
xbt_dict_t content_dict = storage_type->content;
- content_t content = xbt_dict_get(content_dict,path);
+ surf_stat_t content = xbt_dict_get(content_dict,path);
- m_file_t file = xbt_new0(s_m_file_t,1);
+ surf_file_t file = xbt_new0(s_surf_file_t,1);
file->name = xbt_strdup(path);
file->content = content;
- surf_action_t action = storage_action_execute(storage,0, DEFAULT);
+ surf_action_t action = storage_action_execute(storage,0, OPEN);
action->file = (void *)file;
return action;
}
-static surf_action_t storage_action_close(void *storage, m_file_t fp)
+static surf_action_t storage_action_close(void *storage, surf_file_t fp)
{
char *filename = fp->name;
free(fp->name);
fp->content = NULL;
xbt_free(fp);
- surf_action_t action = storage_action_execute(storage,0, DEFAULT);
+ surf_action_t action = storage_action_execute(storage,0, CLOSE);
XBT_DEBUG("\tClose file '%s'",filename);
return action;
}
-static surf_action_t storage_action_read(void *storage, void* ptr, size_t size, size_t nmemb, m_file_t stream)
+static surf_action_t storage_action_read(void *storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream)
{
char *filename = stream->name;
- content_t content = (content_t)(stream->content);
- XBT_DEBUG("\tRead file '%s' size '%Zu/%Zu'",filename,size,content->size);
- if(size > content->size)
- size = content->size;
+ surf_stat_t content = stream->content;
+ XBT_DEBUG("\tRead file '%s' size '%Zu/%Zu'",filename,size,content->stat.size);
+ if(size > content->stat.size)
+ size = content->stat.size;
surf_action_t action = storage_action_execute(storage,size,READ);
- action->read_write = size;
return action;
}
-static surf_action_t storage_action_write(void *storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream)
+static surf_action_t storage_action_write(void *storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)
{
char *filename = stream->name;
- content_t content = (content_t)(stream->content);
- XBT_DEBUG("\tWrite file '%s' size '%Zu/%Zu'",filename,size,content->size);
+ surf_stat_t content = stream->content;
+ XBT_DEBUG("\tWrite file '%s' size '%Zu/%Zu'",filename,size,content->stat.size);
surf_action_t action = storage_action_execute(storage,size,WRITE);
- action->read_write = size;
- content->size += size;
+ content->stat.size += size;
return action;
}
-static surf_action_t storage_action_stat(void *storage, int fd, void* buf)
-{
- THROW_UNIMPLEMENTED;
- return NULL;
-}
-
-static surf_action_t storage_action_execute (void *storage, size_t size, STORAGE_execute_type_t type)
+static surf_action_t storage_action_execute (void *storage, size_t size, e_surf_action_storage_type_t type)
{
surf_action_storage_t action = NULL;
storage_t STORAGE = storage;
GENERIC_LMM_ACTION(action).variable =
lmm_variable_new(storage_maxmin_system, action, 1.0, -1.0 , 3);
- if(type == DEFAULT)
- lmm_expand(storage_maxmin_system, STORAGE->constraint,
- GENERIC_LMM_ACTION(action).variable, 1.0);
- else if(type == READ)
+ switch(type) {
+ case OPEN:
+ case CLOSE:
+ case STAT:
+ lmm_expand(storage_maxmin_system, STORAGE->constraint,
+ GENERIC_LMM_ACTION(action).variable, 1.0);
+ break;
+ case READ:
lmm_expand(storage_maxmin_system, STORAGE->constraint_read,
GENERIC_LMM_ACTION(action).variable, 1.0);
- else if(type == WRITE)
+ break;
+ case WRITE:
lmm_expand(storage_maxmin_system, STORAGE->constraint_write,
GENERIC_LMM_ACTION(action).variable, 1.0);
- else xbt_die("storage_action_execute with type '%d'",(int) type);
-
- XBT_OUT();
- return (surf_action_t) action;
-}
-
-static surf_action_t storage_action_sleep (void *storage, double duration)
-{
- surf_action_storage_t action = NULL;
-
- if (duration > 0)
- duration = MAX(duration, MAXMIN_PRECISION);
-
- XBT_IN("(%s,%g)", surf_resource_name(storage), duration);
- action = (surf_action_storage_t) storage_action_execute(storage, 1.0, DEFAULT);
- GENERIC_ACTION(action).max_duration = duration;
- GENERIC_LMM_ACTION(action).suspended = 2;
- if (duration == NO_MAX_DURATION) {
- /* Move to the *end* of the corresponding action set. This convention
- is used to speed up update_resource_state */
- xbt_swag_remove(action, ((surf_action_t) action)->state_set);
- ((surf_action_t) action)->state_set =
- storage_running_action_set_that_does_not_need_being_checked;
- xbt_swag_insert(action, ((surf_action_t) action)->state_set);
+ break;
}
- lmm_update_variable_weight(storage_maxmin_system,
- GENERIC_LMM_ACTION(action).variable, 0.0);
-
XBT_OUT();
return (surf_action_t) action;
}
storage_type_t storage_type = xbt_lib_get_or_null(storage_type_lib, type_id,ROUTING_STORAGE_TYPE_LEVEL);
size_t Bread = atof(xbt_dict_get(storage_type->properties,"Bread"));
size_t Bwrite = atof(xbt_dict_get(storage_type->properties,"Bwrite"));
- size_t Bconnexion = atof(xbt_dict_get(storage_type->properties,"Bconnexion"));
- XBT_INFO("Create resource with Bconnexion '%Zu' Bread '%Zu' Bwrite '%Zu'",Bconnexion,Bread,Bwrite);
- storage->constraint = lmm_constraint_new(storage_maxmin_system, storage, Bconnexion);
+ size_t Bconnection = atof(xbt_dict_get(storage_type->properties,"Bconnection"));
+ XBT_INFO("Create resource with Bconnection '%Zu' Bread '%Zu' Bwrite '%Zu'",Bconnection,Bread,Bwrite);
+ storage->constraint = lmm_constraint_new(storage_maxmin_system, storage, Bconnection);
storage->constraint_read = lmm_constraint_new(storage_maxmin_system, storage, Bread);
storage->constraint_write = lmm_constraint_new(storage_maxmin_system, storage, Bwrite);
surf_action_storage_t action = NULL;
surf_action_storage_t next_action = NULL;
xbt_swag_t running_actions = surf_storage_model->states.running_action_set;
- xbt_swag_foreach_safe(action, next_action, running_actions) {
+ xbt_swag_foreach_safe(action, next_action, running_actions) {
double_update(&(GENERIC_ACTION(action).remains),
lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable) * delta);
if (GENERIC_LMM_ACTION(action).generic_action.max_duration != NO_MAX_DURATION)
xbt_dynar_push(model_list, &surf_storage_model);
}
+
+static void storage_parse_storage(sg_platf_storage_cbarg_t storage)
+{
+ xbt_assert(!xbt_lib_get_or_null(storage_lib, storage->id,ROUTING_STORAGE_LEVEL),
+ "Reading a storage, processing unit \"%s\" already exists", storage->id);
+
+ // Verification of an existing type_id
+#ifndef NDEBUG
+ void* storage_type = xbt_lib_get_or_null(storage_type_lib, storage->type_id,ROUTING_STORAGE_TYPE_LEVEL);
+#endif
+ xbt_assert(storage_type,"Reading a storage, type id \"%s\" does not exists", storage->type_id);
+
+ XBT_DEBUG("ROUTING Create a storage name '%s' with type_id '%s'",
+ storage->id,
+ storage->type_id);
+
+ xbt_lib_set(storage_lib,
+ storage->id,
+ ROUTING_STORAGE_LEVEL,
+ (void *) xbt_strdup(storage->type_id));
+}
+
+static void free_storage_content(void *p)
+{
+ surf_stat_t content = p;
+ free(content->stat.date);
+ free(content->stat.group);
+ free(content->stat.time);
+ free(content->stat.user);
+ free(content->stat.user_rights);
+ free(content);
+}
+
+static xbt_dict_t parse_storage_content(const char *filename)
+{
+ if ((!filename) || (strcmp(filename, "") == 0))
+ return NULL;
+
+ xbt_dict_t parse_content = xbt_dict_new_homogeneous(free_storage_content);
+ FILE *file = NULL;
+
+ file = surf_fopen(filename, "r");
+ xbt_assert(file != NULL, "Cannot open file '%s' (path=%s)", filename,
+ xbt_str_join(surf_path, ":"));
+
+ char *line = NULL;
+ size_t len = 0;
+ ssize_t read;
+ char user_rights[12];
+ char user[100];
+ char group[100];
+ char date[12];
+ char time[12];
+ char path[1024];
+ int nb, size;
+
+ surf_stat_t content;
+
+ while ((read = getline(&line, &len, file)) != -1) {
+ content = xbt_new0(s_surf_stat_t,1);
+ if(sscanf(line,"%s %d %s %s %d %s %s %s",user_rights,&nb,user,group,&size,date,time,path)==8) {
+ content->stat.date = xbt_strdup(date);
+ content->stat.group = xbt_strdup(group);
+ content->stat.size = size;
+ content->stat.time = xbt_strdup(time);
+ content->stat.user = xbt_strdup(user);
+ content->stat.user_rights = xbt_strdup(user_rights);
+ xbt_dict_set(parse_content,path,content,NULL);
+ } else {
+ xbt_die("Be sure of passing a good format for content file.\n");
+ // You can generate this kind of file with command line:
+ // find /path/you/want -type f -exec ls -l {} \; 2>/dev/null > ./content.txt
+ }
+ }
+ if (line)
+ free(line);
+
+ fclose(file);
+ return parse_content;
+}
+
+static void storage_parse_storage_type(sg_platf_storage_type_cbarg_t storage_type)
+{
+ xbt_assert(!xbt_lib_get_or_null(storage_type_lib, storage_type->id,ROUTING_STORAGE_TYPE_LEVEL),
+ "Reading a storage type, processing unit \"%s\" already exists", storage_type->id);
+
+ storage_type_t stype = xbt_new0(s_storage_type_t, 1);
+ stype->model = xbt_strdup(storage_type->model);
+ stype->properties = storage_type->properties;
+ stype->content = parse_storage_content(storage_type->content);
+ stype->type_id = xbt_strdup(storage_type->id);
+
+ XBT_DEBUG("ROUTING Create a storage type id '%s' with model '%s' content '%s' and properties '%p'",
+ stype->type_id,
+ stype->model,
+ storage_type->content,
+ stype->properties);
+
+ xbt_lib_set(storage_type_lib,
+ stype->type_id,
+ ROUTING_STORAGE_TYPE_LEVEL,
+ (void *) stype);
+}
+static void storage_parse_mstorage(sg_platf_mstorage_cbarg_t mstorage)
+{
+ THROW_UNIMPLEMENTED;
+// mount_t mnt = xbt_new0(s_mount_t, 1);
+// mnt->id = xbt_strdup(mstorage->type_id);
+// mnt->name = xbt_strdup(mstorage->name);
+//
+// if(!mount_list){
+// XBT_DEBUG("Creata a Mount list for %s",A_surfxml_host_id);
+// mount_list = xbt_dynar_new(sizeof(char *), NULL);
+// }
+// xbt_dynar_push(mount_list,(void *) mnt);
+// free(mnt->id);
+// free(mnt->name);
+// xbt_free(mnt);
+// XBT_DEBUG("ROUTING Mount a storage name '%s' with type_id '%s'",mstorage->name, mstorage->id);
+}
+
+static void mount_free(void *p)
+{
+ mount_t mnt = p;
+ xbt_free(mnt->name);
+}
+
+static void storage_parse_mount(sg_platf_mount_cbarg_t mount)
+{
+ // Verification of an existing storage
+#ifndef NDEBUG
+ void* storage = xbt_lib_get_or_null(storage_lib, mount->id,ROUTING_STORAGE_LEVEL);
+#endif
+ xbt_assert(storage,"Disk id \"%s\" does not exists", mount->id);
+
+ XBT_DEBUG("ROUTING Mount '%s' on '%s'",mount->id, mount->name);
+
+ s_mount_t mnt;
+ mnt.id = surf_storage_resource_by_name(mount->id);
+ mnt.name = xbt_strdup(mount->name);
+
+ if(!mount_list){
+ XBT_DEBUG("Create a Mount list for %s",A_surfxml_host_id);
+ mount_list = xbt_dynar_new(sizeof(s_mount_t), mount_free);
+ }
+ xbt_dynar_push(mount_list,&mnt);
+}
+
+static XBT_INLINE void routing_storage_type_free(void *r)
+{
+ storage_type_t stype = r;
+ free(stype->model);
+ free(stype->type_id);
+ xbt_dict_free(&(stype->properties));
+ xbt_dict_free(&(stype->content));
+ free(stype);
+}
+
+static XBT_INLINE void routing_storage_host_free(void *r)
+{
+ xbt_dynar_t dyn = r;
+ xbt_dynar_free(&dyn);
+}
+
+void storage_register_callbacks() {
+
+ ROUTING_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,xbt_free);
+ ROUTING_STORAGE_HOST_LEVEL = xbt_lib_add_level(storage_lib,routing_storage_host_free);
+ ROUTING_STORAGE_TYPE_LEVEL = xbt_lib_add_level(storage_type_lib,routing_storage_type_free);
+ SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,surf_resource_free);
+
+ sg_platf_storage_add_cb(storage_parse_storage);
+ sg_platf_mstorage_add_cb(storage_parse_mstorage);
+ sg_platf_storage_type_add_cb(storage_parse_storage_type);
+ sg_platf_mount_add_cb(storage_parse_mount);
+}
#ifndef STORAGE_PRIVATE_H_
#define STORAGE_PRIVATE_H_
+typedef struct s_storage_type {
+ char *model;
+ xbt_dict_t content; /* char * -> s_surf_stat_t */
+ char *type_id;
+ xbt_dict_t properties;
+} s_storage_type_t, *storage_type_t;
+
+typedef struct s_mount {
+ void *id;
+ char *name;
+} s_mount_t, *mount_t;
+
+typedef struct surf_stat { /* file status structure */
+ s_file_stat_t stat;
+ /* possible additionnal fields (e.g., popularity, last access time to know whether the file is in cache, ...) */
+} s_surf_stat_t, *surf_stat_t;
+
+typedef struct surf_file {
+ char *name;
+ surf_stat_t content;
+} s_surf_file_t;
+
typedef struct storage {
s_surf_resource_t generic_resource; /*< Structure with generic data. Needed at begin to interate with SURF */
e_surf_resource_state_t state_current; /*< STORAGE current state (ON or OFF) */
lmm_constraint_t constraint_read; /* Constraint for maximum write bandwidth*/
} s_storage_t, *storage_t;
+typedef enum {
+ READ, WRITE, STAT, OPEN, CLOSE
+} e_surf_action_storage_type_t;
+
typedef struct surf_action_storage {
s_surf_action_lmm_t generic_lmm_action;
- int index_heap;
+ e_surf_action_storage_type_t type;
} s_surf_action_storage_t, *surf_action_storage_t;
#endif /* STORAGE_PRIVATE_H_ */
XBT_DEBUG("ADD ROUTING LEVEL");
ROUTING_HOST_LEVEL = xbt_lib_add_level(host_lib,routing_asr_host_free);
ROUTING_ASR_LEVEL = xbt_lib_add_level(as_router_lib,routing_asr_host_free);
- ROUTING_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,xbt_free);
- ROUTING_STORAGE_HOST_LEVEL = xbt_lib_add_level(storage_lib,routing_storage_host_free);
- ROUTING_STORAGE_TYPE_LEVEL = xbt_lib_add_level(storage_type_lib,routing_storage_type_free);
XBT_DEBUG("ADD SURF LEVELS");
SURF_CPU_LEVEL = xbt_lib_add_level(host_lib,surf_resource_free);
SURF_WKS_LEVEL = xbt_lib_add_level(host_lib,surf_resource_free);
SURF_LINK_LEVEL = xbt_lib_add_level(link_lib,surf_resource_free);
- SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,surf_resource_free);
xbt_init(argc, argv);
if (!model_list)
XBT_PUBLIC(void) routing_model_create(size_t size_of_link, void *loopback);
XBT_PUBLIC(void) routing_exit(void);
+XBT_PUBLIC(void) storage_register_callbacks(void);
XBT_PUBLIC(void) routing_register_callbacks(void);
XBT_PUBLIC(void) generic_free_route(route_t route); // FIXME rename to routing_route_free
// FIXME: make previous function private to routing again?
static xbt_dict_t random_value = NULL;
-xbt_lib_t storage_lib;
-int ROUTING_STORAGE_LEVEL; //Routing for storagelevel
-int ROUTING_STORAGE_HOST_LEVEL;
-int SURF_STORAGE_LEVEL;
-
-xbt_lib_t storage_type_lib;
-int ROUTING_STORAGE_TYPE_LEVEL; //Routing for storage_type level
-
/* Global vars */
routing_global_t global_routing = NULL;
AS_t current_routing = NULL;
/* global parse functions */
xbt_dynar_t parsed_link_list = NULL; /* temporary store of current list link of a route */
-xbt_dynar_t mount_list = NULL; /* temporary store of current mount storage */
+extern xbt_dynar_t mount_list;
+
static const char *src = NULL; /* temporary store the source name of a route */
static const char *dst = NULL; /* temporary store the destination name of a route */
static char *gw_src = NULL; /* temporary store the gateway source name of a route */
/* ************************************************************************** */
/* ************************* GENERIC PARSE FUNCTIONS ************************ */
-static void routing_parse_storage(sg_platf_storage_cbarg_t storage)
-{
- xbt_assert(!xbt_lib_get_or_null(storage_lib, storage->id,ROUTING_STORAGE_LEVEL),
- "Reading a storage, processing unit \"%s\" already exists", storage->id);
-
- // Verification of an existing type_id
-#ifndef NDEBUG
- void* storage_type = xbt_lib_get_or_null(storage_type_lib, storage->type_id,ROUTING_STORAGE_TYPE_LEVEL);
-#endif
- xbt_assert(storage_type,"Reading a storage, type id \"%s\" does not exists", storage->type_id);
-
- XBT_DEBUG("ROUTING Create a storage name '%s' with type_id '%s'",
- storage->id,
- storage->type_id);
-
- xbt_lib_set(storage_lib,
- storage->id,
- ROUTING_STORAGE_LEVEL,
- (void *) xbt_strdup(storage->type_id));
-}
-
-static void free_storage_content(void *p)
-{
- content_t content = p;
- free(content->date);
- free(content->group);
- free(content->time);
- free(content->user);
- free(content->user_rights);
- free(content);
-}
-
-static xbt_dict_t parse_storage_content(const char *filename)
-{
- if ((!filename) || (strcmp(filename, "") == 0))
- return NULL;
-
- xbt_dict_t parse_content = xbt_dict_new_homogeneous(free_storage_content);
- FILE *file = NULL;
-
- file = surf_fopen(filename, "r");
- xbt_assert(file != NULL, "Cannot open file '%s' (path=%s)", filename,
- xbt_str_join(surf_path, ":"));
-
- char *line = NULL;
- size_t len = 0;
- ssize_t read;
- char user_rights[12];
- char user[100];
- char group[100];
- char date[12];
- char time[12];
- char path[1024];
- int nb, size;
-
- content_t content;
-
- while ((read = getline(&line, &len, file)) != -1) {
- content = xbt_new0(s_content_t,1);
- if(sscanf(line,"%s %d %s %s %d %s %s %s",user_rights,&nb,user,group,&size,date,time,path)==8) {
- content->date = xbt_strdup(date);
- content->group = xbt_strdup(group);
- content->size = size;
- content->time = xbt_strdup(time);
- content->user = xbt_strdup(user);
- content->user_rights = xbt_strdup(user_rights);
- xbt_dict_set(parse_content,path,content,NULL);
- } else {
- xbt_die("Be sure of passing a good format for content file.\n");
- // You can generate this kind of file with command line:
- // find /path/you/want -type f -exec ls -l {} \; 2>/dev/null > ./content.txt
- }
- }
- if (line)
- free(line);
-
- fclose(file);
- return parse_content;
-}
-
-static void routing_parse_storage_type(sg_platf_storage_type_cbarg_t storage_type)
-{
- xbt_assert(!xbt_lib_get_or_null(storage_type_lib, storage_type->id,ROUTING_STORAGE_TYPE_LEVEL),
- "Reading a storage type, processing unit \"%s\" already exists", storage_type->id);
-
- storage_type_t stype = xbt_new0(s_storage_type_t, 1);
- stype->model = xbt_strdup(storage_type->model);
- stype->properties = storage_type->properties;
- stype->content = parse_storage_content(storage_type->content);
- stype->type_id = xbt_strdup(storage_type->id);
-
- XBT_DEBUG("ROUTING Create a storage type id '%s' with model '%s' content '%s' and properties '%p'",
- stype->type_id,
- stype->model,
- storage_type->content,
- stype->properties);
-
- xbt_lib_set(storage_type_lib,
- stype->type_id,
- ROUTING_STORAGE_TYPE_LEVEL,
- (void *) stype);
-}
-static void routing_parse_mstorage(sg_platf_mstorage_cbarg_t mstorage)
-{
- THROW_UNIMPLEMENTED;
-// mount_t mnt = xbt_new0(s_mount_t, 1);
-// mnt->id = xbt_strdup(mstorage->type_id);
-// mnt->name = xbt_strdup(mstorage->name);
-//
-// if(!mount_list){
-// XBT_DEBUG("Creata a Mount list for %s",A_surfxml_host_id);
-// mount_list = xbt_dynar_new(sizeof(char *), NULL);
-// }
-// xbt_dynar_push(mount_list,(void *) mnt);
-// free(mnt->id);
-// free(mnt->name);
-// xbt_free(mnt);
-// XBT_DEBUG("ROUTING Mount a storage name '%s' with type_id '%s'",mstorage->name, mstorage->id);
-}
-
-static void mount_free(void *p)
-{
- mount_t mnt = p;
- xbt_free(mnt->name);
-}
-
-static void routing_parse_mount(sg_platf_mount_cbarg_t mount)
-{
- // Verification of an existing storage
-#ifndef NDEBUG
- void* storage = xbt_lib_get_or_null(storage_lib, mount->id,ROUTING_STORAGE_LEVEL);
-#endif
- xbt_assert(storage,"Disk id \"%s\" does not exists", mount->id);
-
- XBT_DEBUG("ROUTING Mount '%s' on '%s'",mount->id, mount->name);
-
- s_mount_t mnt;
- mnt.id = surf_storage_resource_by_name(mount->id);
- mnt.name = xbt_strdup(mount->name);
-
- if(!mount_list){
- XBT_DEBUG("Create a Mount list for %s",A_surfxml_host_id);
- mount_list = xbt_dynar_new(sizeof(s_mount_t), mount_free);
- }
- xbt_dynar_push(mount_list,&mnt);
-}
-
static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
{
char *host_id, *groups, *link_id = NULL;
sg_platf_peer_add_cb(routing_parse_peer);
sg_platf_postparse_add_cb(routing_parse_postparse);
- sg_platf_storage_add_cb(routing_parse_storage);
- sg_platf_mstorage_add_cb(routing_parse_mstorage);
- sg_platf_storage_type_add_cb(routing_parse_storage_type);
- sg_platf_mount_add_cb(routing_parse_mount);
-
/* we care about the ASes while parsing the platf. Incredible, isnt it? */
sg_platf_AS_end_add_cb(routing_AS_end);
sg_platf_AS_begin_add_cb(routing_AS_begin);
void model_dijkstra_both_parse_route (AS_t asg, const char *src,
const char *dst, route_t route)
{
+ int as_route = 0;
+ if(!route->dst_gateway && !route->src_gateway)
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
+ else{
+ XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
+ route->src_gateway->name, dst, route->dst_gateway->name);
+ as_route = 1;
+ if(route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
+ xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway->name);
+ if(route->src_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
+ xbt_die("The src_gateway '%s' does not exist!",route->src_gateway->name);
+ }
+
as_dijkstra_t as = (as_dijkstra_t) asg;
network_element_t src_net_elm, dst_net_elm;
if (as->cached && !as->route_cache)
as->route_cache = xbt_dict_new_homogeneous(&route_cache_elem_free);
- if( A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES
- || A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES )
- xbt_die("Route symmetrical not supported on model dijkstra");
-
- if(!route->dst_gateway && !route->src_gateway)
- XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
- else{
- XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
- route->src_gateway->name, dst, route->dst_gateway->name);
- if(route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
- xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway->name);
- if(route->src_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
- xbt_die("The src_gateway '%s' does not exist!",route->src_gateway->name);
- }
-
route_t e_route = generic_new_extended_route(asg->hierarchy, route, 1);
route_new_dijkstra(as, src_net_elm->id, dst_net_elm->id, e_route);
+
+ // Symmetrical YES
+ if ( (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES && as_route == 0)
+ || (A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES && as_route == 1)
+ )
+ {
+ if(!route->dst_gateway && !route->src_gateway)
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
+ else
+ XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
+ route->dst_gateway->name, src, route->src_gateway->name);
+
+ xbt_dynar_t nodes = xbt_graph_get_nodes(as->route_graph);
+ xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_net_elm->id, xbt_node_t);
+ xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst_net_elm->id, xbt_node_t);
+ xbt_edge_t edge =
+ xbt_graph_get_edge(as->route_graph, node_e_v, node_s_v);
+
+ if (edge)
+ THROWF(arg_error,0,"(AS)Route from '%s' to '%s' already exists",src,dst);
+
+ if (route->dst_gateway && route->src_gateway) {
+ network_element_t gw_tmp;
+ gw_tmp = route->src_gateway;
+ route->src_gateway = route->dst_gateway;
+ route->dst_gateway = gw_tmp;
+ }
+ route_t link_route_back = generic_new_extended_route(asg->hierarchy, route, 0);
+ route_new_dijkstra(as, dst_net_elm->id, src_net_elm->id, link_route_back);
+ }
}
void model_floyd_parse_route(AS_t rc, const char *src,
const char *dst, route_t route)
{
- as_floyd_t as = (as_floyd_t) rc;
+ int as_route = 0;
+ as_floyd_t as = (as_floyd_t) rc;
/* set the size of table routing */
size_t table_size = xbt_dynar_length(rc->index_network_elm);
TO_FLOYD_LINK(i, j) = NULL; /* fixed, missing in the previous version */
}
}
+ if(!route->dst_gateway && !route->src_gateway)
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
+ else{
+ as_route = 1;
+ XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
+ route->src_gateway->name, dst, route->dst_gateway->name);
+ if(route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
+ xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway->name);
+ if(route->src_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
+ xbt_die("The src_gateway '%s' does not exist!",route->src_gateway->name);
+ }
if(TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id))
{
- if(!route->dst_gateway && !route->src_gateway)
- XBT_DEBUG("See Route from \"%s\" to \"%s\"", src, dst);
- else
- XBT_DEBUG("See ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
- route->src_gateway->name, dst, route->dst_gateway->name);
+
char * link_name;
unsigned int cpt;
xbt_dynar_t link_route_to_test = xbt_dynar_new(global_routing->size_of_link, NULL);
}
else
{
- if(!route->dst_gateway && !route->src_gateway)
- XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
- else{
- XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
- route->src_gateway->name, dst, route->dst_gateway->name);
- if(route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
- xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway->name);
- if(route->src_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
- xbt_die("The src_gateway '%s' does not exist!",route->src_gateway->name);
- }
TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id) =
generic_new_extended_route(rc->hierarchy, route, 1);
TO_FLOYD_PRED(src_net_elm->id, dst_net_elm->id) = src_net_elm->id;
((TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id))->link_list)->used; /* count of links, old model assume 1 */
}
- if( A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES
- || A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES )
+ if ( (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES && as_route == 0)
+ || (A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES && as_route == 1)
+ )
{
if(TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id))
{
const char *dst, route_t route)
{
network_element_t src_net_elm, dst_net_elm;
-
+ int as_route = 0;
src_net_elm = xbt_lib_get_or_null(host_lib, src, ROUTING_HOST_LEVEL);
dst_net_elm = xbt_lib_get_or_null(host_lib, dst, ROUTING_HOST_LEVEL);
if (!src_net_elm)
// "in a sub-sub-AS is not allowed), "
// "but '%s' is not in '%s'.",
// route->dst_gateway, subas->name);
-
+ as_route = 1;
XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"",
src, route->src_gateway->name, dst, route->dst_gateway->name);
if (route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
xbt_dynar_shrink(TO_ROUTE_FULL(src_net_elm->id, dst_net_elm->id)->link_list, 0);
}
- if (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES
- || A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES) {
+ if ( (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES && as_route == 0)
+ || (A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES && as_route == 1)
+ ) {
if (route->dst_gateway && route->src_gateway) {
network_element_t gw_tmp;
gw_tmp = route->src_gateway;
/* Register classical callbacks */
surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
+ storage_register_callbacks();
routing_register_callbacks();
/* init the flex parser */
return model->extension.storage.open(st, path, mode);
}
-static surf_action_t ws_action_close(void *workstation, const char* storage, m_file_t fp)
+static surf_action_t ws_action_close(void *workstation, const char* storage, surf_file_t fp)
{
storage_t st = find_storage_on_mount_list(workstation, storage);
XBT_DEBUG("CLOSE on disk '%s'",st->generic_resource.name);
return model->extension.storage.close(st, fp);
}
-static surf_action_t ws_action_read(void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream)
+static surf_action_t ws_action_read(void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream)
{
storage_t st = find_storage_on_mount_list(workstation, storage);
XBT_DEBUG("READ on disk '%s'",st->generic_resource.name);
return model->extension.storage.read(st, ptr, size, nmemb, stream);
}
-static surf_action_t ws_action_write(void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream)
+static surf_action_t ws_action_write(void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)
{
storage_t st = find_storage_on_mount_list(workstation, storage);
XBT_DEBUG("WRITE on disk '%s'",st->generic_resource.name);
return model->extension.storage.write(st, ptr, size, nmemb, stream);
}
-static surf_action_t ws_action_stat(void *workstation, const char* storage, int fd, void* buf)
+static surf_action_t ws_action_stat(void *workstation, const char* storage, surf_file_t stream)
{
storage_t st = find_storage_on_mount_list(workstation, storage);
XBT_DEBUG("STAT on disk '%s'",st->generic_resource.name);
surf_model_t model = st->generic_resource.model;
- return model->extension.storage.stat(st, fd, buf);
+ return model->extension.storage.stat(st, stream);
}
static void surf_workstation_model_init_internal(void)
$tmp_buff .= ' <li><a href="modules.html"><span>Modules API</span></a></li>'."\n";
$tmp_buff .= ' <li><a href="annotated.html"><span>Data Structures</span></a></li>'."\n";
$tmp_buff .= ' <li><a href="options.html"><span>Options & configurations</span></a></li>'."\n";
- $tmp_buff .= ' <li><a href="platform.html"><span>Platform description</span></a></li>'."\n";
+ $tmp_buff .= ' <li><a href="platform.html"><span>Platform Description</span></a></li>'."\n";
$tmp_buff .= ' <li><a href="tracing.html"><span>Tracing Simulations</span></a></li>'."\n";
$tmp_buff .= ' <li><a href="bindings.html"><span>Bindings</span></a></li>'."\n";
- $tmp_buff .= ' <li><a href="pls.html"><span>Packet level simulation</span></a></li>'."\n";
+ $tmp_buff .= ' <li><a href="pls.html"><span>Packet Level Simulation</span></a></li>'."\n";
$tmp_buff .= ' </ul></div>'."\n";
$tmp_buff .= ' </div>'."\n";
smx_action_t waiting_action;
xbt_fifo_t comms;
xbt_dict_t properties;
- s_smx_simcall_t simcall;
} s_smx_process_t;
#include "xbt.h"
#include "xbt/datadesc.h"
+#include "xbt/file_stat.h"
#include "../../src/xbt/datadesc/datadesc_private.h" // RAAAAH! ugly relative path, but it's late, I want it to be done NOW.
#include "simix/datatypes.h"
#include "../../src/simix/smx_smurf_private.h" // RAAAAH! ugly relative path, but it's even later and it still doesn't work
exit(1);
}
- parse_from_file("s_smx_simcall_t");
+// parse_from_file("s_smx_simcall_t");
parse_from_file(argv[1]);
int cpt;