OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::InternalMemoryStatsDataWrapper Class Reference

#include <InternalMemoryStatsDataWrapper.h>

+ Inheritance diagram for foreign_storage::InternalMemoryStatsDataWrapper:
+ Collaboration diagram for foreign_storage::InternalMemoryStatsDataWrapper:

Public Member Functions

 InternalMemoryStatsDataWrapper ()
 
 InternalMemoryStatsDataWrapper (const int db_id, const ForeignTable *foreign_table)
 
- Public Member Functions inherited from foreign_storage::InternalSystemDataWrapper
 InternalSystemDataWrapper ()
 
 InternalSystemDataWrapper (const int db_id, const ForeignTable *foreign_table)
 
void populateChunkMetadata (ChunkMetadataVector &chunk_metadata_vector) override
 
void populateChunkBuffers (const ChunkToBufferMap &required_buffers, const ChunkToBufferMap &optional_buffers, AbstractBuffer *delete_buffer) override
 
void validateServerOptions (const ForeignServer *foreign_server) const override
 
void validateTableOptions (const ForeignTable *foreign_table) const override
 
const std::set
< std::string_view > & 
getSupportedTableOptions () const override
 
void validateUserMappingOptions (const UserMapping *user_mapping, const ForeignServer *foreign_server) const override
 
const std::set
< std::string_view > & 
getSupportedUserMappingOptions () const override
 
std::string getSerializedDataWrapper () const override
 
void restoreDataWrapperInternals (const std::string &file_path, const ChunkMetadataVector &chunk_metadata) override
 
bool isRestored () const override
 
- Public Member Functions inherited from foreign_storage::ForeignDataWrapper
 ForeignDataWrapper ()=default
 
virtual ~ForeignDataWrapper ()=default
 
virtual const std::set
< std::string > 
getAlterableTableOptions () const
 
virtual void validateSchema (const std::list< ColumnDescriptor > &columns) const
 
virtual ParallelismLevel getCachedParallelismLevel () const
 
virtual ParallelismLevel getNonCachedParallelismLevel () const
 
virtual void createRenderGroupAnalyzers ()
 Create RenderGroupAnalyzers for poly columns. More...
 
virtual bool isLazyFragmentFetchingEnabled () const
 

Private Member Functions

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
 

Private Attributes

std::map< std::string,
std::vector< MemoryInfo > > 
memory_info_by_device_type_
 

Additional Inherited Members

- Public Types inherited from foreign_storage::ForeignDataWrapper
enum  ParallelismLevel { NONE, INTRA_FRAGMENT, INTER_FRAGMENT }
 
- Protected Attributes inherited from foreign_storage::InternalSystemDataWrapper
const int db_id_
 
const ForeignTableforeign_table_
 
size_t row_count_ {0}
 

Detailed Description

Definition at line 29 of file InternalMemoryStatsDataWrapper.h.

Constructor & Destructor Documentation

foreign_storage::InternalMemoryStatsDataWrapper::InternalMemoryStatsDataWrapper ( )
foreign_storage::InternalMemoryStatsDataWrapper::InternalMemoryStatsDataWrapper ( const int  db_id,
const ForeignTable foreign_table 
)

Member Function Documentation

void foreign_storage::InternalMemoryStatsDataWrapper::initializeObjectsForTable ( const std::string &  table_name)
overrideprivatevirtual

Implements foreign_storage::InternalSystemDataWrapper.

Definition at line 195 of file InternalMemoryStatsDataWrapper.cpp.

References CHECK_GE, Data_Namespace::CPU_LEVEL, foreign_storage::InternalSystemDataWrapper::foreign_table_, Buffer_Namespace::FREE, Catalog_Namespace::SysCatalog::getDataMgr(), Data_Namespace::GPU_LEVEL, Catalog_Namespace::SysCatalog::instance(), foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp}::is_table_chunk(), Catalog_Namespace::MEMORY_DETAILS_SYS_TABLE_NAME, memory_info_by_device_type_, Catalog_Namespace::MEMORY_SUMMARY_SYS_TABLE_NAME, foreign_storage::InternalSystemDataWrapper::row_count_, TableDescriptor::tableName, and UNREACHABLE.

