#include "univ.i"#include <time.h>#include <ctype.h>Include dependency graph for ut0ut.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Typedefs | |
| typedef time_t | ib_time_t |
Functions | |
| ulint | ut_get_high32 (ulint a) |
| UNIV_INLINE ulint | ut_min (ulint n1, ulint n2) |
| UNIV_INLINE ulint | ut_max (ulint n1, ulint n2) |
| UNIV_INLINE void | ut_pair_min (ulint *a, ulint *b, ulint a1, ulint b1, ulint a2, ulint b2) |
| UNIV_INLINE int | ut_ulint_cmp (ulint a, ulint b) |
| UNIV_INLINE int | ut_pair_cmp (ulint a1, ulint a2, ulint b1, ulint b2) |
| UNIV_INLINE ulint | ut_2pow_remainder (ulint n, ulint m) |
| UNIV_INLINE ulint | ut_2pow_round (ulint n, ulint m) |
| UNIV_INLINE ulint | ut_2_log (ulint n) |
| UNIV_INLINE ulint | ut_2_exp (ulint n) |
| ulint | ut_2_power_up (ulint n) |
| void | ut_ulint_sort (ulint *arr, ulint *aux_arr, ulint low, ulint high) |
| ulint | ut_clock (void) |
| ib_time_t | ut_time (void) |
| void | ut_usectime (ulint *sec, ulint *ms) |
| double | ut_difftime (ib_time_t time2, ib_time_t time1) |
| void | ut_print_timestamp (FILE *file) |
| void | ut_sprintf_timestamp (char *buf) |
| void | ut_sprintf_timestamp_without_extra_chars (char *buf) |
| void | ut_get_year_month_day (ulint *year, ulint *month, ulint *day) |
| ulint | ut_delay (ulint delay) |
| void | ut_print_buf (FILE *file, const void *buf, ulint len) |
| void | ut_print_filename (FILE *f, const char *name) |
| void | ut_print_name (FILE *f, struct trx_struct *trx, ibool table_id, const char *name) |
| void | ut_print_namel (FILE *f, struct trx_struct *trx, ibool table_id, const char *name, ulint namelen) |
| void | ut_copy_file (FILE *dest, FILE *src) |
Referenced by mem_area_alloc(), mem_area_free(), mem_pool_create(), mem_pool_fill_free_list(), mem_pool_print_info(), and mem_pool_validate().
Here is the caller graph for this function:

Referenced by mem_area_alloc(), mem_area_free(), and mem_pool_create().
Here is the caller graph for this function:

Definition at line 352 of file ut0ut.c.
References ut_ad.
Referenced by hash_create_mutexes(), and mem_area_free().
00354 : first power of 2 which is >= n */ 00355 ulint n) /* in: number != 0 */ 00356 { 00357 ulint res; 00358 00359 res = 1; 00360 00361 ut_ad(n > 0); 00362 00363 while (res < n) { 00364 res = res * 2; 00365 } 00366 00367 return(res); 00368 }
Here is the caller graph for this function:

| ulint ut_clock | ( | void | ) |
| void ut_copy_file | ( | FILE * | dest, | |
| FILE * | src | |||
| ) |
Definition at line 447 of file ut0ut.c.
References buf.
Referenced by lock_print_info_summary(), and srv_printf_innodb_monitor().
00449 : output file */ 00450 FILE* src) /* in: input file to be appended to output */ 00451 { 00452 long len = ftell(src); 00453 char buf[4096]; 00454 00455 rewind(src); 00456 do { 00457 size_t maxs = 00458 len < (long) sizeof buf ? (size_t) len : sizeof buf; 00459 size_t size = fread(buf, 1, maxs, src); 00460 fwrite(buf, 1, size, dest); 00461 len -= (long) size; 00462 if (size < maxs) { 00463 break; 00464 } 00465 } while (len > 0); 00466 }
Here is the caller graph for this function:

Definition at line 286 of file ut0ut.c.
References ut_always_false.
Referenced by mutex_spin_wait(), rw_lock_s_lock_spin(), and rw_lock_x_lock_func().
00288 : dummy value */ 00289 ulint delay) /* in: delay in microseconds on 100 MHz Pentium */ 00290 { 00291 ulint i, j; 00292 00293 j = 0; 00294 00295 for (i = 0; i < delay * 50; i++) { 00296 j += i; 00297 } 00298 00299 if (ut_always_false) { 00300 ut_always_false = (ibool) j; 00301 } 00302 00303 return(j); 00304 }
Here is the caller graph for this function:

