CUBRID Engine  latest
broker_log_top.c File Reference
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <unistd.h>
#include "cubrid_getopt.h"
#include "cas_common.h"
#include "cas_query_info.h"
#include "broker_log_time.h"
#include "broker_log_sql_list.h"
#include "log_top_string.h"
#include "broker_log_top.h"
#include "broker_log_util.h"
Include dependency graph for broker_log_top.c:

Go to the source code of this file.

Macros

#define MAX_SRV_HANDLE   3000
 
#define CLIENT_MSG_BUF_SIZE   1024
 
#define CONNECT_MSG_BUF_SIZE   1024
 

Functions

static int log_top_query (int argc, char *argv[], int arg_start)
 
static int log_top (FILE *fp, char *filename, long start_offset, long end_offset)
 
static int log_execute (T_QUERY_INFO *qi, char *linebuf, char **query_p)
 
static int get_args (int argc, char *argv[])
 
static int read_multi_line_sql (FILE *fp, T_STRING *t_str, char **linebuf, int *lineno, T_STRING *sql_buf, T_STRING *cas_log_buf)
 
static int read_execute_end_msg (char *msg_p, int *res_code, int *runtime_msec)
 
static int read_bind_value (FILE *fp, T_STRING *t_str, char **linebuf, int *lineno, T_STRING *cas_log_buf)
 
static int search_offset (FILE *fp, char *string, long *offset, bool start)
 
static char * organize_query_string (const char *sql)
 
int main (int argc, char *argv[])
 
int get_file_offset (char *filename, long *start_offset, long *end_offset)
 
int check_log_time (char *start_date, char *end_date)
 

Variables

T_LOG_TOP_MODE log_top_mode = MODE_PROC_TIME
 
static char * sql_info_file = NULL
 
static int mode_max_handle_lower_bound
 
static char mode_tran = 0
 
static char from_date [128] = ""
 
static char to_date [128] = ""
 

Macro Definition Documentation

#define CLIENT_MSG_BUF_SIZE   1024

Definition at line 53 of file broker_log_top.c.

Referenced by log_top().

#define CONNECT_MSG_BUF_SIZE   1024

Definition at line 54 of file broker_log_top.c.

Referenced by log_top().

#define MAX_SRV_HANDLE   3000

Definition at line 52 of file broker_log_top.c.

Referenced by log_execute(), and log_top().

Function Documentation

int check_log_time ( char *  start_date,
char *  end_date 
)

Definition at line 330 of file broker_log_top.c.

References DATE_STR_LEN, from_date, and to_date.

Referenced by info_add(), query_info_add(), and query_info_add_ne().

Here is the caller graph for this function:

static int get_args ( int  argc,
char *  argv[] 
)
static

Definition at line 744 of file broker_log_top.c.

References from_date, getopt(), log_top_mode, MODE_MAX_HANDLE, mode_max_handle_lower_bound, mode_tran, optarg, optind, sql_info_file, str_to_log_date_format(), and to_date.

Referenced by main().

Here is the caller graph for this function:

int get_file_offset ( char *  filename,
long *  start_offset,
long *  end_offset 
)

Definition at line 300 of file broker_log_top.c.

References from_date, NULL, search_offset(), and to_date.

Referenced by log_top_query(), and log_top_tran().

Here is the caller graph for this function:

static int log_execute ( T_QUERY_INFO qi,
char *  linebuf,
char **  query_p 
)
static

Definition at line 717 of file broker_log_top.c.

References MAX_SRV_HANDLE, NULL, and p.

Referenced by log_top().

Here is the caller graph for this function:

static int log_top_query ( int  argc,
char *  argv[],
int  arg_start 
)
static

Definition at line 347 of file broker_log_top.c.

References argc, error(), get_file_offset(), i, log_top(), LT_INVAILD_VERSION, MALLOC, NULL, num_thread, process_flag, query_info_print(), SLEEP_MILISEC, sql_info_file, sql_list_make(), thr_main(), and THREAD_BEGIN.

Referenced by main().

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)
static char * organize_query_string ( const char *  sql)
static

Definition at line 1042 of file broker_log_top.c.

References NULL, p, and strlen.

Referenced by log_top().

Here is the caller graph for this function:

static int read_bind_value ( FILE *  fp,
T_STRING t_str,
char **  linebuf,
int *  lineno,
T_STRING cas_log_buf 
)
static

Definition at line 822 of file broker_log_top.c.

References CAS_LOG_BEGIN_WITH_YEAR, get_msg_start_ptr(), is_cas_log(), t_string_add(), t_string_len(), and ut_get_line().

Referenced by log_top().

Here is the caller graph for this function:

static int read_execute_end_msg ( char *  msg_p,
int *  res_code,
int *  runtime_msec 
)
static

Definition at line 864 of file broker_log_top.c.

References NULL, p, and str_to_int32().

Referenced by log_top().

Here is the caller graph for this function:

static int read_multi_line_sql ( FILE *  fp,
T_STRING t_str,
char **  linebuf,
int *  lineno,
T_STRING sql_buf,
T_STRING cas_log_buf 
)
static

Definition at line 793 of file broker_log_top.c.

References CAS_LOG_BEGIN_WITH_YEAR, is_cas_log(), strlen, t_string_add(), and ut_get_line().

Referenced by log_top().

Here is the caller graph for this function:

static int search_offset ( FILE *  fp,
char *  string,
long *  offset,
bool  start 
)
static

Definition at line 919 of file broker_log_top.c.

References assert, CAS_LOG_BEGIN_WITH_YEAR, DATE_STR_LEN, error(), is_cas_log(), NULL, t_string_free(), t_string_make(), and ut_get_line().

Referenced by get_file_offset().

Here is the caller graph for this function:

Variable Documentation

char from_date[128] = ""
static

Definition at line 90 of file broker_log_top.c.

Referenced by check_log_time(), get_args(), and get_file_offset().

Definition at line 85 of file broker_log_top.c.

Referenced by get_args(), log_top(), and query_info_print().

int mode_max_handle_lower_bound
static

Definition at line 88 of file broker_log_top.c.

Referenced by get_args(), and log_top().

char mode_tran = 0
static

Definition at line 89 of file broker_log_top.c.

Referenced by get_args(), and main().

char* sql_info_file = NULL
static

Definition at line 87 of file broker_log_top.c.

Referenced by get_args(), and log_top_query().

char to_date[128] = ""
static

Definition at line 91 of file broker_log_top.c.

Referenced by check_log_time(), get_args(), and get_file_offset().