Perf07
Data Structures | Macros | Typedefs | Functions
perf07.c File Reference

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

#include <stdio.h>
#include "rdm.h"
#include "perf07_db.h"
#include "perf07_db_dbd.h"

Data Structures

struct  _PERF07_CTX

Macros

#define NUM_LEVELS   6
#define NUM_MEMBERS   8

Typedefs

typedef struct _PERF07_CTX PERF07_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 (PERF07_CTX *ctx)
 Initialize the RDM runtime library for use in the perf07 example.
void cleanup (PERF07_CTX *ctx)
 Cleanup the RDM runtime library.
void bom_random_id (PERF07_CTX *ctx, char *string)
 Generate a 15-character alpha-numeric part id.
int32_t create_bom (PERF07_CTX *ctx)
 Top level function to create a BOM.
int32_t get_cost (double *total_cost, PERF07_CTX *ctx)
 Recursive rountine roll up cost from lower levels of a BOM.
int32_t rollup_bom (PERF07_CTX *ctx)
 Top level function for rolling the BOM.
int32_t main ()
 Main function for perf07 example.

Detailed Description

Source code for the RDM Perf07 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 _PERF07_CTX PERF07_CTX

Context structure for the Perf07 example


Function Documentation

void bom_random_id ( PERF07_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
void cleanup ( PERF07_CTX ctx)

Cleanup the RDM runtime library.

This functions closes all open databases and cleans up the RDM runtime task used in the perf07 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 ( PERF07_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 ( double *  total_cost,
PERF07_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:
[out]total_costPointer to area to put the total cost
[in]ctxPointer to the application context
int32_t initialize ( PERF07_CTX ctx)

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

This function initializes the RDM Transactional File Server (TFS) to use the direct-link transactional TFS implementation. It also creates an RDM runtime task and opens the "perf07_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 perf07 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 ( PERF07_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