Definition at line 105 of file ut0ut.c.
Referenced by srv_lock_timeout_and_monitor_thread(), and srv_suspend_mysql_thread().
00107 : time2 - time1 expressed in seconds */ 00108 ib_time_t time2, /* in: time */ 00109 ib_time_t time1) /* in: time */ 00110 { 00111 return(difftime(time2, time1)); 00112 }
Here is the caller graph for this function:

Definition at line 248 of file ut0ut.c.
References localtime_r().
00250 : current year */ 00251 ulint* month, /* out: month */ 00252 ulint* day) /* out: day */ 00253 { 00254 #ifdef __WIN__ 00255 SYSTEMTIME cal_tm; 00256 00257 GetLocalTime(&cal_tm); 00258 00259 *year = (ulint)cal_tm.wYear; 00260 *month = (ulint)cal_tm.wMonth; 00261 *day = (ulint)cal_tm.wDay; 00262 #else 00263 struct tm cal_tm; 00264 struct tm* cal_tm_ptr; 00265 time_t tm; 00266 00267 time(&tm); 00268 00269 #ifdef HAVE_LOCALTIME_R 00270 localtime_r(&tm, &cal_tm); 00271 cal_tm_ptr = &cal_tm; 00272 #else 00273 cal_tm_ptr = localtime(&tm); 00274 #endif 00275 *year = (ulint)cal_tm_ptr->tm_year + 1900; 00276 *month = (ulint)cal_tm_ptr->tm_mon + 1; 00277 *day = (ulint)cal_tm_ptr->tm_mday; 00278 #endif 00279 }
Here is the call graph for this function:

Referenced by dict_table_add_to_cache(), mem_area_alloc(), and row_create_index_for_mysql().
Here is the caller graph for this function:

Referenced by btr_cur_optimistic_insert(), btr_cur_pessimistic_insert(), btr_cur_pessimistic_update(), btr_search_validate(), dtuple_convert_big_rec(), fil_extend_space_to_desired_size(), ibuf_get_merge_page_nos(), log_calc_max_ages(), os_file_set_size(), page_cur_insert_rec_write_log(), ut_strlcpy(), and ut_strlcpy_rev().
Here is the caller graph for this function:

| void ut_print_buf | ( | FILE * | file, | |
| const void * | buf, | |||
| ulint | len | |||
| ) |
Definition at line 310 of file ut0ut.c.
References data.
Referenced by btr_pcur_restore_position(), buf_flush_ready_for_replace(), buf_page_print(), dfield_print_raw(), fseg_free_page_low(), fsp_alloc_free_page(), fsp_free_extent(), fsp_free_page(), mem_analyze_corruption(), mem_heap_validate_or_print(), os_fast_mutex_free(), page_cur_parse_insert_rec(), rec_print_new(), rec_print_old(), recv_report_corrupt_log(), row_fetch_print(), row_sel_convert_mysql_key_to_innobase(), trx_free(), and trx_undo_prev_version_build().
00312 : file where to print */ 00313 const void* buf, /* in: memory buffer */ 00314 ulint len) /* in: length of the buffer */ 00315 { 00316 const byte* data; 00317 ulint i; 00318 00319 fprintf(file, " len %lu; hex ", len); 00320 00321 for (data = (const byte*)buf, i = 0; i < len; i++) { 00322 fprintf(file, "%02lx", (ulong)*data++); 00323 } 00324 00325 fputs("; asc ", file); 00326 00327 data = (const byte*)buf; 00328 00329 for (i = 0; i < len; i++) { 00330 int c = (int) *data++; 00331 putc(isprint(c) ? c : ' ', file); 00332 } 00333 00334 putc(';', file); 00335 }
Here is the caller graph for this function:

