2 /* Copyright (c) 2009 The SimGrid Team. All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #ifndef SURF_RESOURCE_LMM_H
8 #define SURF_RESOURCE_LMM_H
10 #include "surf/trace_mgr.h"
13 surf_resource_lmm_t surf_resource_lmm_new(size_t childsize,
14 /* for superclass */ surf_model_t model, char *name, xbt_dict_t props,
15 lmm_constraint_t constraint,
16 tmgr_history_t history,
17 int state_init, tmgr_trace_t state_trace,
18 double metric_init, tmgr_trace_t metric_trace) {
20 surf_resource_lmm_t res = (surf_resource_lmm_t)surf_resource_new(childsize,model,name,props);
22 res->constraint = constraint;
23 res->state_current = state_init;
25 res->state_event = tmgr_history_add_trace(history, state_trace, 0.0, 0, res);
27 res->power.current = metric_init;
29 res->power.event = tmgr_history_add_trace(history, metric_trace, 0.0, 0, res);
34 static XBT_INLINE e_surf_resource_state_t surf_resource_lmm_get_state(void *r) {
35 surf_resource_lmm_t resource = (surf_resource_lmm_t)r;
36 return (resource)->state_current;
38 #endif /* SURF_RESOURCE_LMM_H */