Functions

/home/mesh/mesh/include/mesh_energy.h File Reference

MESH energy Functions. More...

#include <mesh.h>
#include <mesh_def_energy_resources.h>
#include <mesh_def_energy_schedulers.h>
#include <mesh_energy_types.h>

Go to the source code of this file.

Functions

mesh_energy * mesh_create_energy (mesh_feature_list *cfl, double power, double comp)
 Creates and initializes a mesh_energy structure and creates the default energy state using the specified power consumption and fractional computational power value provided. The energy structure by default is not associated with any energy resources. A mesh_energy structure may be assigned to an energy resource (created with mesh_create_energy_resource()) using mesh_set_energy().
mesh_energy_state * mesh_add_energy_state (mesh_energy *ce, gchar *name, double power, double comp)
 Adds a new energy state to an energy structure created using mesh_create_energy(). The name of the energy state must be unique to the specified energy structure. To specify comp values for individual features, use mesh_add_energy_state_feature().
mesh_energy_state * mesh_add_energy_state_feature (mesh_energy_state *ces, gint feature, double comp)
 Adds an energy state feature, which specifies the fraction of computational power available to a specific resource feature while in the specified energy state.
mesh_resource * mesh_set_energy (mesh_resource *cr, mesh_energy *ce)
 Assigns the previously created (using mesh_create_energy()) mesh_energy structure ce to the previously created (using mesh_create_energy_resource()) resource cr.
mesh_energy * mesh_get_energy (mesh_resource *cr)
 Returns a pointer to the mesh_energy structure associated with the given resource. The resource must have an associated, valid mesh_energy structure, created with mesh_create_energy() and assigned with mesh_set_energy().
mesh_energy_state * mesh_find_energy_state_by_name (mesh_energy *ce, gchar *state)
 Returns a pointer to the energy state state in the energy structure ce if it exists.
double mesh_find_energy_state_feature (mesh_energy_state *ces, gint feature)
 Returns the fraction of available computational power for the specified resource feature in the specified energy state.
gboolean mesh_check_current_energy_state (mesh_resource *cr, gchar *state)
 Checks if the current energy state of resource cr is state, TRUE if so and FALSE otherwise.
gboolean mesh_set_current_energy_state (mesh_resource *cr, gchar *state)
 If possible, changes the energy state of the specified resource to the energy state named state. Returns TRUE if the operation succeeds (the specified energy state exists) and FALSE otherwise.
mesh_energy_state * mesh_get_current_energy_state (mesh_resource *cr)
 Returns the current energy state of the specified resource. The resource must have an associated, valid mesh_energy structure, created with mesh_create_energy() and assigned with mesh_set_energy().
gboolean mesh_check_target_energy_state (mesh_resource *cr, gchar *state)
 Checks if the target energy state of resource cr is state, TRUE if so and FALSE otherwise.
gboolean mesh_set_target_energy_state (mesh_resource *cr, gchar *state)
 If possible, changes the energy state of the specified resource to the energy state named state. Returns TRUE if the operation succeeds (the specified energy state exists) and FALSE otherwise.
mesh_energy_state * mesh_get_target_energy_state (mesh_resource *cr)
 Returns the target energy state of the specified resource. The resource must have an associated, valid mesh_energy structure, created with mesh_create_energy() and assigned with mesh_set_energy().
mesh_energy_state_list * mesh_get_energy_state_list (mesh_resource *cr)
 Returns a pointer to the list of available energy states to the given resource. The resource must have an associated, valid mesh_energy structure, created with mesh_create_energy() and assigned with mesh_set_energy().
void mesh_update_energy_state_utilization (mesh_resource *cr)
 Updates the record of how much time has been spent and energy has been dissipated in the current energy state by comparing the current simulation time to the time utilization was last updated for this resource. Used to determine the energy consumption of a resource by tracking how much time each resource spends in each energy state.
void mesh_update_energy_state_utilization_consume (mesh_resource *cr, double length, double rpc)
 Updates the record of how much time has been spent and energy has been dissipated in the current energy state based on the length of the consume call executed and the relative power complexity of the consume call. Used to determine the energy consumption of a resource by tracking how much time each resource spends in each energy state.
void mesh_print_energy_statistics (mesh_resource *cr)
 Prints the energy state usage statistics (time spent in each, energy consumed in each) for the given resource, and provides summary statistics (total energy consumed, total time accounted for by energy states).

Detailed Description

MESH energy Functions.


Function Documentation

mesh_energy_state* mesh_add_energy_state ( mesh_energy *  ce,
gchar *  name,
double  power,
double  comp 
)

Adds a new energy state to an energy structure created using mesh_create_energy(). The name of the energy state must be unique to the specified energy structure. To specify comp values for individual features, use mesh_add_energy_state_feature().

label mesh_add_energy_state

