~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_stats/cumulative_stats.cc

  • Committer: Brian Aker
  • Date: 2010-06-11 17:26:39 UTC
  • mto: This revision was merged to the branch mainline in revision 1610.
  • Revision ID: brian@gaz-20100611172639-e9q2sliqizeoz4yd
Update for having share declared type.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
  last_valid_index= INVALID_INDEX;
50
50
  isOpenUserSlots= true;
51
51
  global_stats= new GlobalStats();
52
 
  global_status_vars= new StatusVars();
53
52
}
54
53
 
55
54
CumulativeStats::~CumulativeStats()
62
61
  cumulative_stats_by_user_vector->clear();
63
62
  delete cumulative_stats_by_user_vector;
64
63
  delete global_stats;
65
 
  delete global_status_vars;
66
64
}
67
65
 
68
66
void CumulativeStats::logUserStats(ScoreboardSlot *scoreboard_slot)
124
122
  global_stats->updateUserCommands(scoreboard_slot); 
125
123
}
126
124
 
127
 
void CumulativeStats::logGlobalStatusVars(ScoreboardSlot* scoreboard_slot)
128
 
{
129
 
  global_status_vars->merge(scoreboard_slot->getStatusVars());
130
 
}
131
 
 
132
 
int32_t CumulativeStats::getCumulativeStatsLastValidIndex()
 
125
int32_t  CumulativeStats::getCumulativeStatsLastValidIndex()
133
126
{
134
127
  if (last_valid_index < cumulative_stats_by_user_max)
135
128
  {
140
133
    return cumulative_stats_by_user_max;
141
134
  }
142
135
}
143
 
 
144
 
void CumulativeStats::sumCurrentScoreboardStatusVars(Scoreboard *scoreboard,
145
 
                                                     StatusVars *current_status_vars)
146
 
{
147
 
  /* the vector of vectors */
148
 
  vector<vector<ScoreboardSlot* >* > *vector_of_scoreboard_vectors= 
149
 
    scoreboard->getVectorOfScoreboardVectors();
150
 
 
151
 
  /* iterate through each vector from above and sum each ScoreboardSlot */
152
 
 
153
 
  vector<vector<ScoreboardSlot* >* >::iterator v_of_scoreboard_v_begin_it= vector_of_scoreboard_vectors->begin(); 
154
 
 
155
 
  vector<vector<ScoreboardSlot* >* >::iterator v_of_scoreboard_v_end_it= vector_of_scoreboard_vectors->end(); 
156
 
 
157
 
  for (; v_of_scoreboard_v_begin_it != v_of_scoreboard_v_end_it; ++v_of_scoreboard_v_begin_it)
158
 
  {
159
 
    vector<ScoreboardSlot* > *scoreboard_vector= *v_of_scoreboard_v_begin_it;
160
 
    
161
 
    vector<ScoreboardSlot* >::iterator scoreboard_vector_it= scoreboard_vector->begin();
162
 
    vector<ScoreboardSlot* >::iterator scoreboard_vector_end= scoreboard_vector->end();
163
 
    for (; scoreboard_vector_it != scoreboard_vector_end; ++scoreboard_vector_it)
164
 
    {
165
 
      ScoreboardSlot *scoreboard_slot= *scoreboard_vector_it;
166
 
      if (scoreboard_slot->isInUse())
167
 
      {
168
 
        current_status_vars->merge(scoreboard_slot->getStatusVars());
169
 
      }
170
 
    }
171
 
  }
172
 
}