MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ut0ut.cc File Reference
#include "ut0ut.h"
#include "ut0sort.h"
#include "os0thread.h"
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include "trx0trx.h"
#include "ha_prototypes.h"
#include "mysql_com.h"
Include dependency graph for ut0ut.cc:

Go to the source code of this file.

Macros

#define ut_gettimeofday   gettimeofday

Functions

UNIV_INTERN ib_time_t ut_time (void)
UNIV_INTERN int ut_usectime (ulint *sec, ulint *ms)
UNIV_INTERN ullint ut_time_us (ullint *tloc)
UNIV_INTERN ulint ut_time_ms (void)
UNIV_INTERN double ut_difftime (ib_time_t time2, ib_time_t time1)
UNIV_INTERN void ut_print_timestamp (FILE *file)
UNIV_INTERN void ut_sprintf_timestamp (char *buf)
UNIV_INTERN ulint ut_delay (ulint delay)
UNIV_INTERN void ut_print_buf (FILE *file, const void *buf, ulint len)
UNIV_INTERN void ut_ulint_sort (ulint *arr, ulint *aux_arr, ulint low, ulint high)
UNIV_INTERN ulint ut_2_power_up (ulint n)
UNIV_INTERN void ut_print_filename (FILE *f, const char *name)
UNIV_INTERN void ut_print_name (FILE *f, const trx_t *trx, ibool table_id, const char *name)
UNIV_INTERN void ut_print_namel (FILE *f, const trx_t *trx, ibool table_id, const char *name, ulint namelen)
UNIV_INTERN char * ut_format_name (const char *name, ibool is_table, char *formatted, ulint formatted_size)
UNIV_INTERN void ut_copy_file (FILE *dest, FILE *src)
UNIV_INTERN const char * ut_strerr (dberr_t num)

Variables

UNIV_INTERN ibool ut_always_false = FALSE

Detailed Description

Various utilities for Innobase.

Created 5/11/1994 Heikki Tuuri

Definition in file ut0ut.cc.

Macro Definition Documentation

#define ut_gettimeofday   gettimeofday
An alias for gettimeofday(2).  On Microsoft Windows, we have to

reimplement this function.

Definition at line 98 of file ut0ut.cc.

Function Documentation

UNIV_INTERN ulint ut_2_power_up ( ulint  n)

Calculates fast the number rounded up to the nearest power of 2.

Returns
first power of 2 which is >= n
Parameters
nin: number != 0

Definition at line 474 of file ut0ut.cc.

UNIV_INTERN void ut_copy_file ( FILE *  dest,
FILE *  src 
)

Catenate files.

Parameters
destin: output file
srcin: input file to be appended to output

Definition at line 612 of file ut0ut.cc.

Here is the caller graph for this function:

UNIV_INTERN ulint ut_delay ( ulint  delay)

Runs an idle loop on CPU. The argument gives the desired delay in microseconds on 100 MHz Pentium + Visual C++.

Returns
dummy value
Parameters
delayin: delay in microseconds on 100 MHz Pentium

Definition at line 400 of file ut0ut.cc.

Here is the caller graph for this function:

UNIV_INTERN double ut_difftime ( ib_time_t  time2,
ib_time_t  time1 
)

Returns the difference of two times in seconds.

Returns
time2 - time1 expressed in seconds
Parameters
time2in: time
time1in: time

Definition at line 204 of file ut0ut.cc.

Here is the caller graph for this function:

UNIV_INTERN char* ut_format_name ( const char *  name,
ibool  is_table,
char *  formatted,
ulint  formatted_size 
)

Formats a table or index name, quoted as an SQL identifier. If the name contains a slash '/', the result will contain two identifiers separated by a period (.), as in SQL database_name.identifier.

Returns
pointer to 'formatted'
Parameters
namein: table or index name, must be '\0'-terminated
is_tablein: if TRUE then 'name' is a table name
formattedout: formatted result, will be '\0'-terminated
formatted_sizeout: no more than this number of bytes will be written to 'formatted'

