summaryrefslogtreecommitdiff
path: root/storage/perfschema/pfs_events_waits.cc
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@oracle.com>2010-08-12 03:51:58 -0600
committerMarc Alff <marc.alff@oracle.com>2010-08-12 03:51:58 -0600
commita1d90f124f30f30d3bc609d7a5783341089e54ce (patch)
tree0ae56b9fa9e13ecd4afc264e3b79187e301ad860 /storage/perfschema/pfs_events_waits.cc
parent69091c4949421b8f5a58ae6c72b722f392dde51d (diff)
downloadmariadb-git-a1d90f124f30f30d3bc609d7a5783341089e54ce.tar.gz
Bug#55462 Performance schema: reduce the overhead of PFS_events_waits::m_wait_class
This is a performance improvement fix. Removed the "volatile" property of PFS_events_waits::m_wait_class. Simplified the code accordingly.
Diffstat (limited to 'storage/perfschema/pfs_events_waits.cc')
-rw-r--r--storage/perfschema/pfs_events_waits.cc25
1 files changed, 4 insertions, 21 deletions
diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc
index e32a77512cc..b6cadf9e61c 100644
--- a/storage/perfschema/pfs_events_waits.cc
+++ b/storage/perfschema/pfs_events_waits.cc
@@ -80,25 +80,10 @@ void cleanup_events_waits_history_long(void)
events_waits_history_long_array= NULL;
}
-static void copy_events_waits(PFS_events_waits *dest,
- const PFS_events_waits *source)
+static inline void copy_events_waits(PFS_events_waits *dest,
+ const PFS_events_waits *source)
{
- /* m_wait_class must be the first member of PFS_events_waits. */
- compile_time_assert(offsetof(PFS_events_waits, m_wait_class) == 0);
-
- char* dest_body= (reinterpret_cast<char*> (dest)) + sizeof(events_waits_class);
- const char* source_body= (reinterpret_cast<const char*> (source))
- + sizeof(events_waits_class);
-
- /* See comments in table_events_waits_common::make_row(). */
-
- /* Signal readers they are about to read garbage ... */
- dest->m_wait_class= NO_WAIT_CLASS;
- /* ... that this can generate. */
- memcpy(dest_body, source_body,
- sizeof(PFS_events_waits) - sizeof(events_waits_class));
- /* Signal readers the record is now clean again. */
- dest->m_wait_class= source->m_wait_class;
+ memcpy(dest, source, sizeof(PFS_events_waits));
}
/**
@@ -116,9 +101,7 @@ void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait)
causing a potential race condition.
We are not testing for this and insert a possibly empty record,
to make this thread (the writer) faster.
- This is ok, the truncated data will have
- wait->m_wait_class == NO_WAIT_CLASS,
- which readers of m_waits_history will filter out.
+ This is ok, the readers of m_waits_history will filter this out.
*/
copy_events_waits(&thread->m_waits_history[index], wait);