196  {
198  row_count_ = 0;
199  const auto& data_mgr = Catalog_Namespace::SysCatalog::instance().getDataMgr();
200  // DataMgr::getMemoryInfoUnlocked() is used here because a lock on buffer_access_mutex_
201  // is already acquired in DataMgr::getChunkMetadataVecForKeyPrefix()
203  data_mgr.getMemoryInfoUnlocked(MemoryLevel::CPU_LEVEL);
205  data_mgr.getMemoryInfoUnlocked(MemoryLevel::GPU_LEVEL);
207  for (const auto& [device_type, memory_info_vector] : memory_info_by_device_type_) {
208  row_count_ += memory_info_vector.size();
209  }
210  } else if (foreign_table_->tableName ==
212  for (auto& [device_type, memory_info_vector] : memory_info_by_device_type_) {
213  for (auto& memory_info : memory_info_vector) {
214  for (auto& memory_data : memory_info.nodeMemoryData) {
215  if (memory_data.memStatus == Buffer_Namespace::MemStatus::FREE) {
216  memory_data.chunk_key.clear();
217  } else {
218  if (is_table_chunk(memory_data.chunk_key)) {
219  CHECK_GE(memory_data.chunk_key.size(), static_cast<size_t>(4));
220  }
221  }
222  }
223  row_count_ += memory_info.nodeMemoryData.size();
224  }
225  }
226  } else {
227  UNREACHABLE() << "Unexpected table name: " << table_name;
228  }
229 }
static constexpr const char * MEMORY_DETAILS_SYS_TABLE_NAME
Definition: Catalog.h:112
std::string tableName
#define UNREACHABLE()
Definition: Logger.h:337
#define CHECK_GE(x, y)
Definition: Logger.h:306
Data_Namespace::DataMgr & getDataMgr() const
Definition: SysCatalog.h:234
static SysCatalog & instance()
Definition: SysCatalog.h:343
static constexpr const char * MEMORY_SUMMARY_SYS_TABLE_NAME
Definition: Catalog.h:111
std::map< std::string, std::vector< MemoryInfo > > memory_info_by_device_type_

+ Here is the call graph for this function:

void foreign_storage::InternalMemoryStatsDataWrapper::populateChunkBuffersForTable ( const std::string &  table_name,
std::map< std::string, import_export::TypedImportBuffer * > &  import_buffers 
)
overrideprivatevirtual

Implements foreign_storage::InternalSystemDataWrapper.

Definition at line 231 of file InternalMemoryStatsDataWrapper.cpp.

References foreign_storage::InternalSystemDataWrapper::foreign_table_, Catalog_Namespace::MEMORY_DETAILS_SYS_TABLE_NAME, memory_info_by_device_type_, Catalog_Namespace::MEMORY_SUMMARY_SYS_TABLE_NAME, foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp}::populate_import_buffers_for_memory_details(), foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp}::populate_import_buffers_for_memory_summary(), TableDescriptor::tableName, and UNREACHABLE.

233  {
236  import_buffers);
237  } else if (foreign_table_->tableName ==
240  import_buffers);
241  } else {
242  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
243  }
244 }
static constexpr const char * MEMORY_DETAILS_SYS_TABLE_NAME
Definition: Catalog.h:112
std::string tableName
#define UNREACHABLE()
Definition: Logger.h:337
static constexpr const char * MEMORY_SUMMARY_SYS_TABLE_NAME
Definition: Catalog.h:111
std::map< std::string, std::vector< MemoryInfo > > memory_info_by_device_type_
void populate_import_buffers_for_memory_details(const std::map< std::string, std::vector< MemoryInfo >> &memory_info_by_device_type, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
void populate_import_buffers_for_memory_summary(const std::map< std::string, std::vector< MemoryInfo >> &memory_info_by_device_type, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)

+ Here is the call graph for this function:

Member Data Documentation

std::map<std::string, std::vector<MemoryInfo> > foreign_storage::InternalMemoryStatsDataWrapper::memory_info_by_device_type_
private

The documentation for this class was generated from the following files: