1 /* Copyright (C) 2014 InfiniDB, Inc. 2 3 This program is free software; you can redistribute it and/or 4 modify it under the terms of the GNU General Public License 5 as published by the Free Software Foundation; version 2 of 6 the License. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 MA 02110-1301, USA. */ 17 18 #ifndef TELESTATS_H__ 19 #define TELESTATS_H__ 20 21 #include <unistd.h> 22 #include <stdint.h> 23 #include <string> 24 #include <ctime> 25 #include <vector> 26 27 #include <boost/uuid/uuid.hpp> 28 #include <boost/uuid/uuid_generators.hpp> 29 30 namespace querytele 31 { 32 33 struct QueryTeleStats 34 { 35 enum QTType 36 { 37 QT_INVALID, 38 QT_SUMMARY, 39 QT_PROGRESS, 40 QT_START, 41 }; 42 QueryTeleStatsQueryTeleStats43 QueryTeleStats() : 44 msg_type(QT_INVALID), 45 max_mem_pct(0), 46 num_files(0), 47 phy_io(0), 48 cache_io(0), 49 msg_rcv_cnt(0), 50 cp_blocks_skipped(0), 51 msg_bytes_in(0), 52 msg_bytes_out(0), 53 rows(0), 54 start_time(-1), 55 end_time(-1), 56 error_no(0), 57 blocks_changed(0), 58 session_id(0), 59 priority_level(0), 60 local_query(0) 61 { 62 query_uuid = boost::uuids::nil_generator()(); 63 } 64 ~QueryTeleStatsQueryTeleStats65 ~QueryTeleStats() { } 66 67 boost::uuids::uuid query_uuid; 68 QTType msg_type; 69 int64_t max_mem_pct; 70 int64_t num_files; 71 int64_t phy_io; 72 int64_t cache_io; 73 int64_t msg_rcv_cnt; 74 int64_t cp_blocks_skipped; 75 int64_t msg_bytes_in; 76 int64_t msg_bytes_out; 77 int64_t rows; 78 int64_t start_time; 79 int64_t end_time; 80 int64_t error_no; 81 int64_t blocks_changed; 82 int64_t session_id; 83 std::string query_type; 84 std::string query; 85 std::string user; 86 std::string host; 87 std::string priority; 88 int32_t priority_level; 89 std::string system_name; 90 std::string module_name; 91 int32_t local_query; 92 std::string schema_name; 93 }; 94 95 struct StepTeleStats 96 { 97 enum STType 98 { 99 ST_INVALID, 100 ST_SUMMARY, 101 ST_PROGRESS, 102 ST_START, 103 }; 104 105 enum StepType 106 { 107 T_INVALID, 108 T_HJS, //TupleHashJoinStep 109 T_DSS, //DictionaryScanStep 110 T_CES, //CrossEngineStep 111 T_SQS, //SubQueryStep 112 T_TAS, //TupleAggregateStep 113 T_TNS, //TupleAnnexStep 114 T_BPS, //TupleBPS 115 T_TCS, //TupleConstantStep 116 T_HVS, //TupleHavingStep 117 T_WFS, //WindowFunctionStep 118 T_SAS, //SubAdapterStep 119 T_TUN, //TupleUnion 120 }; 121 StepTeleStatsStepTeleStats122 StepTeleStats() : 123 msg_type(ST_INVALID), 124 step_type(T_INVALID), 125 phy_io(0), 126 cache_io(0), 127 msg_rcv_cnt(0), 128 cp_blocks_skipped(0), 129 msg_bytes_in(0), 130 msg_bytes_out(0), 131 rows(0), 132 start_time(-1), 133 end_time(-1), 134 total_units_of_work(0), 135 units_of_work_completed(0) 136 { 137 query_uuid = boost::uuids::nil_generator()(); 138 step_uuid = boost::uuids::nil_generator()(); 139 } 140 ~StepTeleStatsStepTeleStats141 ~StepTeleStats() { } 142 143 boost::uuids::uuid query_uuid; 144 STType msg_type; 145 StepType step_type; 146 boost::uuids::uuid step_uuid; 147 int64_t phy_io; 148 int64_t cache_io; 149 int64_t msg_rcv_cnt; 150 int64_t cp_blocks_skipped; 151 int64_t msg_bytes_in; 152 int64_t msg_bytes_out; 153 int64_t rows; 154 int64_t start_time; 155 int64_t end_time; 156 int32_t total_units_of_work; 157 int32_t units_of_work_completed; 158 }; 159 160 struct ImportTeleStats 161 { 162 typedef std::vector<std::string> StringList; 163 typedef std::vector<int64_t> I64List; 164 165 enum ITType 166 { 167 IT_INVALID, 168 IT_SUMMARY, 169 IT_PROGRESS, 170 IT_START, 171 IT_TERM, 172 }; 173 ImportTeleStatsImportTeleStats174 ImportTeleStats() : 175 msg_type(IT_INVALID), 176 start_time(-1), 177 end_time(-1) 178 { 179 job_uuid = boost::uuids::nil_generator()(); 180 import_uuid = boost::uuids::nil_generator()(); 181 } 182 183 boost::uuids::uuid job_uuid; 184 boost::uuids::uuid import_uuid; 185 ITType msg_type; 186 int64_t start_time; 187 int64_t end_time; 188 StringList table_list; 189 I64List rows_so_far; 190 std::string system_name; 191 std::string module_name; 192 std::string schema_name; 193 }; 194 195 } 196 197 #endif 198 199