Perf05

- Main Page
- Files

- File List
- Globals

Macros | Functions
perf05.c File Reference

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

`#include <stdio.h>`
`#include "rdm.h"`
`#include "perf05_db.h"`
`#include "perf05_db_dbd.h"`

## Macros
#define | NUM_RECORDS 50000

## 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 perf05 example.
void | cleanup (TFS_HANDLE hTFS, DB_TASK *task)
| Cleanup the RDM runtime library.
int32_t | add_records (int32_t transaction_size, DB_TASK *task)
| Insert 50,000 simple records into the perf05 database.
int32_t | main ()
| Main function for perf05 example.

## Detailed Description

Source code for the RDM Perf05 example.

## Macro Definition Documentation

#define NUM_RECORDS 50000

Number of records to insert

## Function Documentation

int32_t add_records | ( | int32_t | transaction_size,
|  | DB_TASK * | task
| ) |  |

Insert 50,000 simple records into the perf05 database.

This function adds 50,000 simple records into the inmemory 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] | transaction_size | Number of inserts to perform per transaction
  [in] | task | RDM task initialized with the perf05 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 perf05 example. It also terminates the TFS used in the example.

Returns:
  Returns a 32-bit RDM return code (S_OKAY if successful)

Parameters:

  [out] | hTFS | Pointer to the TFS handle to be terminated
  [out] | task | Pointer to the RDM task to be cleaned up

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

Initialize the RDM runtime library for use in the perf05 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 "perf05_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:

  [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 perf05 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