#include "surf/surf_resource.h"
#include "maxmin_private.h"
#include "simgrid/sg_config.h"
+#include "surf/cpu_cas01_private.h"
/* the model objects for physical machines and virtual machines */
surf_model_t surf_cpu_model_pm = NULL;
s_surf_action_lmm_t generic_lmm_action;
} s_surf_action_cpu_Cas01_t, *surf_action_cpu_Cas01_t;
-typedef struct cpu_Cas01 {
- s_surf_resource_t generic_resource;
- s_xbt_swag_hookup_t modified_cpu_hookup;
- double power_peak;
- double power_scale;
- tmgr_trace_event_t power_event;
- int core;
- e_surf_resource_state_t state_current;
- tmgr_trace_event_t state_event;
- lmm_constraint_t constraint;
-} s_cpu_Cas01_t, *cpu_Cas01_t;
-
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf,
"Logging specific to the SURF CPU IMPROVED module");
cpu_running_action_set_that_does_not_need_being_checked = NULL;
-/* This function is registered as a callback to sg_platf_new_host() and never called directly */
-static void *cpu_create_resource(const char *name, double power_peak,
+void *cpu_cas01_create_resource(const char *name, double power_peak,
double power_scale,
tmgr_trace_t power_trace,
int core,
/* This function is called when a platform file is parsed. Physical machines
* are defined there. Thus, we use the cpu model object for the physical
* machine layer. */
- cpu_create_resource(host->id,
+ cpu_cas01_create_resource(host->id,
host->power_peak,
host->power_scale,
host->power_trace,
--- /dev/null
+
+/* Copyright (c) 2013. 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. */
+
+#ifndef _SURF_CPU_CAS01_PRIVATE_H
+#define _SURF_CPU_CAS01_PRIVATE_H
+
+typedef struct cpu_Cas01 {
+ s_surf_resource_t generic_resource;
+ s_xbt_swag_hookup_t modified_cpu_hookup;
+ double power_peak;
+ double power_scale;
+ tmgr_trace_event_t power_event;
+ int core;
+ e_surf_resource_state_t state_current;
+ tmgr_trace_event_t state_event;
+ lmm_constraint_t constraint;
+} s_cpu_Cas01_t, *cpu_Cas01_t;
+
+void *cpu_cas01_create_resource(const char *name,
+ double power_peak,
+ double power_scale,
+ tmgr_trace_t power_trace,
+ int core,
+ e_surf_resource_state_t state_initial,
+ tmgr_trace_t state_trace,
+ xbt_dict_t cpu_properties,
+ surf_model_t cpu_model);
+
+#endif /* _SURF_CPU_CAS01_PRIVATE_H */
#include "surf/surf_resource.h"
#include "simgrid/sg_config.h"
#include "workstation_private.h"
-
+#include "surf/cpu_cas01_private.h"
/* FIXME: Where should the VM state be defined?
* ws->generic_resouce.model->type first. If it is
* SURF_MODEL_TYPE_VM_WORKSTATION, cast ws to vm_ws. */
xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, &vm_ws->ws);
+
+
+
+ cpu_Cas01_t sub_cpu = surf_cpu_resource_priv(ind_phys_workstation);
+
+ /* We can assume one core and cas01 cpu for the first step.
+ * Do xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu) if you get the resource.
+ * */
+ cpu_cas01_create_resource(name, // name
+ sub_cpu->power_peak, // host->power_peak,
+ 1, // host->power_scale,
+ NULL, // host->power_trace,
+ 1, // host->core_amount,
+ SURF_RESOURCE_ON, // host->initial_state,
+ NULL, // host->state_trace,
+ NULL, // host->properties,
+ surf_cpu_model_vm);
+
+ // void *ind_host = xbt_lib_get_elm_or_null(host_lib, name);
}
/*