Perf08
Data Structures | Macros | Typedefs | Functions
perf08.c File Reference

Source code for the RDM Perf08 example. More...

#include <stdio.h>
#include "rdm.h"
#include "perf08_db.h"
#include "perf08_db_dbd.h"

Data Structures

struct  _PERF08_CTX

Macros

#define NUM_LEVELS   6
#define NUM_MEMBERS   8

Typedefs

typedef struct _PERF08_CTX PERF08_CTX

Functions

void display_elapsed_time (const char *msg, uint64_t start_time, uint64_t end_time)
 Display a message and the elapsed time to perform database operations.
int32_t initialize (PERF08_CTX *ctx)
 Initialize the RDM runtime library for use in the perf08 example.
void cleanup (PERF08_CTX *ctx)
 Cleanup the RDM runtime library.
void bom_random_id (PERF08_CTX *ctx, char *string)
 Generate a 15-character alpha-numeric part id.
int32_t build_bill (const char *parent, PERF08_CTX *ctx)
 Recursive rountine to build one level of a bill by adding components to a parent.
int32_t create_bom (PERF08_CTX *ctx)
 Top level function to create a BOM.
int32_t get_cost (const char *parent, double *total_cost, PERF08_CTX *ctx)
 Recursive rountine roll up cost from lower levels of a BOM.
int32_t rollup_bom (PERF08_CTX *ctx)
 Top level function for rolling the BOM.
int32_t main ()
 Main function for perf08 example.

Detailed Description

Source code for the RDM Perf08 example.


Macro Definition Documentation

#define NUM_LEVELS   6

Number of levels in the BOM

#define NUM_MEMBERS   8

Number of members per level in the BOM


Typedef Documentation

typedef struct _PERF08_CTX PERF08_CTX

Context structure for the Perf08 example


Function Documentation

void bom_random_id ( PERF08_CTX ctx,
char *  string 
)

Generate a 15-character alpha-numeric part id.

This function generates a part id for an item

Parameters:
[in]ctxPointer to the application context
[out]string15-character alpha part id
int32_t build_bill ( const char *  parent,
PERF08_CTX ctx 
)

Recursive rountine to build one level of a bill by adding components to a parent.

This function recursively builds a full bill of materials in the Core08 database.

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[in]parentThe item_id of the parent part in the bill
[in]ctxPointer to the application context
void cleanup ( PERF08_CTX ctx)

Cleanup the RDM runtime library.

This functions closes all open databases and cleans up the RDM runtime task used in the perf08 example. It also terminates the STANDALONE TFS used in the example.

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[in]ctxPointer to the application context
int32_t create_bom ( PERF08_CTX ctx)

Top level function to create a BOM.

This function recursively builds a full bill of materials in the Core07 database.

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[in]ctxPointer to the application context
void display_elapsed_time ( const char *  msg,
uint64_t  start_time,
uint64_t  end_time 
)

Display a message and the elapsed time to perform database operations.

Parameters:
[in]msgMessage to be display along with the elapsed time
[in]start_timeStart of elapsed time to display
[in]end_timeEnd of elapsed
int32_t get_cost ( const char *  parent,
double *  total_cost,
PERF08_CTX ctx 
)

Recursive rountine roll up cost from lower levels of a BOM.

This function recursively rolls-up the cost of a BOM. The costs are only stored at the lowest levels of the BOM.

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[in]parentThe item id of the current component we are summing
[out]total_costPointer to area to put the total cost
[in]ctxPointer to the application context
int32_t initialize ( PERF08_CTX ctx)

Initialize the RDM runtime library for use in the perf08 example.

This function initializes the RDM Transactional File Server (TFS) to use the STANDALONE transactional TFS implementation. It also creates an RDM runtime task and opens the "perf08_db" database in exclusive ('x') mode. Exclusve mode does not require database locks or transactions.

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[in,out]ctxPointer to the application context
int32_t main ( )

Main function for perf08 example.

The function initializes the RDM environment and runs the insert operations. over a number of transaction block sizes

Returns:
Returns 0 on success, and 1 if there were any errors
int32_t rollup_bom ( PERF08_CTX ctx)

Top level function for rolling the BOM.

This function recursively rolls up and calculate the full cost of a BOM.

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[in]ctxPointer to the application context