Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add surf_cpu_init_im_bypass to be used to bypass the parser without passing through...
[simgrid.git] / src / include / surf / surf_resource_lmm.h
1
2 /* Copyright (c) 2009, 2010. The SimGrid Team.
3  * All rights reserved.                                                     */
4
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. */
7
8 #ifndef SURF_RESOURCE_LMM_H
9 #define SURF_RESOURCE_LMM_H
10 #include "surf/surf.h"
11 #include "surf/trace_mgr.h"
12
13 static XBT_INLINE
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) {
20
21   surf_resource_lmm_t res = (surf_resource_lmm_t)surf_resource_new(childsize,model,name,props);
22
23   res->constraint = lmm_constraint_new(system, res, constraint_value);
24   res->state_current = state_init;
25   if (state_trace)
26     res->state_event = tmgr_history_add_trace(history, state_trace, 0.0, 0, res);
27
28   res->power.scale = 1.0;
29   res->power.peak = metric_peak;
30   if (metric_trace)
31     res->power.event = tmgr_history_add_trace(history, metric_trace, 0.0, 0, res);
32   return res;
33 }
34
35
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;
39 }
40 #endif /* SURF_RESOURCE_LMM_H */