CUBRID Engine  latest
unittests_snapshot.c File Reference
#include "porting.h"
#include "thread_manager.hpp"
#include <stdio.h>
#include <pthread.h>
#include <log_impl.h>
#include <sys/time.h>
Include dependency graph for unittests_snapshot.c:

Go to the source code of this file.

Macros

#define strlen(s1)   ((int) strlen(s1))
 
#define NOPS_SNAPSHOT   1000000
 
#define NOPS_COMPLPETE   1000000
 
#define NOPS_OLDEST   2000000
 
#define MVCC_BITAREA_ELEMENT_BITS   64
 
#define MVCC_BITAREA_ELEMENT_ALL_COMMITTED   0xffffffffffffffffULL
 
#define MVCC_BITAREA_BIT_COMMITTED   1
 
#define MVCC_BITAREA_BIT_ACTIVE   0
 
#define MVCC_BITAREA_ELEMENTS_AFTER_FULL_CLEANUP   16
 
#define MVCC_BITAREA_MAXIMUM_ELEMENTS   500
 
#define MVCC_BITAREA_MAXIMUM_BITS   32000
 
#define MVCC_BITAREA_BITS_TO_ELEMENTS(count_bits)   (((count_bits) + 63) >> 6)
 
#define MVCC_BITAREA_BITS_TO_BYTES(count_bits)   ((((count_bits) + 63) >> 6) << 3)
 
#define MVCC_BITAREA_ELEMENTS_TO_BYTES(count_elements)   ((count_elements) << 3)
 
#define MVCC_BITAREA_ELEMENTS_TO_BITS(count_elements)   ((count_elements) << 6)
 
#define MSG_LEN   40
 
#define MAX_THREADS   100
 
#define MAX_SNAPSHOT_THREADS   10
 
#define MAX_COMPLETE_THREADS   10
 
#define MAX_OLDEST_THREADS   1
 

Functions

static void begin (char *test_name)
 
static int success ()
 
static void logtb_initialize_mvcctable (void)
 
static void logtb_finalize_mvcctable ()
 
static unsigned int logtb_tran_btid_hash_func (const void *key, const unsigned int ht_size)
 
static int logtb_tran_btid_hash_cmp_func (const void *key1, const void *key2)
 
static void logtb_initialize_tdes_for_mvcc_testing (LOG_TDES *tdes, int tran_index)
 
static int logtb_initialize_mvcc_testing (int num_threads, THREAD_ENTRY **thread_array)
 
static void logtb_finalize_mvcc_testing (THREAD_ENTRY **thread_array)
 
THREAD_RET_T THREAD_CALLING_CONVENTION test_mvcc_get_snapshot (void *param)
 
THREAD_RET_T THREAD_CALLING_CONVENTION test_new_mvcc_complete (void *param)
 
THREAD_RET_T THREAD_CALLING_CONVENTION test_mvcc_get_oldest (void *param)
 
static int test_mvcc_operations (int num_snapshot_threads, int num_complete_threads, int num_oldest_mvccid_threads, THREAD_ENTRY *thread_array)
 
int main (int argc, char **argv)
 

Variables

static struct timeval start_time
 
static UINT64 count_snapshots = 0
 
static UINT64 count_complete = 0
 
static UINT64 count_oldest = 0
 

Macro Definition Documentation

#define MAX_COMPLETE_THREADS   10

Referenced by main().

#define MAX_OLDEST_THREADS   1

Referenced by main().

#define MAX_SNAPSHOT_THREADS   10

Referenced by main().

#define MAX_THREADS   100

Referenced by test_mvcc_operations().

#define MSG_LEN   40

Referenced by begin().

#define MVCC_BITAREA_BIT_ACTIVE   0

Definition at line 42 of file unittests_snapshot.c.

#define MVCC_BITAREA_BIT_COMMITTED   1

Definition at line 41 of file unittests_snapshot.c.

#define MVCC_BITAREA_BITS_TO_BYTES (   count_bits)    ((((count_bits) + 63) >> 6) << 3)

Definition at line 54 of file unittests_snapshot.c.

#define MVCC_BITAREA_BITS_TO_ELEMENTS (   count_bits)    (((count_bits) + 63) >> 6)

Definition at line 53 of file unittests_snapshot.c.

