Perf01
Functions
perf01.c File Reference

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

#include <stdio.h>
#include "rdm.h"
#include "perf01_db.h"
#include "perf01_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 perf01 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 perf01 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 perf01 example.

Detailed Description

Source code for the RDM Perf01 example.


Function Documentation

int32_t add_records ( DB_TASK *  task)

Insert 50,000 simple records into the perf01 database.

This function adds 50,000 simple records into the inmemory perf database. The simple record contains only a single integer field with no index. The function will calculate and display the total time elapsed while inserting the records

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[in]taskRDM task initialized with the perf01 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 perf01 example. It also terminates the STANDALONE TFS used in the example.

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[out]hTFSPointer to the TFS handle to be terminated
[out]taskPointer 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 perf01 database. The iteration is done in raw file order through the d_recfrst/d_recnext APIs. The function will calculate and display the total time elapsed while deleting the records.

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[in]taskRDM task initialized with the perf01 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.

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 initialize ( TFS_HANDLE *  hTFS,
DB_TASK **  task 
)

Initialize the RDM runtime library for use in the perf01 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 "perf01" 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:
[out]hTFSPointer to the TFS handle to be initialized
[out]taskPointer to the RDM task to be initialized
int32_t main ( )

Main function for perf01 example.

The function initializes the RDM environment and runs the create, read, update, and delete operations.

Returns:
Returns 0 on success, and 1 if there were any errors
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 perf01 database. The iteration is done in raw file order through the d_recfrst/d_recnext 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.

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[in]taskRDM task initialized with the perf01 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 perf01 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 inc_col field.

Returns:
Returns a 32-bit RDM return code (S_OKAY if successful)
Parameters:
[in]taskRDM task initialized with the perf01 database open and as the current database