Perf03
|
Source code for the RDM Perf03 example. More...
#include <stdio.h>
#include "rdm.h"
#include "perf03_db.h"
#include "perf03_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 (TFS_HANDLE *hTFS, DB_TASK **task) |
Initialize the RDM runtime library for use in the perf03 example. | |
void | cleanup (TFS_HANDLE hTFS, DB_TASK *task) |
Cleanup the RDM runtime library. | |
int32_t | add_records (DB_TASK *task) |
Insert 50,000 simple records into the perf03 database. | |
int32_t | read_records (DB_TASK *task) |
Read all simple records and calculate the sum of the int_col column. | |
int32_t | update_records (DB_TASK *task) |
Update all simple records in the database. | |
int32_t | delete_records (DB_TASK *task) |
Delete all simple records from the database. | |
int32_t | main () |
Main function for perf03 example. |
Source code for the RDM Perf03 example.
int32_t add_records | ( | DB_TASK * | task | ) |
Insert 50,000 simple records into the perf03 database.
This function adds 50,000 simple records into the Perf03 database. The simple record contains only a single indexed integer field. The function will calculate and display the total time elapsed while inserting the records
[in] | task | RDM task initialized with the perf03 database open and as the current database |
void cleanup | ( | TFS_HANDLE | hTFS, |
DB_TASK * | task | ||
) |
Cleanup the RDM runtime library.
This functions closes all open databases and cleans up the RDM runtime task used in the perf03 example. It also terminates the STANDALONE TFS used in the example.
[out] | hTFS | Pointer to the TFS handle to be terminated |
[out] | task | Pointer to the RDM task to be cleaned up |
int32_t delete_records | ( | DB_TASK * | task | ) |
Delete all simple records from the database.
This function will iterate and delete all simple records stored in the perf03 database. The iteration is done in raw file order through the d_reclast/d_recprev APIs. The function will calculate and display the total time elapsed while deleting the records.
[in] | task | RDM task initialized with the perf03 database open and as the current database |
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.
[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 initialize | ( | TFS_HANDLE * | hTFS, |
DB_TASK ** | task | ||
) |
Initialize the RDM runtime library for use in the perf03 example.
This function initializes the RDM Transactional File Server (TFS) to use the single-user non-transactional STANDALONE implementation. It also creates an RDM runtime task and opens the "perf03" database in exclusive ('x') mode. Exclusve mode does not require database locks or transactions.
[out] | hTFS | Pointer to the TFS handle to be initialized |
[out] | task | Pointer to the RDM task to be initialized |
int32_t main | ( | ) |
Main function for perf03 example.
The function initializes the RDM environment and runs the create, read, update, and delete operations.
int32_t read_records | ( | DB_TASK * | task | ) |
Read all simple records and calculate the sum of the int_col column.
This function iterates through and reads all simple records stored in the perf03 database. The iteration is done in key order through the d_keyfrst/d_keynext APIs. The function will calculate the sum of the int_col field from all simple records in the database. The function will also calculate and display the total time elapsed while reading the records.
[in] | task | RDM task initialized with the perf03 database open and as the current database |
int32_t update_records | ( | DB_TASK * | task | ) |
Update all simple records in the database.
This function iterates through and updates all simple records stored in the perf03 database. The iteration is done in raw file order through the d_recfrst/d_recnext APIs. The function will read, increment, and then update the value stored in the int_col field.
[in] | task | RDM task initialized with the perf03 database open and as the current database |