Source code for the RDM Perf08 example.
More...
#include <stdio.h>
#include "rdm.h"
#include "perf08_db.h"
#include "perf08_db_dbd.h"
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
Number of levels in the BOM
Number of members per level in the BOM
Typedef Documentation
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] | ctx | Pointer to the application context |
[out] | string | 15-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] | parent | The item_id of the parent part in the bill |
[in] | ctx | Pointer to the application context |
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] | ctx | Pointer to the application context |
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] | ctx | Pointer 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] | msg | Message to be display along with the elapsed time |
[in] | start_time | Start of elapsed time to display |
[in] | end_time | End 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] | parent | The item id of the current component we are summing |
[out] | total_cost | Pointer to area to put the total cost |
[in] | ctx | Pointer to the application context |
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] | ctx | Pointer to the application context |
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
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] | ctx | Pointer to the application context |