pmm  1.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
pmm_cfgparser.h File Reference
#include <libxml/xmlwriter.h>
#include "pmm_model.h"
#include "pmm_load.h"
#include "pmm_interval.h"

Go to the source code of this file.

Functions

int parse_config (struct pmm_config *cfg)
int parse_history (struct pmm_loadhistory *h)
int parse_model (struct pmm_model *m)
int parse_models (struct pmm_config *c)
int write_loadhistory (struct pmm_loadhistory *h)
int write_loadhistory_xtwp (xmlTextWriterPtr writer, struct pmm_loadhistory *h)
int write_models (struct pmm_config *cfg)
int write_model (struct pmm_model *m)
int write_model_xtwp (xmlTextWriterPtr writer, struct pmm_model *m)
int write_bench_list_xtwp (xmlTextWriterPtr writer, struct pmm_bench_list *bench_list)
int write_benchmark_xtwp (xmlTextWriterPtr writer, struct pmm_benchmark *b)
int write_paramdef_set_xtwp (xmlTextWriterPtr writer, struct pmm_paramdef_set *pd_set)
int write_paramdef_xtwp (xmlTextWriterPtr writer, struct pmm_paramdef *pd)
int write_parameter_array_xtwp (xmlTextWriterPtr writer, int *p, int n)
int write_interval_xtwp (xmlTextWriterPtr writer, struct pmm_interval *i)
int write_timeval_xtwp (xmlTextWriterPtr writer, struct timeval *t)
void xmlparser_init ()
void xmlparser_cleanup ()

Function Documentation

int parse_config ( struct pmm_config cfg)

Parse xml config file into config structure.

Parameters
cfgpointer to config structure to store parsed data
Returns
0 on success, -1 on failure
Precondition
cfg points to an allocated pmm_config structure
cfg structure member 'configfile' must be set to the config file path or this function will return an error

Definition at line 613 of file pmm_cfgparser.c.

int parse_history ( struct pmm_loadhistory h)

Parse the load history file.

Parameters
hpointer to a load history structure, already populated with config data (i.e. the load history file path)
Returns
0 on success, -1 on failure.

Definition at line 1267 of file pmm_cfgparser.c.

int parse_model ( struct pmm_model m)

Parses a model from an xml file. The model structure is expected to have the path of the file already stored.

Parameters
mpointer to the model
Returns
0 on success, -1 if no model file exists, -2 on other error

Definition at line 1522 of file pmm_cfgparser.c.

int parse_models ( struct pmm_config c)

Parse models of routines listed in the config structure.

Parameters
cpointer to the config with all routine details
Returns
0 on success, -1 on failure

Definition at line 1732 of file pmm_cfgparser.c.

int write_bench_list_xtwp ( xmlTextWriterPtr  writer,
struct pmm_bench_list bench_list 
)

Write a benchmark list to an xmlTextWriterPtr object

Parameters
writerxmlTextWriter pointer
bench_listpointer to the benchmark list
Returns
0 on success, -1 on failure

Definition at line 2693 of file pmm_cfgparser.c.

int write_benchmark_xtwp ( xmlTextWriterPtr  writer,
struct pmm_benchmark b 
)

Write a benchmark to an xmlTextWriterPtr object

Parameters
writerxmlTextWriter pointer
bpointer to the benchmark
Returns
0 on success -1 on error

Definition at line 2984 of file pmm_cfgparser.c.

int write_interval_xtwp ( xmlTextWriterPtr  writer,
struct pmm_interval i 
)

write an interval structure to disk in xml

Parameters
writerxmlTextWriterPtr to use to write with
ipointer to interval structure to write to disk
Returns
0 on success, -1 on failure

Definition at line 1776 of file pmm_cfgparser.c.

int write_loadhistory ( struct pmm_loadhistory h)

write the load history to file

opens an xmlTextWriter and writes the history to the file specified in the history structure

Parameters
hpointer to the load history
Returns
0 on success, -1 on failure

Definition at line 1956 of file pmm_cfgparser.c.

int write_loadhistory_xtwp ( xmlTextWriterPtr  writer,
struct pmm_loadhistory h 
)

Write load history to the xmlTextWriterPtr

Parameters
writeran xmlTextWriter pointer
hpointer to load load history structure
Returns
0 on success, -1 on failure

Definition at line 2145 of file pmm_cfgparser.c.

int write_model ( struct pmm_model m)

write an individual model to disk

Parameters
mpointer to the model
Returns
0 on success, -1 on failure

Definition at line 2315 of file pmm_cfgparser.c.

int write_model_xtwp ( xmlTextWriterPtr  writer,
struct pmm_model m 
)

Write a model list to an xmlTextWriterPtr object

Parameters
writerxmlTextWriter pointer
mpointer to the model
Returns
0 on success, -1 on failure

Definition at line 2591 of file pmm_cfgparser.c.

int write_models ( struct pmm_config cfg)

write all models in the configuration

Parameters
cfgpointer to the configuration
Returns
0 on success, -1 on failure

Definition at line 2288 of file pmm_cfgparser.c.

int write_paramdef_set_xtwp ( xmlTextWriterPtr  writer,
struct pmm_paramdef_set pd_set 
)

Write the parameter definition set to an xmlTextWriterPtr object

Parameters
writerxmlTextWriter pointer
pd_setpointer to the parameter defintion set
Returns
0 on success, -1 on failure

Definition at line 2750 of file pmm_cfgparser.c.

int write_paramdef_xtwp ( xmlTextWriterPtr  writer,
struct pmm_paramdef pd 
)

Write a parameter definition to an xmlTextWriterPtr object

Parameters
writerxmlTextWriter pointer
pdpointer to the parameter definition to write
Returns
0 on success -1 on error

Definition at line 2837 of file pmm_cfgparser.c.

int write_parameter_array_xtwp ( xmlTextWriterPtr  writer,
int *  p,
int  n 
)

Write a parameter array to an xmlTextWriterPtr object

In the form:

<parameter_array> <n_p>n</n_p> <parameter>p[0]</parameter> <parameter> .... </parameter_array>

Parameters
writerwriter to use
pparameter array
nnumber of parameters in array
Returns
0 on succes, -1 on failure

Definition at line 2933 of file pmm_cfgparser.c.

int write_timeval_xtwp ( xmlTextWriterPtr  writer,
struct timeval *  t 
)

Write a timeval to an xmlTextWriterPtr object

Parameters
writerxmlTextWriter pointer
tpointer to the timeval
Returns
0 on success -1 on error

Definition at line 3076 of file pmm_cfgparser.c.

void xmlparser_cleanup ( )

clean up libxml parser

Definition at line 3113 of file pmm_cfgparser.c.

void xmlparser_init ( )

initialized libxml2 parser

Definition at line 3104 of file pmm_cfgparser.c.