3430 Marc Alff 2011-11-03
fast reset for table stats
modified:
storage/perfschema/pfs_instr.cc
storage/perfschema/pfs_instr_class.cc
storage/perfschema/pfs_server.cc
storage/perfschema/pfs_stat.h
3429 Marc Alff 2011-11-03
port from mysql-trunk-marc, table io and table lock benchmark
modified:
storage/perfschema/unittest/pfs_benchmark-t.cc
=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc 2011-10-27 21:18:19 +0000
+++ b/storage/perfschema/pfs_instr.cc 2011-11-04 01:57:41 +0000
@@ -1309,7 +1309,7 @@ PFS_table* create_table(PFS_table_share
pfs->m_has_io_stats= false;
pfs->m_has_lock_stats= false;
share->inc_refcount();
- pfs->m_table_stat.reset();
+ pfs->m_table_stat.fast_reset();
pfs->m_thread_owner= opening_thread;
pfs->m_lock.dirty_to_allocated();
return pfs;
@@ -1391,7 +1391,7 @@ void PFS_table::safe_aggregate(PFS_table
/* Aggregate to TABLE_IO_SUMMARY, TABLE_LOCK_SUMMARY */
table_share->m_table_stat.aggregate(table_stat);
- table_stat->reset();
+ table_stat->fast_reset();
}
void PFS_table::safe_aggregate_io(PFS_table_stat *table_stat,
@@ -1418,7 +1418,7 @@ void PFS_table::safe_aggregate_io(PFS_ta
/* Aggregate to TABLE_IO_SUMMARY */
table_share->m_table_stat.aggregate_io(table_stat);
- table_stat->reset();
+ table_stat->fast_reset_io();
}
void PFS_table::safe_aggregate_lock(PFS_table_stat *table_stat,
@@ -1445,7 +1445,7 @@ void PFS_table::safe_aggregate_lock(PFS_
/* Aggregate to TABLE_LOCK_SUMMARY */
table_share->m_table_stat.aggregate_lock(table_stat);
- table_stat->reset();
+ table_stat->fast_reset_lock();
}
/**
=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc 2011-10-19 17:56:04 +0000
+++ b/storage/perfschema/pfs_instr_class.cc 2011-11-04 01:57:41 +0000
@@ -1175,7 +1175,7 @@ search:
{
set_keys(pfs, share);
/* FIXME: aggregate to table_share sink ? */
- pfs->m_table_stat.reset();
+ pfs->m_table_stat.fast_reset();
}
lf_hash_search_unpin(pins);
return pfs;
@@ -1217,7 +1217,7 @@ search:
pfs->m_enabled= enabled;
pfs->m_timed= timed;
pfs->init_refcount();
- pfs->m_table_stat.reset();
+ pfs->m_table_stat.fast_reset();
set_keys(pfs, share);
int res;
@@ -1258,7 +1258,7 @@ void PFS_table_share::aggregate_io(void)
uint index= global_table_io_class.m_event_name_index;
PFS_single_stat *table_io_total= & global_instr_class_waits_array[index];
m_table_stat.sum_io(table_io_total);
- m_table_stat.reset_io();
+ m_table_stat.fast_reset_io();
}
void PFS_table_share::aggregate_lock(void)
@@ -1266,7 +1266,7 @@ void PFS_table_share::aggregate_lock(voi
uint index= global_table_lock_class.m_event_name_index;
PFS_single_stat *table_lock_total= & global_instr_class_waits_array[index];
m_table_stat.sum_lock(table_lock_total);
- m_table_stat.reset_lock();
+ m_table_stat.fast_reset_lock();
}
void release_table_share(PFS_table_share *pfs)
=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc 2011-08-11 03:11:58 +0000
+++ b/storage/perfschema/pfs_server.cc 2011-11-04 01:57:41 +0000
@@ -39,6 +39,8 @@
PFS_global_param pfs_param;
+PFS_table_stat PFS_table_stat::g_reset_template;
+
C_MODE_START
static void destroy_pfs_thread(void *key);
C_MODE_END
@@ -50,6 +52,8 @@ initialize_performance_schema(const PFS_
{
pfs_initialized= false;
+ PFS_table_stat::g_reset_template.reset();
+
if (! param->m_enabled)
{
/*
=== modified file 'storage/perfschema/pfs_stat.h'
--- a/storage/perfschema/pfs_stat.h 2011-09-02 20:03:36 +0000
+++ b/storage/perfschema/pfs_stat.h 2011-11-04 01:57:41 +0000
@@ -17,6 +17,8 @@
#define PFS_STAT_H
#include "sql_const.h"
+/* memcpy */
+#include "string.h"
/**
@file storage/perfschema/pfs_stat.h
@@ -449,6 +451,21 @@ struct PFS_table_stat
reset_lock();
}
+ inline void fast_reset_io(void)
+ {
+ memcpy(& m_index_stat, & g_reset_template.m_index_stat, sizeof(m_index_stat));
+ }
+
+ inline void fast_reset_lock(void)
+ {
+ memcpy(& m_lock_stat, & g_reset_template.m_lock_stat, sizeof(m_lock_stat));
+ }
+
+ inline void fast_reset(void)
+ {
+ memcpy(this, & g_reset_template, sizeof(*this));
+ }
+
inline void aggregate_io(const PFS_table_stat *stat)
{
PFS_table_io_stat *to_stat= & m_index_stat[0];
@@ -487,6 +504,8 @@ struct PFS_table_stat
sum_io(result);
sum_lock(result);
}
+
+ static struct PFS_table_stat g_reset_template;
};
/** Statistics for SOCKET IO. Used for both waits and byte counts. */
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (marc.alff:3429 to 3430) | Marc Alff | 7 Nov |