simsplay platform_file.{xml|lua} deployment_file.{xml|lua} splay_script.lua [simgrid_options...]
I'm not sure about the format of the platform and deployment files yet.
-We could accept both XML and Lua files, since their is a great Lua API to
+We could accept both XML and Lua files, since there is a great Lua API to
describe platforms, or only the XML ones.
The simsplay executable (which is compiled C) would initialize SimGrid, create
function SPLAYschool()
log:print("My ip is: "..job.me.ip())
- for i = 1000,10000 do
+ for i = 1,200 do
log:print(i)
end
-
+--[[
events.sleep(5)
if job.me.ip() == job.nodes[1].ip then
end
events.sleep(5)
os.exit()
+ --]]
end
function call_me(from)
events.thread("SPLAYschool")
start.loop()
+log:print("Simulation finished")
please_dont_replace_me(...)
end
--- Show a hello message and prints the global string
+-- Shows a hello message and prints the global string
function please_dont_replace_me(...)
simgrid.info("Hello from please_dont_replace_me(). I'm lucky, I still exist in this state.")
#include <lauxlib.h>
#include <lualib.h>
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua_state_cloner, lua, "Lua state management");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua_state_cloner, bindings, "Lua state management");
static void sglua_add_maestro_table(lua_State* L, int index, void* maestro_table_ptr);
static void* sglua_get_maestro_table_ptr(lua_State* L, int index);
/* it's a Lua function: dump it from src */
s_sglua_buffer_t buffer;
- buffer.capacity = 64;
+ buffer.capacity = 128; /* an empty function uses 77 bytes */
buffer.size = 0;
buffer.data = xbt_new(char, buffer.capacity);
int error = lua_dump(src, sglua_memory_writer, &buffer);
xbt_assert(!error, "Failed to dump the function from the source state: error %d",
error);
+ XBT_DEBUG("Fonction dumped: %zu bytes", buffer.size);
+
+ /*
+ fwrite(buffer.data, buffer.size, buffer.size, stderr);
+ fprintf(stderr, "\n");
+ */
/* load the chunk into dst */
error = luaL_loadbuffer(dst, buffer.data, buffer.size, "(dumped function)");
/* -- */
/* opening the standard libs is not necessary as they are
- * be inherited like any global values */
+ * inherited like any global values */
/* luaL_openlibs(L); */
XBT_DEBUG("New state created");
#include "xbt.h"
#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua_utils, lua, "Lua helper functions");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua_utils, bindings, "Lua helper functions");
/**
* @brief Returns a string representation of a value in the Lua stack.
#include "lua_state_cloner.h"
#include "lua_utils.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(lua, "Lua Bindings");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua, bindings, "Lua Bindings");
static lua_State *lua_maestro_state;
static int Host_self(lua_State * L)
{
+ /* -- */
m_host_t host = MSG_host_self();
lua_newtable(L);
- m_host_t *lua_host =(m_host_t *)lua_newuserdata(L,sizeof(m_host_t));
+ /* table */
+ m_host_t* lua_host = (m_host_t*) lua_newuserdata(L, sizeof(m_host_t));
+ /* table ud */
*lua_host = host;
luaL_getmetatable(L, HOST_MODULE_NAME);
+ /* table ud mt */
lua_setmetatable(L, -2);
+ /* table ud */
lua_setfield(L, -2, "__simgrid_host");
+ /* table */
return 1;
}