X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b3973f5189df8d8983e47336546fd0259f0e2dab..413534bc9aac9b6a61840de0a20f933534552fd7:/src/bindings/java/surf_swig.cpp diff --git a/src/bindings/java/surf_swig.cpp b/src/bindings/java/surf_swig.cpp index 88f0ee665d..fef1748289 100644 --- a/src/bindings/java/surf_swig.cpp +++ b/src/bindings/java/surf_swig.cpp @@ -1,9 +1,14 @@ +/* Copyright (c) 2014. 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 #include "src/surf/surf_interface.hpp" #include "surf_swig.hpp" #include "src/simix/smx_private.h" - double getClock() { return surf_get_clock(); } @@ -12,10 +17,26 @@ void clean() { SIMIX_clean(); } -/*NetworkModel *getNetworkModel() -{ - return surf_network_model; -}*/ +CpuModel *getCpuModel(){ + return surf_cpu_model_pm; +} + +CpuModel *java_cpu_model; +static void java_cpu_model_init_preparse() { + surf_cpu_model_pm = java_cpu_model; + xbt_dynar_push(model_list, &java_cpu_model); + xbt_dynar_push(model_list_invoke, &java_cpu_model); + sg_platf_host_add_cb(cpu_parse_init); +} + +void setCpuModel(CpuModel *cpuModel){ + java_cpu_model = cpuModel; + surf_cpu_model_init_preparse = java_cpu_model_init_preparse; +} + +void setCpu(char *name, Cpu *cpu) { + xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu); +} NetworkLinkDynar getRoute(char *srcName, char *dstName) { RoutingEdge *src = (RoutingEdge*)xbt_lib_get_or_null(host_lib, srcName, ROUTING_HOST_LEVEL);