src/surf/cpu_ti.c
src/surf/cpu_cas01.c
src/surf/sg_platf.c
+ src/surf/storage.c
src/xbt/xbt_sg_stubs.c
)
$height++; #will have to deal with empty set of clusters.
}
# debug stuff
-#print "Computed : \n";
-#print STDERR "height: " . $height . "\n";
-#print STDERR "totalnumberofhosts: " . $totalnumberofhosts . "\n";
-#print STDERR "totalnumberofcluster: " . $totalnumberofCluster . "\n";
-#print STDERR "last cluster size (if equals to cluster size, then all clusters will be homogeneous) : " . $last . "\n";
+# print "Computed : \n";
+# print STDERR "height: " . $height . "\n";
+# print STDERR "totalnumberofhosts: " . $totalnumberofhosts . "\n";
+# print STDERR "totalnumberofcluster: " . $totalnumberofCluster . "\n";
+# print STDERR "last cluster size (if equals to cluster size, then all clusters will be homogeneous) : " . $last . "\n";
# Counter for giving unique IDs to ASes.
$ASnumber;
# Printing preamble
print "<?xml version='1.0'?>\n";
print "<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid.dtd\">\n";
-print "<platform version=\"3\">\n";
+print "<platform version=\"3\">\n\n";
# Initiate recursion ...
# Closing tag, and then back home
print "</platform>\n";
+
# Recursive stuff for depth first Se... Creation
sub DF_creation {
my($currDepth) = @_;
# Saving my current number to return it to my father
my $toReturn = $ASnumber;
$ASnumber++;
- if ($currDepth<$height && $totalnumberofCluster > 0)
+ if ($currDepth<=$height && $totalnumberofCluster > 0)
{
# Creating current AS inner stuff
# I should have a table of sons numbers.
xbt_dict_t properties);
} s_surf_model_extension_network_t;
+typedef struct s_surf_file {
+ char *name; /**< @brief host name if any */
+ void *data; /**< @brief user data */
+} s_surf_file_t;
+typedef struct s_surf_file *surf_file_t;
+
+/* Storage model */
+
+/** \brief Storage model extension public
+ * \ingroup SURF_models
+ *
+ * Public functions specific to the Storage model.
+ */
+typedef struct surf_storage_model_extension_public {
+ surf_action_t(*open) (void *workstation, const char* path, const char* mode);
+ surf_action_t(*close) (void *workstation, surf_file_t fp);
+ surf_action_t(*read) (void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+ surf_action_t(*write) (void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+ surf_action_t(*stat) (void *workstation, int fd, void* buf);
+void* (*create_resource) (const char *name);
+} s_surf_model_extension_storage_t;
+
/** \brief Workstation model extension public
* \ingroup SURF_models
*
double amount, double rate);
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* path, const char* mode);
+ surf_action_t(*close) (void *workstation, surf_file_t fp);
+ surf_action_t(*read) (void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+ surf_action_t(*write) (void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+ surf_action_t(*stat) (void *workstation, int fd, void* buf);
int (*link_shared) (const void *link);
xbt_dict_t(*get_properties) (const void *resource);
void* (*link_create_resource) (const char *name,
union extension {
s_surf_model_extension_cpu_t cpu;
s_surf_model_extension_network_t network;
+ s_surf_model_extension_storage_t storage;
s_surf_model_extension_workstation_t workstation;
} extension;
} s_surf_model_t;
#endif
action->io.host = host;
- // TODO in surf model disk???
- // action->io.surf_io = surf_workstation_model->extension.storage.read(host->host, name),
- action->io.surf_io = surf_workstation_model->extension.workstation.sleep(host->host, 1.0);
+ action->io.surf_io = surf_workstation_model->extension.workstation.read(host->host, ptr, size, nmemb, (surf_file_t)stream),
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
#endif
action->io.host = host;
- // TODO in surf model disk???
- // action->io.surf_io = surf_workstation_model->extension.storage.write(host->host, name),
- action->io.surf_io = surf_workstation_model->extension.workstation.sleep(host->host, 2.0);
+ action->io.surf_io = surf_workstation_model->extension.workstation.write(host->host, ptr, size, nmemb, (surf_file_t)stream);
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
#endif
action->io.host = host;
- // TODO in surf model disk???
- // action->io.surf_io = surf_workstation_model->extension.storage.open(host->host, name),
- action->io.surf_io = surf_workstation_model->extension.workstation.sleep(host->host, 3.0);
+ action->io.surf_io = surf_workstation_model->extension.workstation.open(host->host, path, mode);
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
#endif
action->io.host = host;
- // TODO in surf model disk???
- // action->io.surf_io = surf_workstation_model->extension.storage.close(host->host, name),
- action->io.surf_io = surf_workstation_model->extension.workstation.sleep(host->host, 4.0);
+ action->io.surf_io = surf_workstation_model->extension.workstation.close(host->host, (surf_file_t)fp);
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
#endif
action->io.host = host;
- // TODO in surf model disk???
- // action->io.surf_io = surf_workstation_model->extension.storage.stat(host->host, name),
- action->io.surf_io = surf_workstation_model->extension.workstation.sleep(host->host, 5.0);
+ action->io.surf_io = surf_workstation_model->extension.workstation.stat(host->host, fd, buf);
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
--- /dev/null
+/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012. 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 "xbt/ex.h"
+#include "xbt/dict.h"
+#include "portable.h"
+#include "surf_private.h"
+#include "surf/surf_resource.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf,
+ "Logging specific to the SURF storage module");
+
+surf_model_t surf_storage_model = NULL;
+
+static surf_action_t storage_action_open(void *workstation, const char* path, const char* mode)
+{
+ return NULL;
+}
+
+static surf_action_t storage_action_close(void *workstation, surf_file_t fp)
+{
+ return NULL;
+}
+
+static surf_action_t storage_action_read(void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+{
+ return NULL;
+}
+
+static surf_action_t storage_action_write(void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+{
+ return NULL;
+}
+
+static surf_action_t storage_action_stat(void *workstation, int fd, void* buf)
+{
+ return NULL;
+}
+
+static void surf_storage_model_init_internal(void)
+{
+ surf_storage_model = surf_model_init();
+
+ surf_storage_model->name = "Storage";
+
+ surf_storage_model->extension.workstation.open = storage_action_open;
+ surf_storage_model->extension.workstation.close = storage_action_close;
+ surf_storage_model->extension.workstation.read = storage_action_read;
+ surf_storage_model->extension.workstation.write = storage_action_write;
+ surf_storage_model->extension.workstation.stat = storage_action_stat;
+}
if (!route->dst_gateway && !route->src_gateway)
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
else {
- AS_t subas = xbt_dict_get_or_null(rc->routing_sons, src);
- if (subas == NULL)
- surf_parse_error("The source of an ASroute must be a sub-AS "
- "declared within the current AS, "
- "but '%s' is not an AS within '%s'", src, rc->name);
- if (subas->to_index
- && xbt_dict_get_or_null(subas->to_index, route->src_gateway) == NULL)
- surf_parse_error("In an ASroute, source gateway must be part of "
- "the source sub-AS (in particular, being in a "
- "sub-sub-AS is not allowed), "
- "but '%s' is not in '%s'.",
- route->src_gateway, subas->name);
-
- subas = xbt_dict_get_or_null(rc->routing_sons, dst);
- if (subas == NULL)
- surf_parse_error("The destination of an ASroute must be a sub-AS "
- "declared within the current AS, "
- "but '%s' is not an AS within '%s'", dst, rc->name);
- if (subas->to_index
- && xbt_dict_get_or_null(subas->to_index, route->dst_gateway) == NULL)
- surf_parse_error("In an ASroute, destination gateway must be "
- "part of the destination sub-AS (in particular, "
- "in a sub-sub-AS is not allowed), "
- "but '%s' is not in '%s'.",
- route->dst_gateway, subas->name);
+// FIXME We can call a gw wich is down the current AS (cf g5k.xml) but not upper.
+// AS_t subas = xbt_dict_get_or_null(rc->routing_sons, src);
+// if (subas == NULL)
+// surf_parse_error("The source of an ASroute must be a sub-AS "
+// "declared within the current AS, "
+// "but '%s' is not an AS within '%s'", src, rc->name);
+// if (subas->to_index
+// && xbt_dict_get_or_null(subas->to_index, route->src_gateway) == NULL)
+// surf_parse_error("In an ASroute, source gateway must be part of "
+// "the source sub-AS (in particular, being in a "
+// "sub-sub-AS is not allowed), "
+// "but '%s' is not in '%s'.",
+// route->src_gateway, subas->name);
+//
+// subas = xbt_dict_get_or_null(rc->routing_sons, dst);
+// if (subas == NULL)
+// surf_parse_error("The destination of an ASroute must be a sub-AS "
+// "declared within the current AS, "
+// "but '%s' is not an AS within '%s'", dst, rc->name);
+// if (subas->to_index
+// && xbt_dict_get_or_null(subas->to_index, route->dst_gateway) == NULL)
+// surf_parse_error("In an ASroute, destination gateway must be "
+// "part of the destination sub-AS (in particular, "
+// "in a sub-sub-AS is not allowed), "
+// "but '%s' is not in '%s'.",
+// route->dst_gateway, subas->name);
XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"",
src, route->src_gateway, dst, route->dst_gateway);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
+static int having_set_bypassroute = 0;
+
AS_t model_generic_create_sized(size_t childsize) {
AS_t new_component = model_none_create_sized(childsize);
xbt_free(e_route);
xbt_dict_set(dict_bypassRoutes, route_name, new_e_route, NULL);
+ having_set_bypassroute = 1;
xbt_free(route_name);
}
route_t generic_get_bypassroute(AS_t rc, const char *src, const char *dst)
{
+ // If never set a bypass route return NULL
+ if(!having_set_bypassroute)
+ return NULL;
+
xbt_dict_t dict_bypassRoutes = rc->bypassRoutes;
AS_t src_as, dst_as;
int index_src, index_dst;
return surf_resource_properties(((workstation_CLM03_t) ws)->cpu);
}
+static surf_action_t ws_action_open(void *workstation, const char* path, const char* mode)
+{
+ return surf_cpu_model->extension.cpu.
+ sleep(((workstation_CLM03_t) workstation)->cpu, 1);
+}
+
+static surf_action_t ws_action_close(void *workstation, surf_file_t fp)
+{
+ return surf_cpu_model->extension.cpu.
+ sleep(((workstation_CLM03_t) workstation)->cpu, 2);
+}
+
+static surf_action_t ws_action_read(void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+{
+ return surf_cpu_model->extension.cpu.
+ sleep(((workstation_CLM03_t) workstation)->cpu, 3);
+}
+
+static surf_action_t ws_action_write(void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+{
+ return surf_cpu_model->extension.cpu.
+ sleep(((workstation_CLM03_t) workstation)->cpu, 4);
+}
+
+static surf_action_t ws_action_stat(void *workstation, int fd, void* buf)
+{
+ return surf_cpu_model->extension.cpu.
+ sleep(((workstation_CLM03_t) workstation)->cpu, 5);
+}
+
static void surf_workstation_model_init_internal(void)
{
surf_workstation_model = surf_model_init();
surf_workstation_model->extension.workstation.get_properties =
ws_get_properties;
+ surf_workstation_model->extension.workstation.open = ws_action_open;
+ surf_workstation_model->extension.workstation.close = ws_action_close;
+ surf_workstation_model->extension.workstation.read = ws_action_read;
+ surf_workstation_model->extension.workstation.write = ws_action_write;
+ surf_workstation_model->extension.workstation.stat = ws_action_stat;
}
void surf_workstation_model_init_current_default(void)