~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_stats/logging_stats.h

  • Committer: Stewart Smith
  • Date: 2011-01-14 05:18:23 UTC
  • mto: (2086.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 2087.
  • Revision ID: stewart@flamingspork.com-20110114051823-14fyn2kvg8pc5a15
\r and trailing whitespace removed.

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
30
30
#ifndef PLUGIN_LOGGING_STATS_LOGGING_STATS_H
31
31
#define PLUGIN_LOGGING_STATS_LOGGING_STATS_H
32
32
 
33
 
#include "score_board_slot.h"
 
33
#include "scoreboard_slot.h"
 
34
#include "cumulative_stats.h"
 
35
#include "scoreboard.h"
34
36
 
35
37
#include <drizzled/atomics.h>
36
38
#include <drizzled/enum.h>
38
40
#include <drizzled/plugin/logging.h>
39
41
 
40
42
#include <string>
41
 
 
42
 
extern pthread_rwlock_t LOCK_scoreboard;
 
43
#include <vector>
43
44
 
44
45
class LoggingStats: public drizzled::plugin::Logging
45
46
{
53
54
 
54
55
  virtual bool postEnd(drizzled::Session *session);
55
56
 
 
57
  virtual bool resetGlobalScoreboard();
 
58
 
56
59
  bool isEnabled() const
57
60
  {
58
61
    return is_enabled;
68
71
    is_enabled= false;
69
72
  }
70
73
 
71
 
  uint32_t getScoreBoardSize()
72
 
  {
73
 
    return scoreboard_size;
 
74
  Scoreboard *getCurrentScoreboard()
 
75
  {          
 
76
    return current_scoreboard;
74
77
  }
75
78
 
76
 
  ScoreBoardSlot *getScoreBoardSlots()
 
79
  CumulativeStats *getCumulativeStats()
77
80
  {
78
 
    return score_board_slots;
 
81
    return cumulative_stats;
79
82
  }
80
83
 
81
84
private:
82
 
  static const int32_t UNINITIALIZED= -1;
83
 
 
84
 
  bool isBeingLogged(drizzled::Session *session);
85
 
 
86
 
  void updateScoreBoard(ScoreBoardSlot *score_board_slot, drizzled::Session *session);
 
85
  Scoreboard *current_scoreboard;
 
86
 
 
87
  CumulativeStats *cumulative_stats;
87
88
 
88
89
  drizzled::atomic<bool> is_enabled;
89
90
 
90
 
  ScoreBoardSlot *score_board_slots;
 
91
  void updateCurrentScoreboard(ScoreboardSlot *scoreboard_slot, drizzled::Session *session);
91
92
 
92
 
  uint32_t scoreboard_size;
 
93
  typedef std::vector<std::vector<ScoreboardSlot* >* > ScoreBoardVectors;
93
94
};
94
95
#endif /* PLUGIN_LOGGING_STATS_LOGGING_STATS_H */