29 #if !defined (WINDOWS) 31 #include <sys/resource.h> 38 #if !defined(SERVER_MODE) 43 #if defined (SERVER_MODE) 46 #if defined (SERVER_MODE) || defined (SA_MODE) 48 #endif // SERVER_MODE or SA_MODE 52 #if defined(SERVER_MODE) 55 #include <sys/types.h> 69 #if defined (SERVER_MODE) || defined (SA_MODE) 84 #if defined (SERVER_MODE) 88 #if !defined(SERVER_MODE) 89 #define pthread_mutex_init(a, b) 90 #define pthread_mutex_destroy(a) 91 #define pthread_mutex_lock(a) 0 92 #define pthread_mutex_unlock(a) 97 #if !defined (SERVER_MODE) 102 #define PSTAT_VALUE_CUSTOM 0x00000001 104 #define PSTAT_METADATA_INIT_SINGLE_ACC(id, name) { id, name, PSTAT_ACCUMULATE_SINGLE_VALUE, 0, 0, NULL, NULL, NULL } 105 #define PSTAT_METADATA_INIT_SINGLE_PEEK(id, name) \ 106 { id, name, PSTAT_PEEK_SINGLE_VALUE, 0, 0, NULL, NULL, NULL } 107 #define PSTAT_METADATA_INIT_COUNTER_TIMER(id, name) { id, name, PSTAT_COUNTER_TIMER_VALUE, 0, 0, NULL, NULL, NULL } 108 #define PSTAT_METADATA_INIT_COMPUTED_RATIO(id, name) \ 109 { id, name, PSTAT_COMPUTED_RATIO_VALUE, 0, 0, NULL, NULL, NULL } 110 #define PSTAT_METADATA_INIT_COMPLEX(id, name, f_dump_in_file, f_dump_in_buffer, f_load) \ 111 { id, name, PSTAT_COMPLEX_VALUE, 0, 0, f_dump_in_file, f_dump_in_buffer, f_load } 113 #define PERFMON_VALUES_MEMSIZE (pstat_Global.n_stat_values * sizeof (UINT64)) 171 int *remaining_size);
174 int *remaining_size);
176 int *remaining_size);
178 int *remaining_size);
188 #if defined (SERVER_MODE) 189 static void perfmon_peek_thread_daemon_stats (UINT64 * stats);
190 #endif // SERVER_MODE 278 "Num_btree_online_inserts_same_page_hold"),
509 "alloc_bcb_get_victim_search_own_private_list"),
511 "alloc_bcb_get_victim_search_others_private_list"),
519 "Num_victim_assign_direct_adjust_lru_to_vacuum"),
521 "Num_victim_assign_direct_search_for_flush"),
616 #if defined (SERVER_MODE) || defined (SA_MODE) 631 #if defined(CS_MODE) || defined(SA_MODE) 632 bool perfmon_Iscollecting_stats =
false;
635 static PERFMON_CLIENT_STAT_INFO perfmon_Stat_info;
642 perfmon_start_stats (
bool for_all_trans)
646 if (perfmon_Iscollecting_stats ==
true)
651 perfmon_Stat_info.old_global_stats =
NULL;
652 perfmon_Stat_info.current_global_stats =
NULL;
653 perfmon_Stat_info.base_server_stats =
NULL;
654 perfmon_Stat_info.current_server_stats =
NULL;
663 perfmon_Iscollecting_stats =
true;
666 &perfmon_Stat_info.elapsed_start_time);
671 if (perfmon_Stat_info.old_global_stats ==
NULL)
679 if (perfmon_Stat_info.current_global_stats ==
NULL)
686 if (perfmon_get_global_stats () ==
NO_ERROR)
688 perfmon_copy_values (perfmon_Stat_info.old_global_stats, perfmon_Stat_info.current_global_stats);
694 if (perfmon_Stat_info.base_server_stats ==
NULL)
701 if (perfmon_Stat_info.current_server_stats ==
NULL)
708 if (perfmon_get_stats () ==
NO_ERROR)
710 perfmon_copy_values (perfmon_Stat_info.base_server_stats, perfmon_Stat_info.current_server_stats);
722 perfmon_stop_stats (
void)
726 if (perfmon_Iscollecting_stats !=
false)
729 perfmon_Iscollecting_stats =
false;
732 if (perfmon_Stat_info.old_global_stats !=
NULL)
736 if (perfmon_Stat_info.current_global_stats !=
NULL)
740 if (perfmon_Stat_info.base_server_stats !=
NULL)
745 if (perfmon_Stat_info.current_server_stats !=
NULL)
758 perfmon_reset_stats (
void)
760 if (perfmon_Iscollecting_stats !=
false)
763 &perfmon_Stat_info.elapsed_start_time);
765 if (perfmon_get_stats () ==
NO_ERROR)
767 perfmon_copy_values (perfmon_Stat_info.base_server_stats, perfmon_Stat_info.current_server_stats);
777 perfmon_get_stats (
void)
781 if (perfmon_Iscollecting_stats !=
true)
795 perfmon_get_global_stats (
void)
800 if (perfmon_Iscollecting_stats !=
true)
805 tmp_stats = perfmon_Stat_info.current_global_stats;
806 perfmon_Stat_info.current_global_stats = perfmon_Stat_info.old_global_stats;
807 perfmon_Stat_info.old_global_stats = tmp_stats;
825 perfmon_print_stats (FILE * stream)
827 time_t cpu_total_usr_time;
828 time_t cpu_total_sys_time;
829 time_t elapsed_total_time;
830 UINT64 *diff_result =
NULL;
833 if (perfmon_Iscollecting_stats !=
true)
840 if (diff_result ==
NULL)
852 if (perfmon_get_stats () !=
NO_ERROR)
860 fprintf (stream,
"\n *** CLIENT EXECUTION STATISTICS ***\n");
862 fprintf (stream,
"System CPU (sec) = %10d\n",
863 (
int) (cpu_total_sys_time - perfmon_Stat_info.cpu_start_sys_time));
864 fprintf (stream,
"User CPU (sec) = %10d\n",
865 (
int) (cpu_total_usr_time - perfmon_Stat_info.cpu_start_usr_time));
866 fprintf (stream,
"Elapsed (sec) = %10d\n",
867 (
int) (elapsed_total_time - perfmon_Stat_info.elapsed_start_time));
870 perfmon_Stat_info.base_server_stats) !=
NO_ERROR)
878 if (diff_result !=
NULL)
891 perfmon_print_global_stats (FILE * stream,
bool cumulative,
const char *
substr)
893 UINT64 *diff_result =
NULL;
903 if (diff_result ==
NULL)
909 err = perfmon_get_global_stats ();
923 perfmon_Stat_info.old_global_stats) !=
NO_ERROR)
932 if (diff_result !=
NULL)
941 #if defined(SERVER_MODE) || defined(SA_MODE) 956 if (tran_index >= pstat_Global.
n_trans)
976 if (tran_index >= pstat_Global.
n_trans)
996 from_stats = perfmon_server_get_stats (thread_p);
998 if (from_stats !=
NULL)
1022 perfmon_get_from_statistic (
THREAD_ENTRY * thread_p,
const int statistic_id)
1026 stats = perfmon_server_get_stats (thread_p);
1029 int offset = pstat_Metadata[statistic_id].
start_offset;
1030 return stats[offset];
1042 perfmon_lk_waited_time_on_objects (
THREAD_ENTRY * thread_p,
int lock_mode, UINT64 amount)
1052 perfmon_get_stats_and_clear (
THREAD_ENTRY * thread_p,
const char *stat_name)
1059 stats = perfmon_server_get_stats (thread_p);
1062 stats_ptr = (UINT64 *) stats;
1065 if (strcmp (pstat_Metadata[i].stat_name, stat_name) == 0)
1069 switch (pstat_Metadata[i].valtype)
1074 copied = stats_ptr[offset];
1075 stats_ptr[offset] = 0;
1102 perfmon_pbx_fix (
THREAD_ENTRY * thread_p,
int page_type,
int page_found_mode,
int latch_mode,
int cond_type)
1109 module = perfmon_get_module_type (thread_p);
1128 perfmon_pbx_promote (
THREAD_ENTRY * thread_p,
int page_type,
int promote_cond,
int holder_latch,
int success,
1136 module = perfmon_get_module_type (thread_p);
1142 assert (success == 0 || success == 1);
1158 perfmon_pbx_unfix (
THREAD_ENTRY * thread_p,
int page_type,
int buf_dirty,
int dirtied_by_holder,
int holder_latch)
1165 module = perfmon_get_module_type (thread_p);
1169 assert (buf_dirty == 0 || buf_dirty == 1);
1170 assert (dirtied_by_holder == 0 || dirtied_by_holder == 1);
1184 perfmon_pbx_lock_acquire_time (
THREAD_ENTRY * thread_p,
int page_type,
int page_found_mode,
int latch_mode,
1185 int cond_type, UINT64 amount)
1192 module = perfmon_get_module_type (thread_p);
1212 perfmon_pbx_hold_acquire_time (
THREAD_ENTRY * thread_p,
int page_type,
int page_found_mode,
int latch_mode,
1220 module = perfmon_get_module_type (thread_p);
1239 perfmon_pbx_fix_acquire_time (
THREAD_ENTRY * thread_p,
int page_type,
int page_found_mode,
int latch_mode,
1240 int cond_type, UINT64 amount)
1247 module = perfmon_get_module_type (thread_p);
1267 perfmon_mvcc_snapshot (
THREAD_ENTRY * thread_p,
int snapshot,
int rec_type,
int visibility)
1287 perfmon_db_flushed_block_volumes (
THREAD_ENTRY * thread_p,
int num_volumes)
1291 assert (num_volumes >= 0);
1294 offset = num_volumes;
1310 if (!stats_diff || !new_stats || !old_stats)
1317 if (new_stats[offset] >= old_stats[offset])
1319 stats_diff[offset] = new_stats[offset] - old_stats[offset];
1323 stats_diff[offset] = 0;
1328 switch (pstat_Metadata[i].valtype)
1334 for (j = pstat_Metadata[i].start_offset; j < pstat_Metadata[
i].
start_offset + pstat_Metadata[
i].
n_vals; j++)
1336 if (new_stats[j] >= old_stats[j])
1338 stats_diff[j] = new_stats[j] - old_stats[j];
1350 stats_diff[pstat_Metadata[
i].
start_offset] = new_stats[pstat_Metadata[
i].start_offset];
1381 if (buffer ==
NULL || buf_size <= 0)
1387 remained_size = buf_size - 1;
1388 ret = snprintf (p, remained_size,
"\n *** SERVER EXECUTION STATISTICS *** \n");
1389 remained_size -= ret;
1392 if (remained_size <= 0)
1397 stats_ptr = (UINT64 *) stats;
1407 s = strstr (pstat_Metadata[i].stat_name, substr);
1422 ret = snprintf (p, remained_size,
"%-29s = %10llu\n", pstat_Metadata[i].stat_name,
1423 (
unsigned long long) stats_ptr[offset]);
1433 ret = snprintf (p, remained_size,
"%-29s = %10.2f\n", pstat_Metadata[i].stat_name,
1434 (
float) stats_ptr[offset] / 100);
1436 remained_size -= ret;
1438 if (remained_size <= 0)
1440 assert (remained_size == 0);
1446 for (; i < PSTAT_COUNT && remained_size > 0; i++)
1450 s = strstr (pstat_Metadata[i].stat_name, substr);
1461 ret = snprintf (p, remained_size,
"%s:\n", pstat_Metadata[i].stat_name);
1462 remained_size -= ret;
1464 if (remained_size <= 0)
1466 assert (remained_size == 0);
1469 pstat_Metadata[
i].
f_dump_in_buffer (&p, &(stats[pstat_Metadata[i].start_offset]), &remained_size);
1472 buffer[buf_size - 1] =
'\0';
1493 fprintf (stream,
"\n *** SERVER EXECUTION STATISTICS *** \n");
1495 stats_ptr = (UINT64 *) stats;
1505 s = strstr (pstat_Metadata[i].stat_name, substr);
1520 fprintf (stream,
"%-29s = %10llu\n", pstat_Metadata[i].stat_name,
1521 (
unsigned long long) stats_ptr[offset]);
1530 fprintf (stream,
"%-29s = %10.2f\n", pstat_Metadata[i].stat_name, (
float) stats_ptr[offset] / 100);
1539 s = strstr (pstat_Metadata[i].stat_name, substr);
1550 fprintf (stream,
"%s:\n", pstat_Metadata[i].stat_name);
1551 pstat_Metadata[
i].
f_dump_in_file (stream, &(stats[pstat_Metadata[i].start_offset]));
1567 #if defined (WINDOWS) 1572 *elapsed_time = time (
NULL);
1574 struct rusage rusage;
1580 *elapsed_time = time (
NULL);
1582 if (getrusage (RUSAGE_SELF, &rusage) == 0)
1584 *cpu_user_time = rusage.ru_utime.tv_sec;
1585 *cpu_sys_time = rusage.ru_stime.tv_sec;
1604 int page_found_mode;
1609 UINT64 total_unfix_vacuum = 0;
1610 UINT64 total_unfix_vacuum_dirty = 0;
1611 UINT64 total_unfix = 0;
1612 UINT64 total_fix_vacuum = 0;
1613 UINT64 total_fix_vacuum_hit = 0;
1614 UINT64 fix_time_usec = 0;
1615 UINT64 lock_time_usec = 0;
1616 UINT64 hold_time_usec = 0;
1617 UINT64 total_promote_time = 0;
1624 for (buf_dirty = 0; buf_dirty <= 1; buf_dirty++)
1626 for (holder_dirty = 0; holder_dirty <= 1; holder_dirty++)
1635 total_unfix += counter;
1638 total_unfix_vacuum += counter;
1639 if (holder_dirty == 1)
1641 total_unfix_vacuum_dirty += counter;
1662 if (page_type !=
PAGE_LOG && counter > 0)
1664 hold_time_usec += counter;
1673 if (page_type !=
PAGE_LOG && counter > 0)
1675 fix_time_usec += counter;
1682 if (page_type !=
PAGE_LOG && counter > 0)
1684 lock_time_usec += counter;
1698 total_fix_vacuum += counter;
1701 total_fix_vacuum_hit += counter;
1712 SAFE_DIV (total_unfix_vacuum_dirty * 100 * 100, total_unfix_vacuum);
1715 SAFE_DIV (total_unfix_vacuum * 100 * 100, total_unfix);
1718 SAFE_DIV (total_fix_vacuum_hit * 100 * 100, total_fix_vacuum);
1748 for (success = 0; success < 2; success++)
1756 total_promote_time += counter;
1781 #if defined (SERVER_MODE) 1800 perfmon_peek_thread_daemon_stats (stats);
1804 #endif // SERVER_MODE 1810 int offset = pstat_Metadata[
i].start_offset;
1838 #if defined (SERVER_MODE) || defined (SA_MODE) 1845 #if defined (SERVER_MODE) 1846 if (thread_p ==
NULL)
1851 switch (thread_p->type)
1876 return "PAGE_UNKNOWN";
1882 return "PAGE_VOLHEADER";
1884 return "PAGE_VOLBITMAP";
1886 return "PAGE_QRESULT";
1888 return "PAGE_EHASH";
1890 return "PAGE_OVERFLOW";
1894 return "PAGE_CATALOG";
1896 return "PAGE_BTREE";
1900 return "PAGE_DROPPED";
1902 return "PAGE_VACUUM_DATA";
1904 return "PAGE_BTREE_R";
1906 return "PAGE_BTREE_O";
1908 return "PAGE_BTREE_L";
1910 return "PAGE_BTREE_N";
1928 return "OLD_NO_WAIT";
1932 return "NEW_NO_WAIT";
1934 return "OLD_PAGE_IN_PB";
1947 switch (holder_latch)
1974 return "UNCOND_WAIT";
2012 return "INS_VACUUMED";
2018 return "INS_COMMITTED";
2020 return "INS_COMMITTED_L";
2022 return "INS_DELETED";
2024 return "DELETED_CURR";
2026 return "DELETED_OTHER";
2028 return "DELETED_COMMITED";
2030 return "DELETED_COMMITED_L";
2049 return "SCH_S_LOCK";
2063 return "SCH_M_LOCK";
2079 return "ONLY_READER";
2081 return "SHARED_READER";
2126 counter = stats_ptr[offset];
2132 ret = snprintf (*s, *remaining_size,
"%-6s,%-14s,%-18s,%-5s,%-11s = %10llu\n",
2137 *remaining_size -= ret;
2139 if (*remaining_size <= 0)
2183 counter = stats_ptr[offset];
2192 (
long long unsigned int) counter);
2232 for (success = 0; success < 2; success++)
2239 counter = stats_ptr[offset];
2245 ret = snprintf (*s, *remaining_size,
"%-6s,%-14s,%-13s,%-5s,%-7s = %10llu\n",
2249 (success ?
"SUCCESS" :
"FAILED"), (
long long unsigned int) counter);
2250 *remaining_size -= ret;
2252 if (*remaining_size <= 0)
2291 for (success = 0; success < 2; success++)
2296 counter = stats_ptr[offset];
2305 (
long long unsigned int) counter);
2342 for (buf_dirty = 0; buf_dirty <= 1; buf_dirty++)
2344 for (holder_dirty = 0; holder_dirty <= 1; holder_dirty++)
2352 counter = stats_ptr[offset];
2358 ret = snprintf (*s, *remaining_size,
"%-6s,%-14s,%-13s,%-16s,%-5s = %10llu\n",
2360 buf_dirty ?
"BUF_DIRTY" :
"BUF_NON_DIRTY",
2361 holder_dirty ?
"HOLDER_DIRTY" :
"HOLDER_NON_DIRTY",
2363 (
long long unsigned int) counter);
2364 *remaining_size -= ret;
2366 if (*remaining_size <= 0)
2401 for (buf_dirty = 0; buf_dirty <= 1; buf_dirty++)
2403 for (holder_dirty = 0; holder_dirty <= 1; holder_dirty++)
2410 counter = stats_ptr[offset];
2418 holder_dirty ?
"HOLDER_DIRTY" :
"HOLDER_NON_DIRTY",
2464 counter = stats_ptr[offset];
2470 ret = snprintf (*s, *remaining_size,
"%-6s,%-14s,%-18s,%-5s,%-11s = %16llu\n",
2475 *remaining_size -= ret;
2477 if (*remaining_size <= 0)
2521 counter = stats_ptr[offset];
2530 (
long long unsigned int) counter);
2572 counter = stats_ptr[offset];
2578 ret = snprintf (*s, *remaining_size,
"%-6s,%-14s,%-18s,%-5s = %16llu\n",
2582 *remaining_size -= ret;
2584 if (*remaining_size <= 0)
2626 counter = stats_ptr[offset];
2681 unsigned int snapshot;
2682 unsigned int rec_type;
2683 unsigned int visibility;
2704 counter = stats_ptr[offset];
2714 (
long long unsigned int) counter);
2715 *remaining_size -= ret;
2717 if (*remaining_size <= 0)
2737 unsigned int snapshot;
2738 unsigned int rec_type;
2739 unsigned int visibility;
2757 counter = stats_ptr[offset];
2766 (
long long unsigned int) counter);
2783 unsigned int lock_mode;
2791 for (lock_mode = (
unsigned int)
NA_LOCK; lock_mode <= (
unsigned int)
SCH_M_LOCK; lock_mode++)
2793 counter = stats_ptr[lock_mode];
2800 (
long long unsigned int) counter);
2801 *remaining_size -= ret;
2803 if (*remaining_size <= 0)
2828 counter = stats_ptr[lock_mode];
2849 unsigned int flushed_block_volumes;
2859 for (flushed_block_volumes = (
unsigned int) 0;
2862 counter = stats_ptr[flushed_block_volumes];
2868 sprintf (buffer,
"%d Volumes", flushed_block_volumes);
2869 ret = snprintf (*s, *remaining_size,
"%-15s = %16llu\n", buffer, (
long long unsigned int) counter);
2870 *remaining_size -= ret;
2872 if (*remaining_size <= 0)
2890 unsigned int flushed_block_volumes;
2896 for (flushed_block_volumes = (
unsigned int) 0;
2899 counter = stats_ptr[flushed_block_volumes];
2905 sprintf (buffer,
"%d Volumes", flushed_block_volumes);
2906 fprintf (stream,
"%-15s = %16llu\n", buffer, (
long long unsigned int) counter);
2934 assert (offset < PERF_MODULE_CNT);
2935 counter = stats_ptr[offset];
2942 (
long long unsigned int) counter);
2943 *remaining_size -= ret;
2945 if (*remaining_size <= 0)
2972 assert (offset < PERF_MODULE_CNT);
2973 counter = stats_ptr[offset];
2993 #if defined (SERVER_MODE) || defined (SA_MODE) 3006 #if defined (SERVER_MODE) 3018 switch (pstat_Metadata[idx].valtype)
3023 pstat_Metadata[idx].
n_vals = 1;
3027 pstat_Metadata[idx].
n_vals = 1;
3036 pstat_Metadata[idx].
n_vals = 4;
3041 pstat_Metadata[idx].
n_vals = pstat_Metadata[idx].
f_load ();
3042 if (pstat_Metadata[idx].n_vals < 0)
3046 return pstat_Metadata[idx].
n_vals;
3049 assert (pstat_Metadata[idx].f_dump_in_file !=
NULL);
3050 assert (pstat_Metadata[idx].f_dump_in_buffer !=
NULL);
3055 #if defined (SERVER_MODE) || defined (SA_MODE) 3057 #if !defined (HAVE_ATOMIC_BUILTINS) 3072 pstat_Global.
n_trans = num_trans + 1;
3073 memsize = pstat_Global.
n_trans *
sizeof (UINT64 *);
3074 pstat_Global.
tran_stats = (UINT64 **) malloc (memsize);
3081 pstat_Global.
tran_stats[0] = (UINT64 *) malloc (memsize);
3087 memset (pstat_Global.
tran_stats[0], 0, memsize);
3089 for (idx = 1; idx < pstat_Global.
n_trans; idx++)
3095 pstat_Global.
is_watching = (
bool *) malloc (memsize);
3141 #if defined (SERVER_MODE) || defined (SA_MODE) 3142 #if !defined (HAVE_ATOMIC_BUILTINS) 3152 #if defined (SERVER_MODE) || defined (SA_MODE) 3167 assert (tran_index >= 0 && tran_index < pstat_Global.
n_trans);
3175 #if defined (HAVE_ATOMIC_BUILTINS) 3201 assert (tran_index >= 0 && tran_index < pstat_Global.
n_trans);
3209 #if defined (HAVE_ATOMIC_BUILTINS) 3210 ATOMIC_INC_32 (&pstat_Global.
n_watchers, -1);
3804 #if defined (SERVER_MODE) || defined (SA_MODE) 3827 fprintf (stream,
"The timer values for %s are:\n", pstat_Metadata[stat_index].stat_name);
3828 fprintf (stream,
"Num_%-25s = %10llu\n", pstat_Metadata[stat_index].stat_name,
3830 fprintf (stream,
"Total_time_%-18s = %10llu\n", pstat_Metadata[stat_index].stat_name,
3832 fprintf (stream,
"Max_time_%-20s = %10llu\n", pstat_Metadata[stat_index].stat_name,
3834 fprintf (stream,
"Avg_time_%-20s = %10llu\n", pstat_Metadata[stat_index].stat_name,
3857 ret = snprintf (*s, *remained_size,
"The timer values for %s are:\n", pstat_Metadata[stat_index].stat_name);
3858 *remained_size -= ret;
3860 ret = snprintf (*s, *remained_size,
"Num_%-25s = %10llu\n", pstat_Metadata[stat_index].stat_name,
3862 *remained_size -= ret;
3864 ret = snprintf (*s, *remained_size,
"Total_time_%-18s = %10llu\n", pstat_Metadata[stat_index].stat_name,
3866 *remained_size -= ret;
3868 ret = snprintf (*s, *remained_size,
"Max_time_%-20s = %10llu\n", pstat_Metadata[stat_index].stat_name,
3870 *remained_size -= ret;
3872 ret = snprintf (*s, *remained_size,
"Avg_time_%-20s = %10llu\n", pstat_Metadata[stat_index].stat_name,
3874 *remained_size -= ret;
3899 "Counter_start_thread",
3900 "Timer_start_thread",
3901 "Counter_create_context",
3902 "Timer_create_context",
3903 "Counter_execute_task",
3904 "Timer_execute_task",
3905 "Counter_retire_task",
3906 "Timer_retire_task",
3907 "Counter_found_task_in_queue",
3908 "Timer_found_task_in_queue",
3909 "Counter_wakeup_with_task",
3910 "Timer_wakeup_with_task",
3911 "Counter_recycle_context",
3912 "Timer_recycle_context",
3913 "Counter_retire_context",
3914 "Timer_retire_context" 3922 #if defined (SERVER_MODE) 3924 static bool check_names =
true;
3933 "Warning - Monitoring thread worker statistics; statistics name not matching for %zu\n" 3934 "\t\tperfmon name = %s\n" "\t\tdaemon name = %s\n", index,
3938 check_names =
false;
3940 #endif // SERVER_MODE 3953 return perfmon_Portable_worker_stat_names[
index];
3988 value = stats_ptr[it];
4032 value = stats_ptr[it];
4038 (
long long unsigned int) value);
4040 *remaining_size -= ret;
4042 if (*remaining_size <= 0)
4057 "daemon_loop_count",
4058 "daemon_execute_time",
4059 "daemon_pause_time",
4062 "looper_sleep_count",
4063 "looper_sleep_time",
4064 "looper_reset_count",
4067 "waiter_wakeup_count",
4068 "waiter_lock_wakeup_count",
4069 "waiter_sleep_count",
4070 "waiter_timeout_count",
4071 "waiter_no_sleep_count",
4072 "waiter_awake_count",
4073 "waiter_wakeup_delay_time",
4082 "Page_flush_daemon_thread",
4083 "Page_post_flush_daemon_thread",
4084 "Page_flush_control_daemon_thread",
4085 "Page_maintenance_daemon_thread",
4086 "Deadlock_detect_daemon_thread",
4087 "Log_flush_daemon_thread",
4094 #if defined (SERVER_MODE) && !defined (NDEBUG) 4097 static bool check_names =
true;
4106 "Warning - Monitoring daemon statistics; statistics name not matching for %zu\n" 4107 "\t\tperfmon name = %s\n" "\t\tdaemon name = %s\n", index,
4111 check_names =
false;
4113 #endif // SERVER_MODE and DEBUG 4126 assert (index < PERFMON_PORTABLE_DAEMON_STAT_COUNT);
4127 return perfmon_Portable_daemon_stat_names[
index];
4171 fprintf (stream,
"%s.%s = %16llu\n", perfmon_Portable_daemon_names[daemon_it],
4216 ret = snprintf (*s, *remaining_size,
"%s.%s = %16llu\n", perfmon_Portable_daemon_names[daemon_it],
4219 *remaining_size -= ret;
4221 if (*remaining_size <= 0)
4229 #if defined (SERVER_MODE) 4231 perfmon_peek_thread_daemon_stats (UINT64 * stats)
4238 lock_deadlock_detect_daemon_get_stats (statsp);
4242 log_flush_daemon_get_stats (statsp);
4245 #endif // SERVER_MODE 4247 #if defined (SERVER_MODE) || defined (SA_MODE) 4260 const size_t STATS_DUMP_MAX_SIZE =
ONE_M;
4261 char *strbuf =
new char[STATS_DUMP_MAX_SIZE];
4270 #endif // SERVER_MODE || SA_MODE static std::size_t get_stats_value_count(void)
STATIC_INLINE const char * perfmon_stat_module_name(const int module) __attribute__((ALWAYS_INLINE))
int perfmon_server_start_stats(void)
static void perfmon_stat_dump_in_file_flushed_block_volumes_array_stat(FILE *stream, const UINT64 *stats_ptr)
static void perfmon_stat_dump_in_file_mvcc_snapshot_array_stat(FILE *stream, const UINT64 *stats_ptr)
static void perfmon_print_timer_to_buffer(char **s, int stat_index, UINT64 *stats_ptr, int *remained_size)
static void perfmon_stat_dump_in_buffer_page_lock_time_array_stat(const UINT64 *stats_ptr, char **s, int *remaining_size)
static void f_dump_in_buffer_Num_data_page_promote_time_ext(char **, const UINT64 *stat_vals, int *remaining_size)
static void perfmon_stat_dump_in_file_obj_lock_array_stat(FILE *stream, const UINT64 *stats_ptr)
cubthread::entry * thread_get_thread_entry_info(void)
char * perfmon_pack_stats(char *buf, UINT64 *stats)
int perfmon_server_copy_global_stats(UINT64 *to_stats)
static const char * perfmon_Portable_daemon_names[]
void worker_manager_get_stats(UINT64 *stats_out)
std::size_t wp_worker_statset_get_count(void)
#define pthread_mutex_init(a, b)
static void f_dump_in_file_Num_data_page_unfix_ext(FILE *, const UINT64 *stat_vals)
static int f_load_thread_daemon_stats(void)
#define PSTAT_COUNTER_TIMER_TOTAL_TIME_VALUE(startvalp)
static int f_load_Num_data_page_promote_ext(void)
static int f_load_Count_get_snapshot_retry(void)
static int f_load_Time_tran_complete_time(void)
void perfmon_get_current_times(time_t *cpu_user_time, time_t *cpu_sys_time, time_t *elapsed_time)
int perfmon_calc_diff_stats(UINT64 *stats_diff, UINT64 *new_stats, UINT64 *old_stats)
static void f_dump_in_file_Time_data_page_fix_acquire_time(FILE *, const UINT64 *stat_vals)
#define pthread_mutex_unlock(a)
static int f_load_Time_get_snapshot_acquire_time(void)
static int f_load_Time_data_page_lock_acquire_time(void)
PSTAT_METADATA pstat_Metadata[]
static void f_dump_in_buffer_Num_data_page_fix_ext(char **, const UINT64 *stat_vals, int *remaining_size)
static void f_dump_in_buffer_Time_data_page_lock_acquire_time(char **, const UINT64 *stat_vals, int *remaining_size)
static int f_load_Time_get_oldest_mvcc_acquire_time(void)
static void f_dump_in_file_Time_data_page_hold_acquire_time(FILE *, const UINT64 *stat_vals)
static void perfmon_stat_dump_in_file_snapshot_array_stat(FILE *, const UINT64 *stats_ptr)
#define PERF_PAGE_UNFIX_COUNTERS
static void perfmon_stat_dump_in_file_page_fix_time_array_stat(FILE *, const UINT64 *stats_ptr)
static int f_load_Num_data_page_unfix_ext(void)
#define PERF_PAGE_HOLD_TIME_OFFSET(module, page_type, page_found_mode, latch_mode)
static int f_load_Num_mvcc_snapshot_ext(void)
#define PSTAT_COUNTER_TIMER_MAX_TIME_VALUE(startvalp)
const char * perfmon_Portable_worker_stat_names[]
int heap_get_best_space_num_stats_entries(void)
static void perfmon_stat_dump_in_buffer_thread_stats(const UINT64 *stats_ptr, char **s, int *remaining_size)
#define PSTAT_COUNTER_TIMER_AVG_TIME_VALUE(startvalp)
static void perfmon_stat_dump_in_buffer_page_hold_time_array_stat(const UINT64 *stats_ptr, char **s, int *remaining_size)
static void perfmon_stat_dump_in_buffer_thread_daemon_stats(const UINT64 *stats_ptr, char **s, int *remaining_size)
#define PERF_PAGE_HOLD_TIME_COUNTERS
STATIC_INLINE const char * perfmon_stat_cond_type_name(const int cond_type) __attribute__((ALWAYS_INLINE))
void _er_log_debug(const char *file_name, const int line_no, const char *fmt,...)
static const char * perfmon_thread_daemon_name(size_t index)
static void perfmon_stat_dump_in_buffer_snapshot_array_stat(const UINT64 *stats_ptr, char **s, int *remaining_size)
static void perfmon_stat_dump_in_file_page_lock_time_array_stat(FILE *, const UINT64 *stats_ptr)
#define PERF_PAGE_PROMOTE_STAT_OFFSET(module, page_type, promote_cond, holder_latch, success)
pthread_mutex_t watch_lock
#define PERF_PAGE_FIX_STAT_OFFSET(module, page_type, page_found_mode, latch_mode, cond_type)
#define PERF_DWB_FLUSHED_BLOCK_VOLUMES_CNT
char * perfmon_allocate_packed_values_buffer(void)
static void f_dump_in_file_Num_dwb_flushed_block_volumes(FILE *, const UINT64 *stat_vals)
static void perfmon_stat_dump_in_file_fix_page_array_stat(FILE *, const UINT64 *stats_ptr)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
#define ASSERT_ALIGN(ptr, alignment)
static void perfmon_stat_dump_in_buffer_flushed_block_volumes_array_stat(const UINT64 *stats_ptr, char **s, int *remaining_size)
int prm_get_integer_value(PARAM_ID prm_id)
char * perfmon_unpack_stats(char *buf, UINT64 *stats)
static void perfmon_server_calc_stats(UINT64 *stats)
static const size_t PERFMON_PORTABLE_WORKER_STAT_COUNT
#define ER_OUT_OF_VIRTUAL_MEMORY
static void f_dump_in_file_Time_data_page_lock_acquire_time(FILE *, const UINT64 *stat_vals)
#define PSTAT_METADATA_INIT_COUNTER_TIMER(id, name)
STATIC_INLINE void perfmon_add_stat_at_offset(THREAD_ENTRY *thread_p, PERF_STAT_ID psid, const int offset, UINT64 amount) __attribute__((ALWAYS_INLINE))
int perfmon_get_number_of_statistic_values(void)
static void perfmon_stat_dump_in_buffer_page_fix_time_array_stat(const UINT64 *stats_ptr, char **s, int *remaining_size)
int substr(std::string &result, bool &is_matched, const cub_regex_object ®, const std::string &src, const int position, const int occurrence, const INTL_CODESET codeset)
static int f_load_Time_data_page_fix_acquire_time(void)
int perfmon_initialize(int num_trans)
static const size_t PERFMON_PORTABLE_DAEMON_STAT_COUNT
static void perfmon_stat_dump_in_file_thread_stats(FILE *stream, const UINT64 *stats_ptr)
const char * wp_worker_statset_get_name(std::size_t stat_index)
static void perfmon_stat_dump_in_file_promote_page_array_stat(FILE *, const UINT64 *stats_ptr)
#define PSTAT_METADATA_INIT_COMPUTED_RATIO(id, name)
#define PERF_PAGE_LOCK_TIME_OFFSET(module, page_type, page_found_mode, latch_mode, cond_type)
#define PERF_PAGE_PROMOTE_COUNTERS
static void f_dump_in_buffer_Num_dwb_flushed_block_volumes(char **s, const UINT64 *stat_vals, int *remaining_size)
#define PERF_PAGE_FIX_COUNTERS
void perfmon_finalize(void)
static const size_t PERFMON_PORTABLE_DAEMON_COUNT
static size_t perfmon_thread_daemon_stats_count(void)
static void f_dump_in_file_Num_data_page_fix_ext(FILE *, const UINT64 *stat_vals)
static void perfmon_stat_dump_in_buffer_obj_lock_array_stat(const UINT64 *stats_ptr, char **s, int *remaining_size)
static void perfmon_stat_dump_in_buffer_mvcc_snapshot_array_stat(const UINT64 *stats_ptr, char **s, int *remaining_size)
void xperfmon_server_copy_stats(THREAD_ENTRY *thread_p, UINT64 *to_stats)
static void f_dump_in_buffer_thread_stats(char **s, const UINT64 *stat_vals, int *remaining_size)
#define OR_GET_INT64(ptr, val)
STATIC_INLINE const char * perfmon_stat_holder_latch_name(const int holder_latch) __attribute__((ALWAYS_INLINE))
STATIC_INLINE const char * perfmon_stat_page_type_name(const int page_type) __attribute__((ALWAYS_INLINE))
int perfmon_server_stop_stats(void)
static void f_dump_in_file_Time_obj_lock_acquire_time(FILE *, const UINT64 *stat_vals)
static int f_load_thread_stats(void)
static void f_dump_in_buffer_Num_data_page_promote_ext(char **, const UINT64 *stat_vals, int *remaining_size)
#define PERF_OBJ_LOCK_STAT_COUNTERS
#define PSTAT_METADATA_INIT_SINGLE_ACC(id, name)
#define PERF_MVCC_SNAPSHOT_OFFSET(snapshot, rec_type, visibility)
STATIC_INLINE const char * perfmon_stat_promote_cond_name(const int cond_type) __attribute__((ALWAYS_INLINE))
#define PERF_MVCC_SNAPSHOT_COUNTERS
static int f_load_Num_data_page_promote_time_ext(void)
static void error(const char *msg)
static const char * perfmon_Portable_daemon_stat_names[]
STATIC_INLINE const char * perfmon_stat_snapshot_record_type(const int rec_type) __attribute__((ALWAYS_INLINE))
static void f_dump_in_buffer_Num_mvcc_snapshot_ext(char **, const UINT64 *stat_vals, int *remaining_size)
int perfmon_server_copy_stats(UINT64 *to_stats)
void css_get_thread_stats(UINT64 *stats_out)
#define LOG_FIND_THREAD_TRAN_INDEX(thrd)
static int f_load_Time_obj_lock_acquire_time(void)
int session_get_number_of_holdable_cursors(void)
void pgbuf_daemons_get_stats(UINT64 *stats_out)
static void f_dump_in_file_thread_daemon_stats(FILE *f, const UINT64 *stat_vals)
static void f_dump_in_buffer_Num_data_page_unfix_ext(char **, const UINT64 *stat_vals, int *remaining_size)
static void f_dump_in_buffer_Time_obj_lock_acquire_time(char **, const UINT64 *stat_vals, int *remaining_size)
int xcache_get_entry_count(void)
static void perfmon_stat_dump_in_buffer_promote_page_array_stat(const UINT64 *stats_ptr, char **s, int *remaining_size)
#define PERF_PAGE_FIX_TIME_OFFSET(module, page_type, page_found_mode, latch_mode, cond_type)
#define free_and_init(ptr)
#define OR_PUT_INT64(ptr, val)
static void perfmon_stat_dump_in_buffer_unfix_page_array_stat(const UINT64 *stats_ptr, char **s, int *remaining_size)
static void perfmon_stat_dump_in_file_unfix_page_array_stat(FILE *, const UINT64 *stats_ptr)
static int f_load_Num_dwb_flushed_block_volumes(void)
STATIC_INLINE size_t thread_stats_count(void)
STATIC_INLINE const char * perfmon_stat_page_mode_name(const int page_mode) __attribute__((ALWAYS_INLINE))
void perfmon_server_dump_stats(const UINT64 *stats, FILE *stream, const char *substr)
bool prm_get_bool_value(PARAM_ID prm_id)
static void perfmon_stat_dump_in_file_thread_daemon_stats(FILE *stream, const UINT64 *stats_ptr)
#define PSTAT_COUNTER_TIMER_COUNT_VALUE(startvalp)
static void f_dump_in_buffer_Time_data_page_fix_acquire_time(char **, const UINT64 *stat_vals, int *remaining_size)
PSTAT_GLOBAL pstat_Global
void perfmon_server_dump_stats_to_buffer(const UINT64 *stats, char *buffer, int buf_size, const char *substr)
static int f_load_Num_data_page_fix_ext(void)
#define PERF_PAGE_FIX_TIME_COUNTERS
static void f_dump_in_buffer_Time_data_page_hold_acquire_time(char **, const UINT64 *stat_vals, int *remaining_size)
UINT64 * perfmon_allocate_values(void)
static void f_dump_in_buffer_thread_daemon_stats(char **s, const UINT64 *stat_vals, int *remaining_size)
static void f_dump_in_file_Num_data_page_promote_ext(FILE *, const UINT64 *stat_vals)
STATIC_INLINE void perfmon_add_stat(THREAD_ENTRY *thread_p, PERF_STAT_ID psid, UINT64 amount) __attribute__((ALWAYS_INLINE))
static void f_dump_in_file_thread_stats(FILE *f, const UINT64 *stat_vals)
#define pthread_mutex_lock(a)
void xperfmon_server_copy_global_stats(UINT64 *to_stats)
STATIC_INLINE const char * perfmon_stat_lock_mode_name(const int lock_mode) __attribute__((ALWAYS_INLINE))
static size_t perfmon_per_daemon_stat_count(void)
static const char * get_stat_name(std::size_t stat_index)
static void perfmon_stat_dump_in_buffer_fix_page_array_stat(const UINT64 *stats_ptr, char **s, int *remaining_size)
#define PERF_PAGE_UNFIX_STAT_OFFSET(module, page_type, buf_dirty, dirtied_by_holder, holder_latch)
#define PERF_PAGE_LOCK_TIME_COUNTERS
STATIC_INLINE void perfmon_get_peek_stats(UINT64 *stats) __attribute__((ALWAYS_INLINE))
void pgbuf_peek_stats(UINT64 *fixed_cnt, UINT64 *dirty_cnt, UINT64 *lru1_cnt, UINT64 *lru2_cnt, UINT64 *lru3_cnt, UINT64 *victim_candidates, UINT64 *avoid_dealloc_cnt, UINT64 *avoid_victim_cnt, UINT64 *private_quota, UINT64 *private_cnt, UINT64 *alloc_bcb_waiter_high, UINT64 *alloc_bcb_waiter_med, UINT64 *flushed_bcbs_waiting_direct_assign, UINT64 *lfcq_big_prv_num, UINT64 *lfcq_prv_num, UINT64 *lfcq_shr_num)
static void f_dump_in_file_Num_data_page_promote_time_ext(FILE *, const UINT64 *stat_vals)
static void perfmon_print_timer_to_file(FILE *stream, int stat_index, UINT64 *stats_ptr)
static int f_load_Count_get_oldest_mvcc_retry(void)
#define PERFMON_VALUES_MEMSIZE
#define PSTAT_METADATA_INIT_COMPLEX(id, name, f_dump_in_file, f_dump_in_buffer, f_load)
#define PSTAT_METADATA_INIT_SINGLE_PEEK(id, name)
static void perfmon_stat_dump_in_file_page_hold_time_array_stat(FILE *, const UINT64 *stats_ptr)
static const char * perfmon_stat_thread_stat_name(size_t index)
void perfmon_copy_values(UINT64 *dest, UINT64 *src)
STATIC_INLINE void perfmon_add_at_offset(THREAD_ENTRY *thread_p, int offset, UINT64 amount) __attribute__((ALWAYS_INLINE))
static int f_load_Time_data_page_hold_acquire_time(void)
#define pthread_mutex_destroy(a)
static void f_dump_in_file_Num_mvcc_snapshot_ext(FILE *, const UINT64 *stat_vals)
STATIC_INLINE const char * perfmon_stat_snapshot_name(const int snapshot) __attribute__((ALWAYS_INLINE))