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"
12 #include "surf/surf_resource.h"
16 surf_resource_lmm_t surf_resource_lmm_new(size_t childsize,
19 const char *name, xbt_dict_t props,
21 double constraint_value,
22 tmgr_history_t history,
23 e_surf_resource_state_t state_init,
24 tmgr_trace_t state_trace,
26 tmgr_trace_t metric_trace)
29 surf_resource_lmm_t res =
30 (surf_resource_lmm_t) surf_resource_new(childsize, model, name,
33 res->constraint = lmm_constraint_new(system, res, constraint_value);
34 res->state_current = state_init;
37 tmgr_history_add_trace(history, state_trace, 0.0, 0, res);
39 res->power.scale = 1.0;
40 res->power.peak = metric_peak;
43 tmgr_history_add_trace(history, metric_trace, 0.0, 0, res);
48 static XBT_INLINE e_surf_resource_state_t surf_resource_lmm_get_state(void
51 surf_resource_lmm_t resource = (surf_resource_lmm_t) r;
52 return (resource)->state_current;
54 #endif /* SURF_RESOURCE_LMM_H */