Parameters:
ce Already created energy structure to add an energy state to
name Name of the energy state to create
power Energy consumed per unit time in this state
comp Default fraction of computational power available in this state precond A valid mesh_energy structure must be created through mesh_create_energy()
Returns:
A pointer to the newly created energy state.
See also:
mesh_create_energy(), mesh_add_energy_state_feature()
mesh_energy_state* mesh_add_energy_state_feature ( mesh_energy_state *  ces,
gint  feature,
double  comp 
)

Adds an energy state feature, which specifies the fraction of computational power available to a specific resource feature while in the specified energy state.

label mesh_add_energy_state_feature

Parameters:
ces Already created energy state to add an energy state feature to
feature Index identifying the feature for which an individual comp value is being added
comp Fraction of computational power available to the specified feature in the specified state precond A valid mesh_energy_state must be created through mesh_add_energy_state()
Returns:
A pointer to the modified energy state.
See also:
mesh_add_energy_state()
gboolean mesh_check_current_energy_state ( mesh_resource *  cr,
gchar *  state 
)

Checks if the current energy state of resource cr is state, TRUE if so and FALSE otherwise.

Parameters:
cr Already created energy resource with an associated energy structure
state Name of the energy state being checked against the current energy state precond A valid mesh_energy_resource created with mesh_create_energy_resource(), and a valid mesh_energy structure created with mesh_create_energy() and set with mesh_set_energy()
Returns:
TRUE if state is the current energy state of cr, FALSE otherwise
See also:
mesh_create_energy_resource(), mesh_create_energy(), mesh_set_energy(), mesh_add_energy_state,() mesh_get_current_energy_state(), mesh_set_current_energy_state()
gboolean mesh_check_target_energy_state ( mesh_resource *  cr,
gchar *  state 
)

Checks if the target energy state of resource cr is state, TRUE if so and FALSE otherwise.

label mesh_check_target_energy_state

Parameters:
cr Already created energy resource with an associated energy structure
state Name of the energy state being checked against the target energy state precond A valid mesh_energy_resource created with mesh_create_energy_resource(), and a valid mesh_energy structure created with mesh_create_energy() and set with mesh_set_energy()
Returns:
TRUE if state is the target energy state of cr, FALSE otherwise
See also:
mesh_create_energy_resource(), mesh_create_energy(), mesh_set_energy(), mesh_add_energy_state(), mesh_get_target_energy_state(), mesh_set_target_energy_state()
mesh_energy* mesh_create_energy ( mesh_feature_list *  cfl,
double  power,
double  comp 
)

Creates and initializes a mesh_energy structure and creates the default energy state using the specified power consumption and fractional computational power value provided. The energy structure by default is not associated with any energy resources. A mesh_energy structure may be assigned to an energy resource (created with mesh_create_energy_resource()) using mesh_set_energy().

label mesh_create_energy

Parameters:
cfl Already created and fully specified mesh_feature_list
power Energy consumed per unit time in the default energy state
comp Fraction of computational power available in the default energy state precond All features must have been added to cfl using mesh_feature_add()
Returns:
A pointer to the newly created mesh_energy structure
See also:
mesh_feature_add(), mesh_create_energy_resource(), mesh_set_energy()
mesh_energy_state* mesh_find_energy_state_by_name ( mesh_energy *  ce,
gchar *  state 
)

Returns a pointer to the energy state state in the energy structure ce if it exists.

label mesh_find_energy_state_by_name

Parameters:
ce Energy structure to search
state Name of state to find in energy structure ce
Returns:
Pointer to the specified energy state, otherwise NULL
double mesh_find_energy_state_feature ( mesh_energy_state *  ces,
gint  feature 
)

Returns the fraction of available computational power for the specified resource feature in the specified energy state.

label mesh_find_energy_state_feature

Parameters:
ces Energy state to search
feature Index of the feature to find in energy state ces
Returns:
Fraction of available computational power for the specified feature in the specified energy state
mesh_energy_state* mesh_get_current_energy_state ( mesh_resource *  cr  ) 

Returns the current energy state of the specified resource. The resource must have an associated, valid mesh_energy structure, created with mesh_create_energy() and assigned with mesh_set_energy().

label mesh_get_current_energy_state

Parameters:
cr Resource created using mesh_create_energy_resource() precond Resource has been assigned a valid mesh_energy structure with mesh_set_energy()
Returns:
A pointer to the current energy state of the specified resource
See also:
mesh_create_energy_resource(), mesh_create_energy(), mesh_set_energy()
mesh_energy* mesh_get_energy ( mesh_resource *  cr  ) 

Returns a pointer to the mesh_energy structure associated with the given resource. The resource must have an associated, valid mesh_energy structure, created with mesh_create_energy() and assigned with mesh_set_energy().

label mesh_get_energy

Parameters:
cr Resource created using mesh_create_energy_resource() precond Resource has been assigned a valid mesh_energy structure with mesh_set_energy()
Returns:
A pointer to the mesh_energy structure of the specified resource
See also:
mesh_create_energy_resource(), mesh_create_energy(), mesh_set_energy()
mesh_energy_state_list* mesh_get_energy_state_list ( mesh_resource *  cr  ) 

Returns a pointer to the list of available energy states to the given resource. The resource must have an associated, valid mesh_energy structure, created with mesh_create_energy() and assigned with mesh_set_energy().

label mesh_get_energy_state_list

Parameters:
cr Resource created using mesh_create_energy_resource() precond Resource has been assigned a valid mesh_energy structure with mesh_set_energy()
Returns:
A pointer to the list of available energy states to the specified resource
See also:
mesh_create_energy_resource(), mesh_create_energy(), mesh_set_energy()
mesh_energy_state* mesh_get_target_energy_state ( mesh_resource *  cr  ) 

Returns the target energy state of the specified resource. The resource must have an associated, valid mesh_energy structure, created with mesh_create_energy() and assigned with mesh_set_energy().

label mesh_get_target_energy_state

Parameters:
cr Resource created using mesh_create_energy_resource() precond Resource has been assigned a valid mesh_energy structure with mesh_set_energy()
Returns:
A pointer to the target energy state of the specified resource
See also:
mesh_create_energy_resource(), mesh_create_energy(), mesh_set_energy()
void mesh_print_energy_statistics ( mesh_resource *  cr  ) 

Prints the energy state usage statistics (time spent in each, energy consumed in each) for the given resource, and provides summary statistics (total energy consumed, total time accounted for by energy states).

label mesh_print_energy_statistics

Parameters:
cr Resource created using mesh_create_energy_resource() precond Resource has been assigned a valid mesh_energy structure with mesh_set_energy(), and either mesh_update_energy_state_utilization() or mesh_update_energy_state_utilization_consume() has been called at least once
See also:
mesh_set_energy() mesh_update_energy_state_utilization(), mesh_update_energy_state_utilization_consume()
gboolean mesh_set_current_energy_state ( mesh_resource *  cr,
gchar *  state 
)

If possible, changes the energy state of the specified resource to the energy state named state. Returns TRUE if the operation succeeds (the specified energy state exists) and FALSE otherwise.

label mesh_set_current_energy_state

Parameters:
cr Resource created using mesh_create_energy_resource()
state Name of the energy state to make the current energy state for the specified resource precond Resource has been assigned a valid mesh_energy structure with mesh_set_energy()
Returns:
TRUE if state is a valid energy state for cr, FALSE otherwise
See also:
mesh_create_energy_resource(), mesh_create_energy(), mesh_set_energy(), mesh_add_energy_state()
mesh_resource* mesh_set_energy ( mesh_resource *  cr,
mesh_energy *  ce 
)

Assigns the previously created (using mesh_create_energy()) mesh_energy structure ce to the previously created (using mesh_create_energy_resource()) resource cr.

label mesh_set_energy

Parameters:
cr Resource created using mesh_create_energy_resource()
ce mesh_energy structure created with mesh_create_energy() precond cr has been created with mesh_create_energy_resource() and ce has been created with mesh_create_energy()
Returns:
A pointer to the modified resource
See also:
mesh_create_energy_resource(), mesh_create_energy()
gboolean mesh_set_target_energy_state ( mesh_resource *  cr,
gchar *  state 
)

If possible, changes the energy state of the specified resource to the energy state named state. Returns TRUE if the operation succeeds (the specified energy state exists) and FALSE otherwise.

label mesh_set_target_energy_state

Parameters:
cr Resource created using mesh_create_energy_resource()
state Name of the energy state to make the target energy state for the specified resource precond Resource has been assigned a valid mesh_energy structure with mesh_set_energy()
Returns:
TRUE if state is a valid energy state for cr, FALSE otherwise
See also:
mesh_create_energy_resource(), mesh_create_energy(), mesh_set_energy(), mesh_add_energy_state()
void mesh_update_energy_state_utilization ( mesh_resource *  cr  ) 

Updates the record of how much time has been spent and energy has been dissipated in the current energy state by comparing the current simulation time to the time utilization was last updated for this resource. Used to determine the energy consumption of a resource by tracking how much time each resource spends in each energy state.

label mesh_update_energy_state_utilization

Parameters:
cr Resource created using mesh_create_energy_resource() precond Resource has been assigned a valid mesh_energy structure with mesh_set_energy()
See also:
mesh_update_energy_state_utilization_consume()
void mesh_update_energy_state_utilization_consume ( mesh_resource *  cr,
double  length,
double  rpc 
)

Updates the record of how much time has been spent and energy has been dissipated in the current energy state based on the length of the consume call executed and the relative power complexity of the consume call. Used to determine the energy consumption of a resource by tracking how much time each resource spends in each energy state.

label mesh_update_energy_state_utilization_consume

Parameters:
cr Resource created using mesh_create_energy_resource()
length Length of the consume call executed on the given resource
rpc The relative power complexity of the consume call precond Resource has been assigned a valid mesh_energy structure with mesh_set_energy()
See also:
mesh_update_energy_state_utilization()
 All Files Functions