~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_stats/cumulative_stats.cc

  • Committer: Joe Daly
  • Date: 2010-06-02 01:40:45 UTC
  • mto: This revision was merged to the branch mainline in revision 1614.
  • Revision ID: skinny.moey@gmail.com-20100602014045-ahx0jfbhogpzi7mh
global status changes, will need updates to combine session and global status to a realistic class structure

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();
52
53
}
53
54
 
54
55
CumulativeStats::~CumulativeStats()
61
62
  cumulative_stats_by_user_vector->clear();
62
63
  delete cumulative_stats_by_user_vector;
63
64
  delete global_stats;
 
65
  delete global_status_vars;
64
66
}
65
67
 
66
68
void CumulativeStats::logUserStats(ScoreboardSlot *scoreboard_slot)
122
124
  global_stats->updateUserCommands(scoreboard_slot); 
123
125
}
124
126
 
125
 
int32_t  CumulativeStats::getCumulativeStatsLastValidIndex()
 
127
void CumulativeStats::logGlobalStatusVars(ScoreboardSlot* scoreboard_slot)
 
128
{
 
129
  global_status_vars->merge(scoreboard_slot->getStatusVars());
 
130
}
 
131
 
 
132
int32_t CumulativeStats::getCumulativeStatsLastValidIndex()
126
133
{
127
134
  if (last_valid_index < cumulative_stats_by_user_max)
128
135
  {
133
140
    return cumulative_stats_by_user_max;
134
141
  }
135
142
}
 
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
}