MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pfs_global.h File Reference
#include "my_global.h"
#include "my_compiler.h"
Include dependency graph for pfs_global.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PFS_ALIGNED
#define PFS_MALLOC_ARRAY(n, T, f)   reinterpret_cast<T*> (pfs_malloc((n) * sizeof(T), (f)))
#define SANITIZE_ARRAY_BODY(T, ARRAY, MAX, UNSAFE)

Functions

void * pfs_malloc (size_t size, myf flags)
void pfs_free (void *ptr)
uint pfs_get_socket_address (char *host, uint host_len, uint *port, const struct sockaddr_storage *src_addr, socklen_t src_len)
uint randomized_index (const void *ptr, uint max_size)
void pfs_print_error (const char *format,...)

Variables

bool pfs_initialized
size_t pfs_allocated_memory

Detailed Description

Miscellaneous global dependencies (declarations).

Definition in file pfs_global.h.

Macro Definition Documentation

#define PFS_MALLOC_ARRAY (   n,
  T,
 
)    reinterpret_cast<T*> (pfs_malloc((n) * sizeof(T), (f)))

Helper, to allocate an array of structures.

Parameters
nnumber of elements in the array.
Ttype of an element.
fflags to use when allocating memory

Definition at line 52 of file pfs_global.h.

#define SANITIZE_ARRAY_BODY (   T,
  ARRAY,
  MAX,
  UNSAFE 
)
Value:
intptr offset; \
if ((&ARRAY[0] <= UNSAFE) && \
(UNSAFE < &ARRAY[MAX])) \
{ \
offset= ((intptr) UNSAFE - (intptr) ARRAY) % sizeof(T); \
if (offset == 0) \
return UNSAFE; \
} \
return NULL

Given an array defined as T ARRAY[MAX], check that an UNSAFE pointer actually points to an element within the array.

Definition at line 126 of file pfs_global.h.

Function Documentation

void pfs_free ( void *  ptr)

Free memory allocated with

See Also
pfs_malloc.

Definition at line 89 of file pfs_global.cc.

Here is the caller graph for this function:

uint pfs_get_socket_address ( char *  host,
uint  host_len,
uint *  port,
const struct sockaddr_storage *  src_addr,
socklen_t  src_len 
)

Convert raw ip address into readable format. Do not do a reverse DNS lookup.

Definition at line 130 of file pfs_global.cc.

void* pfs_malloc ( size_t  size,
myf  flags 
)

Memory allocation for the performance schema. The memory used internally in the performance schema implementation is allocated once during startup, and considered static thereafter.

Definition at line 47 of file pfs_global.cc.

Here is the caller graph for this function:

uint randomized_index ( const void *  ptr,
uint  max_size 
)
inline

Compute a random index value in an interval.

Parameters
ptrseed address
max_sizemaximun size of the interval
Returns
a random value in [0, max_size-1]

Definition at line 71 of file pfs_global.h.

Variable Documentation

size_t pfs_allocated_memory

Total memory allocated by the performance schema, in bytes.

Definition at line 40 of file pfs_global.cc.

bool pfs_initialized

True when the performance schema is initialized.

Definition at line 39 of file pfs_global.cc.