diff options
Diffstat (limited to 'storage/perfschema/pfs_events_waits.h')
-rw-r--r-- | storage/perfschema/pfs_events_waits.h | 147 |
1 files changed, 54 insertions, 93 deletions
diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h index d277db39d8d..a7f7a095b9f 100644 --- a/storage/perfschema/pfs_events_waits.h +++ b/storage/perfschema/pfs_events_waits.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 @@ -23,6 +23,7 @@ #include "pfs_column_types.h" #include "pfs_lock.h" +#include "pfs_events.h" struct PFS_mutex; struct PFS_rwlock; @@ -30,7 +31,12 @@ struct PFS_cond; struct PFS_table; struct PFS_file; struct PFS_thread; +struct PFS_socket; struct PFS_instr_class; +struct PFS_table_share; +struct PFS_account; +struct PFS_user; +struct PFS_host; /** Class of a wait event. */ enum events_waits_class @@ -40,51 +46,13 @@ enum events_waits_class WAIT_CLASS_RWLOCK, WAIT_CLASS_COND, WAIT_CLASS_TABLE, - WAIT_CLASS_FILE -}; - -/** State of a timer. */ -enum timer_state -{ - /** - Not timed. - In this state, TIMER_START, TIMER_END and TIMER_WAIT are NULL. - */ - TIMER_STATE_UNTIMED, - /** - About to start. - In this state, TIMER_START, TIMER_END and TIMER_WAIT are NULL. - */ - TIMER_STATE_STARTING, - /** - Started, but not yet ended. - In this state, TIMER_START has a value, TIMER_END and TIMER_WAIT are NULL. - */ - TIMER_STATE_STARTED, - /** - Ended. - In this state, TIMER_START, TIMER_END and TIMER_WAIT have a value. - */ - TIMER_STATE_TIMED -}; - -/** Target object a wait event is waiting on. */ -union events_waits_target -{ - /** Mutex waited on. */ - PFS_mutex *m_mutex; - /** RWLock waited on. */ - PFS_rwlock *m_rwlock; - /** Condition waited on. */ - PFS_cond *m_cond; - /** Table waited on. */ - PFS_table *m_table; - /** File waited on. */ - PFS_file *m_file; + WAIT_CLASS_FILE, + WAIT_CLASS_SOCKET, + WAIT_CLASS_IDLE }; /** A wait event record. */ -struct PFS_events_waits +struct PFS_events_waits : public PFS_events { /** The type of wait. @@ -100,36 +68,18 @@ struct PFS_events_waits events_waits_class m_wait_class; /** Executing thread. */ PFS_thread *m_thread; - /** Instrument metadata. */ - PFS_instr_class *m_class; - /** Timer state. */ - enum timer_state m_timer_state; - /** Event id. */ - ulonglong m_event_id; - /** - Timer start. - This member is populated only if m_timed is true. - */ - ulonglong m_timer_start; - /** - Timer end. - This member is populated only if m_timed is true. - */ - ulonglong m_timer_end; - /** Schema name. */ - const char *m_schema_name; - /** Length in bytes of @c m_schema_name. */ - uint m_schema_name_length; - /** Object name. */ - const char *m_object_name; - /** Length in bytes of @c m_object_name. */ - uint m_object_name_length; + /** Object type */ + enum_object_type m_object_type; + /** Table share, for table operations only. */ + PFS_table_share *m_weak_table_share; + /** File, for file operations only. */ + PFS_file *m_weak_file; + /** Socket, for socket operations only. */ + PFS_socket *m_weak_socket; + /** For weak pointers, target object version. */ + uint32 m_weak_version; /** Address in memory of the object instance waited on. */ const void *m_object_instance_addr; - /** Location of the instrumentation in the source code (file name). */ - const char *m_source_file; - /** Location of the instrumentation in the source code (line number). */ - uint m_source_line; /** Operation performed. */ enum_operation_type m_operation; /** @@ -137,22 +87,23 @@ struct PFS_events_waits This member is populated for file READ/WRITE operations only. */ size_t m_number_of_bytes; + /** + Index used. + This member is populated for TABLE IO operations only. + */ + uint m_index; + /** Flags */ + ulong m_flags; }; -/** - A wait locker. - A locker is a transient helper structure used by the instrumentation - during the recording of a wait. -*/ -struct PFS_wait_locker -{ - /** The timer used to measure the wait. */ - enum_timer_name m_timer_name; - /** The object waited on. */ - events_waits_target m_target; - /** The wait data recorded. */ - PFS_events_waits m_waits_current; -}; +/** TIMED bit in the state flags bitfield. */ +#define STATE_FLAG_TIMED (1<<0) +/** THREAD bit in the state flags bitfield. */ +#define STATE_FLAG_THREAD (1<<1) +/** EVENT bit in the state flags bitfield. */ +#define STATE_FLAG_EVENT (1<<2) +/** DIGEST bit in the state flags bitfield. */ +#define STATE_FLAG_DIGEST (1<<3) void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait); @@ -161,14 +112,9 @@ void insert_events_waits_history_long(PFS_events_waits *wait); extern bool flag_events_waits_current; extern bool flag_events_waits_history; extern bool flag_events_waits_history_long; -extern bool flag_events_waits_summary_by_thread_by_event_name; -extern bool flag_events_waits_summary_by_event_name; -extern bool flag_events_waits_summary_by_instance; -extern bool flag_events_locks_summary_by_thread_by_name; -extern bool flag_events_locks_summary_by_event_name; -extern bool flag_events_locks_summary_by_instance; -extern bool flag_file_summary_by_event_name; -extern bool flag_file_summary_by_instance; +extern bool flag_global_instrumentation; +extern bool flag_thread_instrumentation; + extern bool events_waits_history_long_full; extern volatile uint32 events_waits_history_long_index; extern PFS_events_waits *events_waits_history_long_array; @@ -180,6 +126,21 @@ void cleanup_events_waits_history_long(); void reset_events_waits_current(); void reset_events_waits_history(); void reset_events_waits_history_long(); +void reset_events_waits_by_thread(); +void reset_events_waits_by_account(); +void reset_events_waits_by_user(); +void reset_events_waits_by_host(); +void reset_events_waits_global(); +void aggregate_account_waits(PFS_account *account); +void aggregate_user_waits(PFS_user *user); +void aggregate_host_waits(PFS_host *host); + +void reset_table_waits_by_table(); +void reset_table_io_waits_by_table(); +void reset_table_lock_waits_by_table(); +void reset_table_waits_by_table_handle(); +void reset_table_io_waits_by_table_handle(); +void reset_table_lock_waits_by_table_handle(); #endif |