OmniSciDB  d2f719934e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp} Namespace Reference

Functions

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)
 
void set_null (import_export::TypedImportBuffer *import_buffer)
 
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)
 

Function Documentation

void foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp}::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 
)

Definition at line 79 of file InternalMemoryStatsDataWrapper.cpp.

References CHUNK_KEY_COLUMN_IDX, CHUNK_KEY_DB_IDX, CHUNK_KEY_TABLE_IDX, Buffer_Namespace::FREE, and set_null().

Referenced by foreign_storage::InternalMemoryStatsDataWrapper::populateChunkBuffersForTable().

81  {
82  for (const auto& [device_type, memory_info_vector] : memory_info_by_device_type) {
83  int32_t device_id{0};
84  for (const auto& memory_info : memory_info_vector) {
85  for (const auto& memory_data : memory_info.nodeMemoryData) {
86  if (import_buffers.find("node") != import_buffers.end()) {
87  import_buffers["node"]->addString("Server");
88  }
89  const auto& chunk_key = memory_data.chunk_key;
90  if (import_buffers.find("database_id") != import_buffers.end()) {
91  auto import_buffer = import_buffers["database_id"];
92  if (chunk_key.empty()) {
93  set_null(import_buffer);
94  } else {
95  import_buffer->addInt(chunk_key[CHUNK_KEY_DB_IDX]);
96  }
97  }
98  if (import_buffers.find("table_id") != import_buffers.end()) {
99  auto import_buffer = import_buffers["table_id"];
100  if (chunk_key.empty()) {
101  set_null(import_buffer);
102  } else {
103  import_buffer->addInt(chunk_key[CHUNK_KEY_TABLE_IDX]);
104  }
105  }
106  if (import_buffers.find("column_id") != import_buffers.end()) {
107  auto import_buffer = import_buffers["column_id"];
108  if (chunk_key.empty()) {
109  set_null(import_buffer);
110  } else {
111  import_buffer->addInt(chunk_key[CHUNK_KEY_COLUMN_IDX]);
112  }
113  }
114  if (import_buffers.find("chunk_key") != import_buffers.end()) {
115  import_buffers["chunk_key"]->addArray(ArrayDatum(
116  chunk_key.size() * sizeof(int32_t),
117  reinterpret_cast<int8_t*>(const_cast<int32_t*>(chunk_key.data())),
118  DoNothingDeleter()));
119  }
120  if (import_buffers.find("device_id") != import_buffers.end()) {
121  import_buffers["device_id"]->addInt(device_id);
122  }
123  if (import_buffers.find("device_type") != import_buffers.end()) {
124  import_buffers["device_type"]->addString(device_type);
125  }
126  if (import_buffers.find("memory_status") != import_buffers.end()) {
127  auto memory_status =
128  (memory_data.memStatus == Buffer_Namespace::MemStatus::FREE ? "FREE"
129  : "USED");
130  import_buffers["memory_status"]->addString(memory_status);
131  }
132  if (import_buffers.find("page_count") != import_buffers.end()) {
133  import_buffers["page_count"]->addBigint(memory_data.numPages);
134  }
135  if (import_buffers.find("page_size") != import_buffers.end()) {
136  import_buffers["page_size"]->addBigint(memory_info.pageSize);
137  }
138  if (import_buffers.find("slab_id") != import_buffers.end()) {
139  import_buffers["slab_id"]->addInt(memory_data.slabNum);
140  }
141  if (import_buffers.find("start_page") != import_buffers.end()) {
142  import_buffers["start_page"]->addBigint(memory_data.startPage);
143  }
144  if (import_buffers.find("last_touch_epoch") != import_buffers.end()) {
145  import_buffers["last_touch_epoch"]->addBigint(memory_data.touch);
146  }
147  }
148  device_id++;
149  }
150  }
151 }
#define CHUNK_KEY_DB_IDX
Definition: types.h:39
std::conditional_t< is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum > ArrayDatum
Definition: sqltypes.h:208
CONSTEXPR DEVICE void set_null(T &value)
#define CHUNK_KEY_TABLE_IDX
Definition: types.h:40
#define CHUNK_KEY_COLUMN_IDX
Definition: types.h:41

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp}::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 
)

Definition at line 32 of file InternalMemoryStatsDataWrapper.cpp.

References Buffer_Namespace::FREE.

Referenced by foreign_storage::InternalMemoryStatsDataWrapper::populateChunkBuffersForTable().

34  {
35  for (const auto& [device_type, memory_info_vector] : memory_info_by_device_type) {
36  int32_t device_id{0};
37  for (const auto& memory_info : memory_info_vector) {
38  size_t used_page_count{0}, free_page_count{0};
39  for (const auto& memory_data : memory_info.nodeMemoryData) {
40  if (memory_data.memStatus == Buffer_Namespace::MemStatus::FREE) {
41  free_page_count += memory_data.numPages;
42  } else {
43  used_page_count += memory_data.numPages;
44  }
45  }
46  if (import_buffers.find("node") != import_buffers.end()) {
47  import_buffers["node"]->addString("Server");
48  }
49  if (import_buffers.find("device_id") != import_buffers.end()) {
50  import_buffers["device_id"]->addInt(device_id);
51  }
52  if (import_buffers.find("device_type") != import_buffers.end()) {
53  import_buffers["device_type"]->addString(device_type);
54  }
55  if (import_buffers.find("max_page_count") != import_buffers.end()) {
56  import_buffers["max_page_count"]->addBigint(memory_info.maxNumPages);
57  }
58  if (import_buffers.find("page_size") != import_buffers.end()) {
59  import_buffers["page_size"]->addBigint(memory_info.pageSize);
60  }
61  if (import_buffers.find("allocated_page_count") != import_buffers.end()) {
62  import_buffers["allocated_page_count"]->addBigint(memory_info.numPageAllocated);
63  }
64  if (import_buffers.find("used_page_count") != import_buffers.end()) {
65  import_buffers["used_page_count"]->addBigint(used_page_count);
66  }
67  if (import_buffers.find("free_page_count") != import_buffers.end()) {
68  import_buffers["free_page_count"]->addBigint(free_page_count);
69  }
70  device_id++;
71  }
72  }
73 }

+ Here is the caller graph for this function:

void foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp}::set_null ( import_export::TypedImportBuffer import_buffer)

Definition at line 75 of file InternalMemoryStatsDataWrapper.cpp.

References import_export::TypedImportBuffer::add_value(), and import_export::TypedImportBuffer::getColumnDesc().

75  {
76  import_buffer->add_value(import_buffer->getColumnDesc(), "", true, {});
77 }
void add_value(const ColumnDescriptor *cd, const std::string_view val, const bool is_null, const CopyParams &copy_params)
Definition: Importer.cpp:549
const ColumnDescriptor * getColumnDesc() const
Definition: Importer.h:311

+ Here is the call graph for this function: