Code for handling load structure. More...
Go to the source code of this file.
Functions | |
| struct pmm_loadhistory * | new_loadhistory () |
| int | init_loadhistory (struct pmm_loadhistory *h, int size) |
| void | add_load (struct pmm_loadhistory *h, struct pmm_load *l) |
| int | check_loadhistory (struct pmm_loadhistory *h) |
| struct pmm_load * | new_load () |
| void | print_loadhistory (const char *output, struct pmm_loadhistory *h) |
| void | print_load (const char *output, struct pmm_load *l) |
| void | free_loadhistory (struct pmm_loadhistory **h) |
Code for handling load structure.
Contains functions for dealing with the load data structures.
Definition in file pmm_load.c.
| void add_load | ( | struct pmm_loadhistory * | h, |
| struct pmm_load * | l | ||
| ) |
This function copies the structure l into the load history structure which is a circular array.
| h | pointer to the load history structure |
| l | pointer to the load to be copied into the next free/expired element of the circular array |
Definition at line 120 of file pmm_load.c.
| int check_loadhistory | ( | struct pmm_loadhistory * | h | ) |
Do some sanity checking on the load history structure
| h | pointer to load history |
Definition at line 160 of file pmm_load.c.
| void free_loadhistory | ( | struct pmm_loadhistory ** | h | ) |
frees a load history structure and all of its members
| h | pointer to address of the load history structure |
Definition at line 243 of file pmm_load.c.
| int init_loadhistory | ( | struct pmm_loadhistory * | h, |
| int | size | ||
| ) |
Function initialises the array and indexes that are used to store the load history (in a circular type array)
| h | pointer to a load history structure |
| size | size of the circular array |
TODO check that history is not already allocated, free in this case first
Definition at line 90 of file pmm_load.c.
|
read |
initialized a new load observation structure
Definition at line 191 of file pmm_load.c.
|
read |
Allocates and initialises memory for a new load history structure. This is a circular array arrangement with pointers to the beginning and end. Iteration over the array is done using the modulus operator to wrap the physically beginning and end addresses.
note for a given size we must keep size+1 elements in the array. Thus we store two different sizes. 'size' refers to the number of accessible elements in the circular array. 'size_mod' refers to actual allocated elements in the array and is only to be used when iterating through the accessible elements using i+1size_mod. 'size_mod' will always be the accessible size 'size' + 1
Definition at line 50 of file pmm_load.c.
| void print_load | ( | const char * | output, |
| struct pmm_load * | l | ||
| ) |
prints a single load observation
| output | output stream to print to |
| l | pointer to load structure to print |
Definition at line 233 of file pmm_load.c.
| void print_loadhistory | ( | const char * | output, |
| struct pmm_loadhistory * | h | ||
| ) |
prints a load history sequence
| output | output stream to print to |
| h | pointer to the load history |
Definition at line 211 of file pmm_load.c.
1.8.1.2