Definition at line 571 of file ut0ut.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void ut_print_buf ( FILE *  file,
const void *  buf,
ulint  len 
)

Prints the contents of a memory buffer in hex and ascii.

Parameters
filein: file where to print
bufin: memory buffer
lenin: length of the buffer

Definition at line 425 of file ut0ut.cc.

Here is the caller graph for this function:

UNIV_INTERN void ut_print_filename ( FILE *  f,
const char *  name 
)

Outputs a NUL-terminated file name, quoted with apostrophes.

Parameters
fin: output stream
namein: name to print

Definition at line 495 of file ut0ut.cc.

Here is the caller graph for this function:

UNIV_INTERN void ut_print_name ( FILE *  f,
const trx_t trx,
ibool  table_id,
const char *  name 
)

Outputs a fixed-length string, quoted as an SQL identifier. If the string contains a slash '/', the string will be output as two identifiers separated by a period (.), as in SQL database_name.identifier.

Parameters
fin: output stream
trxin: transaction
table_idin: TRUE=print a table name, FALSE=print other identifier
namein: name to print

Definition at line 524 of file ut0ut.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void ut_print_namel ( FILE *  f,
const trx_t trx,
ibool  table_id,
const char *  name,
ulint  namelen 
)

Outputs a fixed-length string, quoted as an SQL identifier. If the string contains a slash '/', the string will be output as two identifiers separated by a period (.), as in SQL database_name.identifier.

Parameters
fin: output stream
trxin: transaction (NULL=no quotes)
table_idin: TRUE=print a table name, FALSE=print other identifier
namein: name to print
namelenin: length of name

Definition at line 542 of file ut0ut.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void ut_print_timestamp ( FILE *  file)

Prints a timestamp to a file.

Parameters
filein: file where to print

Definition at line 218 of file ut0ut.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void ut_sprintf_timestamp ( char *  buf)

Sprintfs a timestamp to a buffer, 13..14 chars plus terminating NUL.

Parameters
bufin: buffer where to sprintf

Definition at line 271 of file ut0ut.cc.

UNIV_INTERN const char* ut_strerr ( dberr_t  num)

Convert an error number to a human readable text message. The returned string is static and should not be freed or modified.

Returns
string, describing the error
Parameters
numin: error number

Definition at line 702 of file ut0ut.cc.

Here is the caller graph for this function:

UNIV_INTERN ib_time_t ut_time ( void  )

Returns system time. We do not specify the format of the time returned: the only way to manipulate it is to use the function ut_difftime.

Returns
system time

Definition at line 107 of file ut0ut.cc.

Here is the caller graph for this function:

UNIV_INTERN ulint ut_time_ms ( void  )

Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic purposes.

Returns
ms since epoch

Definition at line 188 of file ut0ut.cc.

Here is the caller graph for this function:

UNIV_INTERN ullint ut_time_us ( ullint *  tloc)

Returns the number of microseconds since epoch. Similar to time(3), the return value is also stored in *tloc, provided that tloc is non-NULL.

Returns
us since epoch
Parameters
tlocout: us since epoch, if non-NULL

Definition at line 163 of file ut0ut.cc.

Here is the caller graph for this function:

UNIV_INTERN void ut_ulint_sort ( ulint *  arr,
ulint *  aux_arr,
ulint  low,
ulint  high 
)

Sort function for ulint arrays.

Parameters
arrin/out: array to sort
aux_arrin/out: aux array to use in sort
lowin: lower bound
highin: upper bound

Definition at line 458 of file ut0ut.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN int ut_usectime ( ulint *  sec,
ulint *  ms 
)

Returns system time. Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

Returns
0 on success, -1 otherwise
Parameters
secout: seconds since the Epoch
msout: microseconds since the Epoch+*sec

Definition at line 122 of file ut0ut.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

UNIV_INTERN ibool ut_always_false = FALSE

A constant to prevent the compiler from optimizing ut_delay() away.

Definition at line 48 of file ut0ut.cc.