2 /* Copyright (c) 2009, 2010. The SimGrid Team.
3 * All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #ifndef SURF_RESOURCE_LMM_H
9 #define SURF_RESOURCE_LMM_H
10 #include "surf/surf.h"
11 #include "surf/trace_mgr.h"
14 surf_resource_lmm_t surf_resource_lmm_new(size_t childsize,
15 /* for superclass */ surf_model_t model, char *name, xbt_dict_t props,
16 lmm_system_t system, double constraint_value,
17 tmgr_history_t history,
18 int state_init, tmgr_trace_t state_trace,
19 double metric_peak, tmgr_trace_t metric_trace) {
21 surf_resource_lmm_t res = (surf_resource_lmm_t)surf_resource_new(childsize,model,name,props);
23 res->constraint = lmm_constraint_new(system, res, constraint_value);
24 res->state_current = state_init;
26 res->state_event = tmgr_history_add_trace(history, state_trace, 0.0, 0, res);
28 res->power.scale = 1.0;
29 res->power.peak = metric_peak;
31 res->power.event = tmgr_history_add_trace(history, metric_trace, 0.0, 0, res);
36 static XBT_INLINE e_surf_resource_state_t surf_resource_lmm_get_state(void *r) {
37 surf_resource_lmm_t resource = (surf_resource_lmm_t)r;
38 return (resource)->state_current;
40 #endif /* SURF_RESOURCE_LMM_H */