0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
StatsRangeServer.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #ifndef Hypertable_Lib_StatsRangeServer_h
23 #define Hypertable_Lib_StatsRangeServer_h
24 
25 #include "StatsTable.h"
26 
27 #include <Common/Properties.h>
29 #include <Common/StatsSystem.h>
30 #include <Common/StringExt.h>
31 #include <Common/SystemInfo.h>
32 
33 #include <boost/algorithm/string.hpp>
34 
35 #include <memory>
36 #include <vector>
37 
38 namespace Hypertable {
39 
40  typedef std::map<const char*, StatsTable *, LtCstr> StatsTableMap;
41 
43 
44  public:
45 
47 
49 
50  StatsRangeServer(const StatsRangeServer &other);
51 
52  void set_location( const std::string &loc ) {
53  if (loc != location)
54  location = loc;
55  }
56  void set_version( const std::string &ver ) {
57  if (ver != version)
58  version = ver;
59  }
60  bool operator==(const StatsRangeServer &other) const;
61  bool operator!=(const StatsRangeServer &other) const {
62  return !(*this == other);
63  }
64 
65  std::string location;
66  std::string version;
67  int64_t timestamp {};
68  int32_t range_count {};
69  int32_t scanner_count {};
70  uint64_t file_count {};
71  uint64_t scan_count {};
72  uint64_t scanned_cells {};
73  uint64_t scanned_bytes {};
74  uint64_t update_count {};
75  uint64_t updated_cells {};
76  uint64_t updated_bytes {};
77  uint64_t sync_count {};
80  uint64_t query_cache_accesses {};
81  uint64_t query_cache_hits {};
84  uint64_t block_cache_accesses {};
85  uint64_t block_cache_hits {};
86  uint64_t tracked_memory {};
87  double cpu_user {};
88  double cpu_sys {};
89  bool live {};
90 
92  std::vector<StatsTable> tables;
93  StatsTableMap table_map;
94 
95  protected:
96  virtual size_t encoded_length_group(int group) const;
97  virtual void encode_group(int group, uint8_t **bufp) const;
98  virtual void decode_group(int group, uint16_t len, const uint8_t **bufp, size_t *remainp);
99 
100  };
101 
103  typedef std::shared_ptr<StatsRangeServer> StatsRangeServerPtr;
104 
105 }
106 
107 #endif // Hypertable_Lib_StatsRangeServer_h
108 
109 
Abstract base class for managing serialized statistics.
Base class managing serialized statistics.
std::shared_ptr< StatsRangeServer > StatsRangeServerPtr
Smart pointer to StatsRangeServer.
virtual void decode_group(int group, uint16_t len, const uint8_t **bufp, size_t *remainp)
Abstruct function to deserialize a group from a memory buffer.
Program options handling.
Collecting and (de)serializing system-wide statistics.
void set_location(const std::string &loc)
std::vector< StatsTable > tables
void set_version(const std::string &ver)
std::shared_ptr< Properties > PropertiesPtr
Definition: Properties.h:447
virtual void encode_group(int group, uint8_t **bufp) const
Abstruct function to serialize a group into a memory buffer.
Collects, serializes and deserializes system-wide statistics.
Definition: StatsSystem.h:43
virtual size_t encoded_length_group(int group) const
Abstruct function returning the serialized length of a group.
Hypertable definitions
std::map< const char *, StatsTable *, LtCstr > StatsTableMap
bool operator==(const StatsRangeServer &other) const
System information and statistics based on libsigar.
String extensions and helpers: sets, maps, append operators etc.
bool operator!=(const StatsRangeServer &other) const