OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InternalExecutorStatsDataWrapper.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #include "Catalog/SysCatalog.h"
20 #include "ImportExport/Importer.h"
21 #include "QueryEngine/Execute.h"
22 
23 namespace foreign_storage {
26 
28  const int db_id,
29  const ForeignTable* foreign_table)
30  : InternalSystemDataWrapper(db_id, foreign_table) {}
31 
32 namespace {
34  const ExecutorResourceMgr_Namespace::ResourcePoolInfo& resource_pool_info,
35  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
36  if (auto itr = import_buffers.find("total_cpu_slots"); itr != import_buffers.end()) {
37  itr->second->addInt(resource_pool_info.total_cpu_slots);
38  }
39  if (auto itr = import_buffers.find("total_gpu_slots"); itr != import_buffers.end()) {
40  itr->second->addInt(resource_pool_info.total_gpu_slots);
41  }
42  if (auto itr = import_buffers.find("total_cpu_result_mem");
43  itr != import_buffers.end()) {
44  itr->second->addInt(resource_pool_info.total_cpu_result_mem);
45  }
46  if (auto itr = import_buffers.find("total_cpu_buffer_pool_mem");
47  itr != import_buffers.end()) {
48  itr->second->addBigint(resource_pool_info.total_cpu_buffer_pool_mem);
49  }
50  if (auto itr = import_buffers.find("total_gpu_buffer_pool_mem");
51  itr != import_buffers.end()) {
52  itr->second->addBigint(resource_pool_info.total_gpu_buffer_pool_mem);
53  }
54 
55  if (auto itr = import_buffers.find("allocated_cpu_slots");
56  itr != import_buffers.end()) {
57  itr->second->addInt(resource_pool_info.allocated_cpu_slots);
58  }
59  if (auto itr = import_buffers.find("allocated_gpu_slots");
60  itr != import_buffers.end()) {
61  itr->second->addInt(resource_pool_info.allocated_cpu_slots);
62  }
63  if (auto itr = import_buffers.find("allocated_cpu_result_mem");
64  itr != import_buffers.end()) {
65  itr->second->addInt(resource_pool_info.allocated_cpu_result_mem);
66  }
67  if (auto itr = import_buffers.find("allocated_cpu_buffer_pool_mem");
68  itr != import_buffers.end()) {
69  itr->second->addBigint(resource_pool_info.allocated_cpu_buffer_pool_mem);
70  }
71  if (auto itr = import_buffers.find("allocated_gpu_buffer_pool_mem");
72  itr != import_buffers.end()) {
73  itr->second->addBigint(resource_pool_info.allocated_gpu_buffer_pool_mem);
74  }
75  if (auto itr = import_buffers.find("allocated_cpu_buffers");
76  itr != import_buffers.end()) {
77  itr->second->addInt(resource_pool_info.allocated_cpu_buffers);
78  }
79  if (auto itr = import_buffers.find("allocated_gpu_buffers");
80  itr != import_buffers.end()) {
81  itr->second->addInt(resource_pool_info.allocated_gpu_buffers);
82  }
83  if (auto itr = import_buffers.find("allocated_temp_cpu_buffer_pool_mem");
84  itr != import_buffers.end()) {
85  itr->second->addBigint(resource_pool_info.allocated_temp_cpu_buffer_pool_mem);
86  }
87  if (auto itr = import_buffers.find("allocated_temp_gpu_buffer_pool_mem");
88  itr != import_buffers.end()) {
89  itr->second->addBigint(resource_pool_info.allocated_temp_gpu_buffer_pool_mem);
90  }
91 
92  if (auto itr = import_buffers.find("total_requests"); itr != import_buffers.end()) {
93  itr->second->addBigint(resource_pool_info.total_requests);
94  }
95  if (auto itr = import_buffers.find("outstanding_requests");
96  itr != import_buffers.end()) {
97  itr->second->addInt(resource_pool_info.outstanding_requests);
98  }
99  if (auto itr = import_buffers.find("outstanding_cpu_slots_requests");
100  itr != import_buffers.end()) {
101  itr->second->addInt(resource_pool_info.outstanding_cpu_slots_requests);
102  }
103  if (auto itr = import_buffers.find("outstanding_gpu_slots_requests");
104  itr != import_buffers.end()) {
105  itr->second->addInt(resource_pool_info.outstanding_gpu_slots_requests);
106  }
107  if (auto itr = import_buffers.find("outstanding_cpu_result_mem_requests");
108  itr != import_buffers.end()) {
109  itr->second->addInt(resource_pool_info.outstanding_cpu_result_mem_requests);
110  }
111  if (auto itr = import_buffers.find("outstanding_cpu_buffer_pool_mem_requests");
112  itr != import_buffers.end()) {
113  itr->second->addInt(resource_pool_info.outstanding_cpu_buffer_pool_mem_requests);
114  }
115  if (auto itr = import_buffers.find("outstanding_gpu_buffer_pool_mem_requests");
116  itr != import_buffers.end()) {
117  itr->second->addInt(resource_pool_info.outstanding_gpu_buffer_pool_mem_requests);
118  }
119 }
120 
121 } // namespace
122 
124  const std::string& table_name) {
125  CHECK_EQ(foreign_table_->tableName, table_name);
128  << "Unexpected table name: " << foreign_table_->tableName;
130  row_count_ = 1;
131 }
132 
134  const std::string& table_name,
135  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
136  CHECK_EQ(foreign_table_->tableName, table_name);
139  << "Unexpected table name: " << foreign_table_->tableName;
141  import_buffers);
142 }
143 
144 } // namespace foreign_storage
A container for various stats about the current state of the ExecutorResourcePool. Note that ExecutorResourcePool does not persist a struct of this type, but rather builds one on the fly when ExecutorResourcePool::get_resource_info() is called.
#define CHECK_EQ(x, y)
Definition: Logger.h:301
static constexpr const char * EXECUTOR_RESOURCE_POOL_SUMMARY_SYS_TABLE_NAME
Definition: Catalog.h:122
std::string tableName
static ExecutorResourceMgr_Namespace::ResourcePoolInfo get_executor_resource_pool_info()
Definition: Execute.cpp:5448
This file contains the class specification and related data structures for SysCatalog.
void populate_import_buffers_for_executor_resource_pool_summary(const ExecutorResourceMgr_Namespace::ResourcePoolInfo &resource_pool_info, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
void initializeObjectsForTable(const std::string &table_name) override
void populateChunkBuffersForTable(const std::string &table_name, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers) override
ExecutorResourceMgr_Namespace::ResourcePoolInfo executor_resource_pool_info_