2012-08-01 16:27:34 +02:00
|
|
|
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
2010-01-12 02:47:27 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
2020-01-19 12:52:07 +01:00
|
|
|
it under the terms of the GNU General Public License, version 2.0,
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is also distributed with certain software (including
|
|
|
|
but not limited to OpenSSL) that is licensed under separate terms,
|
|
|
|
as designated in a particular file or component or in included license
|
|
|
|
documentation. The authors of MySQL hereby grant you an additional
|
|
|
|
permission to link the program and your derivative works with the
|
|
|
|
separately licensed software that they have included with MySQL.
|
2010-01-12 02:47:27 +01:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2020-01-19 12:52:07 +01:00
|
|
|
GNU General Public License, version 2.0, for more details.
|
2010-01-12 02:47:27 +01:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2010-07-16 02:06:33 +02:00
|
|
|
along with this program; if not, write to the Free Software Foundation,
|
2019-05-11 17:08:32 +02:00
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
|
2010-01-12 02:47:27 +01:00
|
|
|
|
2010-08-12 16:08:52 +02:00
|
|
|
#ifndef TABLE_THREADS_H
|
|
|
|
#define TABLE_THREADS_H
|
2010-01-12 02:47:27 +01:00
|
|
|
|
|
|
|
#include "pfs_column_types.h"
|
2012-08-01 16:27:34 +02:00
|
|
|
#include "cursor_by_thread.h"
|
2010-01-12 02:47:27 +01:00
|
|
|
|
|
|
|
struct PFS_thread;
|
|
|
|
|
|
|
|
/**
|
2012-08-01 16:27:34 +02:00
|
|
|
\addtogroup Performance_schema_tables
|
2010-01-12 02:47:27 +01:00
|
|
|
@{
|
|
|
|
*/
|
|
|
|
|
2012-08-01 16:27:34 +02:00
|
|
|
/**
|
|
|
|
A row of PERFORMANCE_SCHEMA.THREADS.
|
|
|
|
*/
|
2010-08-12 16:08:52 +02:00
|
|
|
struct row_threads
|
2010-01-12 02:47:27 +01:00
|
|
|
{
|
|
|
|
/** Column THREAD_ID. */
|
2013-03-25 23:03:13 +01:00
|
|
|
ulonglong m_thread_internal_id;
|
2010-10-07 02:03:27 +02:00
|
|
|
/** Column PROCESSLIST_ID. */
|
2013-03-25 23:03:13 +01:00
|
|
|
ulonglong m_processlist_id;
|
2010-01-12 02:47:27 +01:00
|
|
|
/** Column NAME. */
|
2012-08-01 16:27:34 +02:00
|
|
|
const char* m_name;
|
2010-01-12 02:47:27 +01:00
|
|
|
/** Length in bytes of @c m_name. */
|
|
|
|
uint m_name_length;
|
2012-08-01 16:27:34 +02:00
|
|
|
/** Column PROCESSLIST_USER. */
|
|
|
|
char m_username[USERNAME_LENGTH];
|
|
|
|
/** Length in bytes of @c m_username. */
|
|
|
|
uint m_username_length;
|
|
|
|
/** Column PROCESSLIST_HOST. */
|
|
|
|
char m_hostname[HOSTNAME_LENGTH];
|
|
|
|
/** Length in bytes of @c m_hostname. */
|
|
|
|
uint m_hostname_length;
|
|
|
|
/** Column PROCESSLIST_DB. */
|
|
|
|
char m_dbname[NAME_LEN];
|
|
|
|
/** Length in bytes of @c m_dbname. */
|
|
|
|
uint m_dbname_length;
|
|
|
|
/** Column PROCESSLIST_COMMAND. */
|
|
|
|
int m_command;
|
|
|
|
/** Column PROCESSLIST_TIME. */
|
|
|
|
time_t m_start_time;
|
|
|
|
/** Column PROCESSLIST_STATE. */
|
|
|
|
const char* m_processlist_state_ptr;
|
|
|
|
/** Length in bytes of @c m_processlist_state_ptr. */
|
|
|
|
uint m_processlist_state_length;
|
|
|
|
/** Column PROCESSLIST_INFO. */
|
|
|
|
const char* m_processlist_info_ptr;
|
|
|
|
/** Length in bytes of @c m_processlist_info_ptr. */
|
|
|
|
uint m_processlist_info_length;
|
|
|
|
/** Column INSTRUMENTED. */
|
|
|
|
bool *m_enabled_ptr;
|
|
|
|
/** Column PARENT_THREAD_ID. */
|
2013-03-25 23:03:13 +01:00
|
|
|
ulonglong m_parent_thread_internal_id;
|
2010-01-12 02:47:27 +01:00
|
|
|
};
|
|
|
|
|
2010-08-12 16:08:52 +02:00
|
|
|
/** Table PERFORMANCE_SCHEMA.THREADS. */
|
2012-08-01 16:27:34 +02:00
|
|
|
class table_threads : public cursor_by_thread
|
2010-01-12 02:47:27 +01:00
|
|
|
{
|
|
|
|
public:
|
2012-08-01 16:27:34 +02:00
|
|
|
/** Table share */
|
2010-01-12 02:47:27 +01:00
|
|
|
static PFS_engine_table_share m_share;
|
2012-08-01 16:27:34 +02:00
|
|
|
/** Table builder */
|
2010-01-12 02:47:27 +01:00
|
|
|
static PFS_engine_table* create();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual int read_row_values(TABLE *table,
|
|
|
|
unsigned char *buf,
|
|
|
|
Field **fields,
|
|
|
|
bool read_all);
|
|
|
|
|
2012-08-01 16:27:34 +02:00
|
|
|
|
|
|
|
virtual int update_row_values(TABLE *table,
|
|
|
|
const unsigned char *old_buf,
|
2017-04-16 21:40:39 +02:00
|
|
|
const unsigned char *new_buf,
|
2012-08-01 16:27:34 +02:00
|
|
|
Field **fields);
|
|
|
|
|
2010-01-12 02:47:27 +01:00
|
|
|
protected:
|
2010-08-12 16:08:52 +02:00
|
|
|
table_threads();
|
2010-01-12 02:47:27 +01:00
|
|
|
|
|
|
|
public:
|
2010-08-12 16:08:52 +02:00
|
|
|
~table_threads()
|
2010-01-12 02:47:27 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
private:
|
2012-08-01 16:27:34 +02:00
|
|
|
virtual void make_row(PFS_thread *pfs);
|
2010-01-12 02:47:27 +01:00
|
|
|
|
|
|
|
/** Table share lock. */
|
|
|
|
static THR_LOCK m_table_lock;
|
|
|
|
|
|
|
|
/** Current row. */
|
2010-08-12 16:08:52 +02:00
|
|
|
row_threads m_row;
|
2010-10-07 02:03:27 +02:00
|
|
|
/** True if the current row exists. */
|
2010-01-12 02:47:27 +01:00
|
|
|
bool m_row_exists;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
#endif
|