summaryrefslogtreecommitdiff
path: root/storage/perfschema/pfs_global.h
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-08-01 17:27:34 +0300
committerMichael Widenius <monty@askmonty.org>2012-08-01 17:27:34 +0300
commit1d0f70c2f894b27e98773a282871d32802f67964 (patch)
tree833e683e0ced29c4323c29a9d845703d4dfcd81b /storage/perfschema/pfs_global.h
parent5a86a61219826aadf8d08cbc447fe438f2bf50c3 (diff)
downloadmariadb-git-1d0f70c2f894b27e98773a282871d32802f67964.tar.gz
Temporary commit of merge of MariaDB 10.0-base and MySQL 5.6
Diffstat (limited to 'storage/perfschema/pfs_global.h')
-rw-r--r--storage/perfschema/pfs_global.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h
index c0c0490a380..693153cb097 100644
--- a/storage/perfschema/pfs_global.h
+++ b/storage/perfschema/pfs_global.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,14 +21,38 @@
Miscellaneous global dependencies (declarations).
*/
+/** True when the performance schema is initialized. */
extern bool pfs_initialized;
+/** Total memory allocated by the performance schema, in bytes. */
extern ulonglong pfs_allocated_memory;
void *pfs_malloc(size_t size, myf flags);
+
+/**
+ Helper, to allocate an array of structures.
+ @param n number of elements in the array.
+ @param T type of an element.
+ @param f flags to use when allocating memory
+*/
#define PFS_MALLOC_ARRAY(n, T, f) \
reinterpret_cast<T*> (pfs_malloc((n) * sizeof(T), (f)))
+
+/** Free memory allocated with @sa pfs_malloc. */
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);
+
+/**
+ Compute a random index value in an interval.
+ @param ptr seed address
+ @param max_size maximun size of the interval
+ @return a random value in [0, max_size-1]
+*/
inline uint randomized_index(const void *ptr, uint max_size)
{
static uint seed1= 0;