2
* Copyright (c) 2010, Joseph Daly <skinny.moey@gmail.com>
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
8
* * Redistributions of source code must retain the above copyright notice,
9
* this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
13
* * Neither the name of Joseph Daly nor the names of its contributors
14
* may be used to endorse or promote products derived from this software
15
* without specific prior written permission.
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27
* THE POSSIBILITY OF SUCH DAMAGE.
30
#ifndef PLUGIN_LOGGING_STATS_STATS_SCHEMA_H
31
#define PLUGIN_LOGGING_STATS_STATS_SCHEMA_H
33
#include <drizzled/plugin/table_function.h>
34
#include <drizzled/field.h>
36
#include "user_commands.h"
37
#include "global_stats.h"
38
#include "logging_stats.h"
42
class GlobalStatementsTool : public drizzled::plugin::TableFunction
45
GlobalStatementsTool(LoggingStats *logging_stats);
47
class Generator : public drizzled::plugin::TableFunction::Generator
50
Generator(drizzled::Field **arg, LoggingStats *logging_stats);
57
GlobalStats *global_stats_to_display;
61
Generator *generator(drizzled::Field **arg)
63
return new Generator(arg, logging_stats);
67
LoggingStats *logging_stats;
70
class SessionStatementsTool : public drizzled::plugin::TableFunction
73
SessionStatementsTool(LoggingStats *logging_stats);
75
class Generator : public drizzled::plugin::TableFunction::Generator
78
Generator(drizzled::Field **arg, LoggingStats *logging_stats);
83
UserCommands *user_commands;
87
Generator *generator(drizzled::Field **arg)
89
return new Generator(arg, logging_stats);
93
LoggingStats *logging_stats;
96
class CurrentCommandsTool : public drizzled::plugin::TableFunction
100
CurrentCommandsTool(LoggingStats *logging_stats);
102
class Generator : public drizzled::plugin::TableFunction::Generator
105
Generator(drizzled::Field **arg, LoggingStats *logging_stats);
109
LoggingStats *inner_logging_stats;
110
Scoreboard *current_scoreboard;
111
uint32_t current_bucket;
113
std::vector<ScoreboardSlot *>::iterator scoreboard_vector_it;
114
std::vector<ScoreboardSlot *>::iterator scoreboard_vector_end;
115
std::vector<std::vector<ScoreboardSlot* >* >::iterator vector_of_scoreboard_vectors_it;
116
std::vector<std::vector<ScoreboardSlot* >* >::iterator vector_of_scoreboard_vectors_end;
117
boost::shared_mutex* current_lock;
119
void setVectorIteratorsAndLock(uint32_t bucket_number);
122
Generator *generator(drizzled::Field **arg)
124
return new Generator(arg, outer_logging_stats);
127
LoggingStats *outer_logging_stats;
130
class CumulativeCommandsTool : public drizzled::plugin::TableFunction
134
CumulativeCommandsTool(LoggingStats *logging_stats);
136
class Generator : public drizzled::plugin::TableFunction::Generator
139
Generator(drizzled::Field **arg, LoggingStats *logging_stats);
143
LoggingStats *inner_logging_stats;
144
int32_t record_number;
145
int32_t last_valid_index;
148
Generator *generator(drizzled::Field **arg)
150
return new Generator(arg, outer_logging_stats);
153
LoggingStats *outer_logging_stats;
156
class CumulativeUserStatsTool : public drizzled::plugin::TableFunction
160
CumulativeUserStatsTool(LoggingStats *logging_stats);
162
class Generator : public drizzled::plugin::TableFunction::Generator
165
Generator(drizzled::Field **arg, LoggingStats *logging_stats);
169
LoggingStats *inner_logging_stats;
170
int32_t record_number;
171
int32_t last_valid_index;
174
Generator *generator(drizzled::Field **arg)
176
return new Generator(arg, outer_logging_stats);
179
LoggingStats *outer_logging_stats;
182
class ScoreboardStatsTool : public drizzled::plugin::TableFunction
186
ScoreboardStatsTool(LoggingStats *logging_stats);
188
class Generator : public drizzled::plugin::TableFunction::Generator
191
Generator(drizzled::Field **arg, LoggingStats *logging_stats);
195
LoggingStats *inner_logging_stats;
199
Generator *generator(drizzled::Field **arg)
201
return new Generator(arg, outer_logging_stats);
204
LoggingStats *outer_logging_stats;
207
#endif /* PLUGIN_LOGGING_STATS_STATS_SCHEMA_H */