| void ut_print_filename | ( | FILE * | f, | |
| const char * | name | |||
| ) |
Definition at line 374 of file ut0ut.c.
Referenced by fil_create_new_single_table_tablespace(), fil_delete_tablespace(), fil_load_single_table_tablespaces(), fil_mutex_enter_and_prepare_for_io(), fil_node_create(), fil_open_single_table_tablespace(), fil_print_orphaned_tablespaces(), fil_rename_tablespace(), fil_rename_tablespace_in_mem(), fil_reset_too_high_lsns(), fil_space_create(), fil_space_for_table_exists_in_mem(), and fil_try_to_close_file_in_LRU().
00376 : output stream */ 00377 const char* name) /* in: name to print */ 00378 { 00379 putc('\'', f); 00380 for (;;) { 00381 int c = *name++; 00382 switch (c) { 00383 case 0: 00384 goto done; 00385 case '\'': 00386 putc(c, f); 00387 /* fall through */ 00388 default: 00389 putc(c, f); 00390 } 00391 } 00392 done: 00393 putc('\'', f); 00394 }
Here is the caller graph for this function:

| void ut_print_name | ( | FILE * | f, | |
| struct trx_struct * | trx, | |||
| ibool | table_id, | |||
| const char * | name | |||
| ) |
Definition at line 400 of file ut0ut.c.
References strlen(), and ut_print_namel().
Referenced by btr_page_get_father_for_rec(), dict_create_foreign_constraints_low(), dict_foreign_error_report(), dict_foreign_eval_sql(), dict_foreign_parse_drop_constraints(), dict_index_name_print(), dict_print_info_on_foreign_key_in_create_format(), dict_print_info_on_foreign_keys(), dict_table_remove_from_cache(), lock_rec_enqueue_waiting(), lock_table_enqueue_waiting(), lock_table_print(), row_build_row_ref_in_tuple(), row_create_index_for_mysql(), row_create_table_for_mysql(), row_discard_tablespace_for_mysql(), row_drop_database_for_mysql(), row_drop_table_for_mysql(), row_import_tablespace_for_mysql(), row_ins_foreign_report_add_err(), row_ins_foreign_report_err(), row_ins_set_detailed(), row_insert_for_mysql(), row_prebuilt_free(), row_rename_table_for_mysql(), row_search_for_mysql(), row_truncate_table_for_mysql(), row_update_for_mysql(), row_update_prebuilt_trx(), trx_rollback_or_clean_all_without_sess(), trx_rollback_to_savepoint_for_mysql(), and trx_undo_update_rec_get_update().
00402 : output stream */ 00403 trx_t* trx, /* in: transaction */ 00404 ibool table_id,/* in: TRUE=print a table name, 00405 FALSE=print other identifier */ 00406 const char* name) /* in: name to print */ 00407 { 00408 ut_print_namel(f, trx, table_id, name, strlen(name)); 00409 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void ut_print_namel | ( | FILE * | f, | |
| struct trx_struct * | trx, | |||
| ibool | table_id, | |||
| const char * | name, | |||
| ulint | namelen | |||
| ) |
Definition at line 415 of file ut0ut.c.
References innobase_print_identifier(), strchr(), TRUE, and ut_ad.
Referenced by dict_print(), dict_print_info_on_foreign_key_in_create_format(), and ut_print_name().
00417 : output stream */ 00418 trx_t* trx, /* in: transaction (NULL=no quotes) */ 00419 ibool table_id,/* in: TRUE=print a table name, 00420 FALSE=print other identifier */ 00421 const char* name, /* in: name to print */ 00422 ulint namelen)/* in: length of name */ 00423 { 00424 #ifdef UNIV_HOTBACKUP 00425 fwrite(name, 1, namelen, f); 00426 #else 00427 char* slash = strchr(name, '/'); 00428 00429 if (UNIV_LIKELY_NULL(slash)) { 00430 /* Print the database name and table name separately. */ 00431 ut_ad(table_id); 00432 00433 innobase_print_identifier(f, trx, TRUE, name, slash - name); 00434 putc('.', f); 00435 innobase_print_identifier(f, trx, TRUE, slash + 1, 00436 namelen - (slash - name) - 1); 00437 } else { 00438 innobase_print_identifier(f, trx, table_id, name, namelen); 00439 } 00440 #endif 00441 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void ut_print_timestamp | ( | FILE * | file | ) |
Definition at line 118 of file ut0ut.c.
References localtime_r().
Referenced by btr_search_drop_page_hash_index(), btr_search_validate(), buf_flush_buffered_writes(), buf_flush_ready_for_replace(), buf_LRU_get_free_block(), buf_page_io_complete(), buf_page_is_corrupted(), buf_page_print(), buf_read_page(), buf_read_page_low(), cmp_whole_field(), dict_foreign_error_report_low(), dict_foreign_eval_sql(), dict_foreign_parse_drop_constraints(), dict_load_table(), dict_truncate_index_tree(), dict_update_statistics_low(), fil_assign_new_space_id(), fil_create_new_single_table_tablespace(), fil_delete_tablespace(), fil_io(), fil_mutex_enter_and_prepare_for_io(), fil_node_create(), fil_node_open_file(), fil_node_prepare_for_io(), fil_open_single_table_tablespace(), fil_rename_tablespace(), fil_reset_too_high_lsns(), fil_space_create(), fil_space_for_table_exists_in_mem(), fil_space_free(), ha_validate(), ibuf_insert_to_index_page(), ibuf_merge_or_delete_for_page(), innobase_shutdown_for_mysql(), innobase_start_or_create_for_mysql(), lock_check_trx_id_sanity(), lock_deadlock_recursive(), lock_rec_enqueue_waiting(), lock_rec_unlock(), lock_table_enqueue_waiting(), log_close(), logs_empty_and_mark_files_at_shutdown(), mem_pool_fill_free_list(), open_or_create_data_files(), open_or_create_log_file(), os_awe_map_physical_mem_to_window(), os_fast_mutex_free(), os_file_check_page_trailers(), os_file_create(), os_file_create_tmpfile(), os_file_flush(), os_file_get_last_error(), os_file_handle_error(), os_file_handle_error_no_exit(), os_file_write(), page_copy_rec_list_end_no_locks(), recv_apply_hashed_log_recs(), recv_recovery_from_checkpoint_start(), row_check_table_for_mysql(), row_create_index_for_mysql(), row_create_table_for_mysql(), row_discard_tablespace_for_mysql(), row_drop_database_for_mysql(), row_drop_table_for_mysql(), row_drop_tables_for_mysql_in_background(), row_import_tablespace_for_mysql(), row_ins_foreign_report_add_err(), row_ins_foreign_report_err(), row_insert_for_mysql(), row_rename_table_for_mysql(), row_search_for_mysql(), row_sel_convert_mysql_key_to_innobase(), row_sel_get_clust_rec_for_mysql(), row_truncate_table_for_mysql(), row_update_for_mysql(), srv_conc_enter_innodb(), srv_error_monitor_thread(), srv_lock_timeout_and_monitor_thread(), srv_printf_innodb_monitor(), srv_table_reserve_slot_for_mysql(), trx_free(), trx_purge_rseg_get_next_history_log(), trx_recover_for_mysql(), trx_rollback_or_clean_all_without_sess(), trx_rollback_to_savepoint_for_mysql(), trx_undo_seg_create(), ut_dbg_assertion_failed(), ut_malloc_low(), and ut_test_malloc().
00120 : file where to print */ 00121 { 00122 #ifdef __WIN__ 00123 SYSTEMTIME cal_tm; 00124 00125 GetLocalTime(&cal_tm); 00126 00127 fprintf(file,"%02d%02d%02d %2d:%02d:%02d", 00128 (int)cal_tm.wYear % 100, 00129 (int)cal_tm.wMonth, 00130 (int)cal_tm.wDay, 00131 (int)cal_tm.wHour, 00132 (int)cal_tm.wMinute, 00133 (int)cal_tm.wSecond); 00134 #else 00135 struct tm cal_tm; 00136 struct tm* cal_tm_ptr; 00137 time_t tm; 00138 00139 time(&tm); 00140 00141 #ifdef HAVE_LOCALTIME_R 00142 localtime_r(&tm, &cal_tm); 00143 cal_tm_ptr = &cal_tm; 00144 #else 00145 cal_tm_ptr = localtime(&tm); 00146 #endif 00147 fprintf(file,"%02d%02d%02d %2d:%02d:%02d", 00148 cal_tm_ptr->tm_year % 100, 00149 cal_tm_ptr->tm_mon + 1, 00150 cal_tm_ptr->tm_mday, 00151 cal_tm_ptr->tm_hour, 00152 cal_tm_ptr->tm_min, 00153 cal_tm_ptr->tm_sec); 00154 #endif 00155 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void ut_sprintf_timestamp | ( | char * | buf | ) |
Definition at line 161 of file ut0ut.c.
References localtime_r().
Referenced by log_reset_first_header_and_checkpoint().
00163 : buffer where to sprintf */ 00164 { 00165 #ifdef __WIN__ 00166 SYSTEMTIME cal_tm; 00167 00168 GetLocalTime(&cal_tm); 00169 00170 sprintf(buf, "%02d%02d%02d %2d:%02d:%02d", 00171 (int)cal_tm.wYear % 100, 00172 (int)cal_tm.wMonth, 00173 (int)cal_tm.wDay, 00174 (int)cal_tm.wHour, 00175 (int)cal_tm.wMinute, 00176 (int)cal_tm.wSecond); 00177 #else 00178 struct tm cal_tm; 00179 struct tm* cal_tm_ptr; 00180 time_t tm; 00181 00182 time(&tm); 00183 00184 #ifdef HAVE_LOCALTIME_R 00185 localtime_r(&tm, &cal_tm); 00186 cal_tm_ptr = &cal_tm; 00187 #else 00188 cal_tm_ptr = localtime(&tm); 00189 #endif 00190 sprintf(buf, "%02d%02d%02d %2d:%02d:%02d", 00191 cal_tm_ptr->tm_year % 100, 00192 cal_tm_ptr->tm_mon + 1, 00193 cal_tm_ptr->tm_mday, 00194 cal_tm_ptr->tm_hour, 00195 cal_tm_ptr->tm_min, 00196 cal_tm_ptr->tm_sec); 00197 #endif 00198 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void ut_sprintf_timestamp_without_extra_chars | ( | char * | buf | ) |
Definition at line 205 of file ut0ut.c.
References localtime_r().
00207 : buffer where to sprintf */ 00208 { 00209 #ifdef __WIN__ 00210 SYSTEMTIME cal_tm; 00211 00212 GetLocalTime(&cal_tm); 00213 00214 sprintf(buf, "%02d%02d%02d_%2d_%02d_%02d", 00215 (int)cal_tm.wYear % 100, 00216 (int)cal_tm.wMonth, 00217 (int)cal_tm.wDay, 00218 (int)cal_tm.wHour, 00219 (int)cal_tm.wMinute, 00220 (int)cal_tm.wSecond); 00221 #else 00222 struct tm cal_tm; 00223 struct tm* cal_tm_ptr; 00224 time_t tm; 00225 00226 time(&tm); 00227 00228 #ifdef HAVE_LOCALTIME_R 00229 localtime_r(&tm, &cal_tm); 00230 cal_tm_ptr = &cal_tm; 00231 #else 00232 cal_tm_ptr = localtime(&tm); 00233 #endif 00234 sprintf(buf, "%02d%02d%02d_%2d_%02d_%02d", 00235 cal_tm_ptr->tm_year % 100, 00236 cal_tm_ptr->tm_mon + 1, 00237 cal_tm_ptr->tm_mday, 00238 cal_tm_ptr->tm_hour, 00239 cal_tm_ptr->tm_min, 00240 cal_tm_ptr->tm_sec); 00241 #endif 00242 }
Here is the call graph for this function:

| ib_time_t ut_time | ( | void | ) |
Definition at line 73 of file ut0ut.c.
References NULL.
Referenced by eval_predefined(), srv_lock_timeout_and_monitor_thread(), srv_suspend_mysql_thread(), and srv_table_reserve_slot_for_mysql().
00075 { 00076 return(time(NULL)); 00077 }
Here is the caller graph for this function:

Referenced by buf_read_ahead_linear(), and ut_ulint_sort().
Here is the caller graph for this function:

Definition at line 341 of file ut0ut.c.
References UT_SORT_FUNCTION_BODY, ut_ulint_cmp(), and ut_ulint_sort().
Referenced by ut_ulint_sort().
00343 { 00344 UT_SORT_FUNCTION_BODY(ut_ulint_sort, arr, aux_arr, low, high, 00345 ut_ulint_cmp); 00346 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 83 of file ut0ut.c.
References NULL.
Referenced by mutex_spin_wait(), and srv_suspend_mysql_thread().
00085 : seconds since the Epoch */ 00086 ulint* ms) /* out: microseconds since the Epoch+*sec */ 00087 { 00088 #ifdef __WIN__ 00089 SYSTEMTIME st; 00090 GetLocalTime(&st); 00091 *sec = (ulint) st.wSecond; 00092 *ms = (ulint) st.wMilliseconds; 00093 #else 00094 struct timeval tv; 00095 gettimeofday(&tv,NULL); 00096 *sec = (ulint) tv.tv_sec; 00097 *ms = (ulint) tv.tv_usec; 00098 #endif 00099 }
Here is the caller graph for this function:

1.4.7

