~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/haildb/status_table_function.cc

  • Committer: Brian Aker
  • Date: 2010-10-15 00:59:36 UTC
  • mfrom: (1849 staging)
  • mto: This revision was merged to the branch mainline in revision 1853.
  • Revision ID: brian@tangent.org-20101015005936-znhvkz8khs4fhlyv
Merge with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "config.h"
20
20
#include "drizzled/plugin/table_function.h"
21
21
 
22
 
#if defined(HAVE_HAILDB_H)
23
 
# include <haildb.h>
24
 
#else
25
 
# include <embedded_innodb-1.0/innodb.h>
26
 
#endif /* HAVE_HAILDB_H */
 
22
#include <haildb.h>
27
23
 
28
24
#include "status_table_function.h"
29
25
 
45
41
  class Generator : public drizzled::plugin::TableFunction::Generator
46
42
  {
47
43
  private:
 
44
    const char **names;
 
45
    uint32_t names_count;
48
46
    uint32_t names_next;
49
47
  public:
50
48
    Generator(drizzled::Field **arg);
59
57
  }
60
58
};
61
59
 
62
 
static const char*      libinnodb_status_var_names[] = {
63
 
  "read_req_pending",
64
 
  "write_req_pending",
65
 
  "fsync_req_pending",
66
 
  "write_req_done",
67
 
  "read_req_done",
68
 
  "fsync_req_done",
69
 
  "bytes_total_written",
70
 
  "bytes_total_read",
71
 
 
72
 
  "buffer_pool_current_size",
73
 
  "buffer_pool_data_pages",
74
 
  "buffer_pool_dirty_pages",
75
 
  "buffer_pool_misc_pages",
76
 
  "buffer_pool_free_pages",
77
 
  "buffer_pool_read_reqs",
78
 
  "buffer_pool_reads",
79
 
  "buffer_pool_waited_for_free",
80
 
  "buffer_pool_pages_flushed",
81
 
  "buffer_pool_write_reqs",
82
 
  "buffer_pool_total_pages",
83
 
  "buffer_pool_pages_read",
84
 
  "buffer_pool_pages_written",
85
 
 
86
 
  "double_write_pages_written",
87
 
  "double_write_invoked",
88
 
 
89
 
  "log_buffer_slot_waits",
90
 
  "log_write_reqs",
91
 
  "log_write_flush_count",
92
 
  "log_bytes_written",
93
 
  "log_fsync_req_done",
94
 
  "log_write_req_pending",
95
 
  "log_fsync_req_pending",
96
 
 
97
 
  "lock_row_waits",
98
 
  "lock_row_waiting",
99
 
  "lock_total_wait_time_in_secs",
100
 
  "lock_wait_time_avg_in_secs",
101
 
  "lock_max_wait_time_in_secs",
102
 
 
103
 
  "row_total_read",
104
 
  "row_total_inserted",
105
 
  "row_total_updated",
106
 
  "row_total_deleted",
107
 
 
108
 
  "page_size",
109
 
  "have_atomic_builtins",
110
 
  NULL
111
 
};
112
 
 
113
60
LibInnoDBStatusTool::LibInnoDBStatusTool() :
114
61
  plugin::TableFunction("DATA_DICTIONARY", "HAILDB_STATUS")
115
62
{
121
68
  plugin::TableFunction::Generator(arg),
122
69
  names_next(0)
123
70
{
 
71
  ib_err_t err= ib_status_get_all(&names, &names_count);
 
72
  assert(err == DB_SUCCESS);
124
73
}
125
74
 
126
75
LibInnoDBStatusTool::Generator::~Generator()
127
76
{
 
77
  free(names);
128
78
}
129
79
 
130
80
bool LibInnoDBStatusTool::Generator::populate()
131
81
{
132
 
  if (libinnodb_status_var_names[names_next] != NULL)
 
82
  if (names[names_next] != NULL)
133
83
  {
134
 
    const char* config_name= libinnodb_status_var_names[names_next];
 
84
    const char* config_name= names[names_next];
135
85
 
136
86
    push(config_name);
137
87