~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_stats/status_tool.cc

  • Committer: Brian Aker
  • Date: 2010-06-28 16:17:36 UTC
  • mfrom: (1637.4.1 drizzle)
  • Revision ID: brian@gaz-20100628161736-eormhb2mnd551i2h
MergeĀ unused

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2010 Joseph Daly <skinny.moey@gmail.com>
 
2
 * Copyright (c) 2010, Joseph Daly <skinny.moey@gmail.com>
3
3
 * All rights reserved.
4
4
 *
5
5
 * Redistribution and use in source and binary forms, with or without
85
85
 
86
86
  drizzle_show_var *var= NULL;
87
87
  uint32_t count= 0;
88
 
  std::vector<drizzle_show_var *>::iterator all_status_vars_iterator= all_status_vars.begin();
 
88
  vector<drizzle_show_var *>::iterator all_status_vars_iterator= all_status_vars.begin();
89
89
  while (true)
90
90
  {
91
91
    var= &StatusHelper::status_vars_defs[count];
100
100
}
101
101
 
102
102
StatusTool::Generator::Generator(Field **arg, LoggingStats *in_logging_stats,
103
 
                                 std::vector<drizzle_show_var *> *in_all_status_vars, 
 
103
                                 vector<drizzle_show_var *> *all_status_vars, 
104
104
                                 bool inIsLocal) :
105
105
  TableFunction::Generator(arg),
106
106
  logging_stats(in_logging_stats),
107
107
  isLocal(inIsLocal)   
108
108
{
109
 
  all_status_vars_it= in_all_status_vars->begin();
110
 
  all_status_vars_end= in_all_status_vars->end();
 
109
  all_status_vars_it= all_status_vars->begin();
 
110
  all_status_vars_end= all_status_vars->end();
111
111
 
112
112
  status_var_to_display= NULL;
113
113
  if (isLocal)
116
116
 
117
117
    if (scoreboard_slot != NULL)
118
118
    {
119
 
      /* A copy of the current status vars for a particular session */ 
120
 
      status_var_to_display= new StatusVars(*scoreboard_slot->getStatusVars());
121
 
 
122
 
      /* Sum the current scoreboard this will give us a value for any variables that have global meaning */
123
 
      StatusVars current_scoreboard_status_vars;
124
 
      CumulativeStats *cumulativeStats= logging_stats->getCumulativeStats();
125
 
      cumulativeStats->sumCurrentScoreboard(logging_stats->getCurrentScoreboard(), &current_scoreboard_status_vars, NULL);
126
 
 
127
 
      /* Copy the above to get a value for any variables that have global meaning */  
128
 
      status_var_to_display->copyGlobalVariables(logging_stats->getCumulativeStats()->getGlobalStatusVars());
129
 
      status_var_to_display->copyGlobalVariables(&current_scoreboard_status_vars); 
 
119
      status_var_to_display= scoreboard_slot->getStatusVars();
130
120
    } 
131
121
    else 
132
122
    {
144
134
 
145
135
StatusTool::Generator::~Generator()
146
136
{
147
 
  delete status_var_to_display;
 
137
  if (! isLocal) 
 
138
  {
 
139
    delete status_var_to_display;
 
140
  }
148
141
}
149
142
 
150
143
bool StatusTool::Generator::populate()
175
168
      drizzle_show_var tmp;
176
169
 
177
170
      for (var= variables; var->type == SHOW_FUNC; var= &tmp)
178
 
        ((drizzle_show_var_func)((st_show_var_func_container *)var->value)->func)(&tmp, buff);
 
171
        ((mysql_show_var_func)((st_show_var_func_container *)var->value)->func)(&tmp, buff);
179
172
    }
180
173
 
181
174
    if (isWild(variables->name))