#define MVCC_BITAREA_ELEMENT_ALL_COMMITTED   0xffffffffffffffffULL

Definition at line 40 of file unittests_snapshot.c.

#define MVCC_BITAREA_ELEMENT_BITS   64

Definition at line 39 of file unittests_snapshot.c.

#define MVCC_BITAREA_ELEMENTS_AFTER_FULL_CLEANUP   16

Definition at line 45 of file unittests_snapshot.c.

#define MVCC_BITAREA_ELEMENTS_TO_BITS (   count_elements)    ((count_elements) << 6)

Definition at line 56 of file unittests_snapshot.c.

#define MVCC_BITAREA_ELEMENTS_TO_BYTES (   count_elements)    ((count_elements) << 3)

Definition at line 55 of file unittests_snapshot.c.

#define MVCC_BITAREA_MAXIMUM_BITS   32000

Definition at line 51 of file unittests_snapshot.c.

#define MVCC_BITAREA_MAXIMUM_ELEMENTS   500

Definition at line 48 of file unittests_snapshot.c.

#define NOPS_COMPLPETE   1000000

Definition at line 35 of file unittests_snapshot.c.

Referenced by test_mvcc_operations(), and test_new_mvcc_complete().

#define NOPS_OLDEST   2000000

Definition at line 36 of file unittests_snapshot.c.

Referenced by test_mvcc_get_oldest(), and test_mvcc_operations().

#define NOPS_SNAPSHOT   1000000

Definition at line 34 of file unittests_snapshot.c.

Referenced by test_mvcc_get_snapshot(), and test_mvcc_operations().

#define strlen (   s1)    ((int) strlen(s1))

Definition at line 32 of file unittests_snapshot.c.

Referenced by begin().

Function Documentation

static void begin ( char *  test_name)
static

Definition at line 62 of file unittests_snapshot.c.

References i, MSG_LEN, NULL, start_time, and strlen.

Referenced by test_mvcc_operations().

Here is the caller graph for this function:

static void logtb_finalize_mvcctable ( )
static

Definition at line 102 of file unittests_snapshot.c.

References mvcctable::finalize(), log_Gl, and log_global::mvcc_table.

Referenced by logtb_finalize_mvcc_testing().

Here is the caller graph for this function:

static void logtb_initialize_mvcctable ( void  )
static

Definition at line 95 of file unittests_snapshot.c.

References mvcctable::initialize(), log_Gl, and log_global::mvcc_table.

Referenced by logtb_initialize_mvcc_testing().

Here is the caller graph for this function:

static void logtb_initialize_tdes_for_mvcc_testing ( LOG_TDES tdes,
int  tran_index 
)
static
static int logtb_tran_btid_hash_cmp_func ( const void *  key1,
const void *  key2 
)
static

Definition at line 114 of file unittests_snapshot.c.

Referenced by logtb_initialize_tdes_for_mvcc_testing().

Here is the caller graph for this function:

static unsigned int logtb_tran_btid_hash_func ( const void *  key,
const unsigned int  ht_size 
)
static

Definition at line 108 of file unittests_snapshot.c.

Referenced by logtb_initialize_tdes_for_mvcc_testing().

Here is the caller graph for this function:

static int success ( )
static

Definition at line 80 of file unittests_snapshot.c.

References NO_ERROR, NULL, and start_time.

Referenced by test_mvcc_operations().

Here is the caller graph for this function:

static int test_mvcc_operations ( int  num_snapshot_threads,
int  num_complete_threads,
int  num_oldest_mvccid_threads,
THREAD_ENTRY thread_array 
)
static

Variable Documentation

UINT64 count_complete = 0
static

Definition at line 263 of file unittests_snapshot.c.

Referenced by test_mvcc_operations(), and test_new_mvcc_complete().

UINT64 count_oldest = 0
static

Definition at line 264 of file unittests_snapshot.c.

Referenced by test_mvcc_get_oldest(), and test_mvcc_operations().

UINT64 count_snapshots = 0
static

Definition at line 262 of file unittests_snapshot.c.

Referenced by test_mvcc_get_snapshot(), and test_mvcc_operations().

struct timeval start_time
static

Definition at line 59 of file unittests_snapshot.c.

Referenced by begin(), and success().