OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data_Namespace::anonymous_namespace{DataMgr.cpp}::BuddyinfoBlocks Struct Reference

Classes

struct  Horner
 

Public Member Functions

 BuddyinfoBlocks ()=default
 
 BuddyinfoBlocks (std::string_view const *const tokens, size_t const num_blocks)
 
void addBlocks (BuddyinfoBlocks const &rhs)
 
double fragPercent () const
 
size_t highestBlock () const
 
size_t sumAvailPages () const
 

Public Attributes

small_vector< size_t,
kMaxBuddyinfoBlocks
blocks
 

Detailed Description

Definition at line 774 of file DataMgr.cpp.

Constructor & Destructor Documentation

Data_Namespace::anonymous_namespace{DataMgr.cpp}::BuddyinfoBlocks::BuddyinfoBlocks ( )
default
Data_Namespace::anonymous_namespace{DataMgr.cpp}::BuddyinfoBlocks::BuddyinfoBlocks ( std::string_view const *const  tokens,
size_t const  num_blocks 
)
inline

Definition at line 785 of file DataMgr.cpp.

785  {
786  for (size_t i = 0; i < num_blocks; ++i) {
787  size_t block;
788  std::from_chars(tokens[i].data(), tokens[i].data() + tokens[i].size(), block);
789  blocks.push_back(block);
790  }
791  }
small_vector< size_t, kMaxBuddyinfoBlocks > blocks
Definition: DataMgr.cpp:775

Member Function Documentation

void Data_Namespace::anonymous_namespace{DataMgr.cpp}::BuddyinfoBlocks::addBlocks ( BuddyinfoBlocks const &  rhs)
inline

Definition at line 793 of file DataMgr.cpp.

References blocks.

793  {
794  if (blocks.size() < rhs.blocks.size()) {
795  blocks.resize(rhs.blocks.size(), 0u);
796  }
797  for (size_t i = 0; i < rhs.blocks.size(); ++i) {
798  blocks[i] += rhs.blocks[i];
799  }
800  }
small_vector< size_t, kMaxBuddyinfoBlocks > blocks
Definition: DataMgr.cpp:775
double Data_Namespace::anonymous_namespace{DataMgr.cpp}::BuddyinfoBlocks::fragPercent ( ) const
inline

Definition at line 802 of file DataMgr.cpp.

References Data_Namespace::anonymous_namespace{DataMgr.cpp}::kErrorCodeOutOfMemory.

802  {
803  if (blocks.size() < 2u) {
804  return 0.0; // No fragmentation is possible with only one block column.
805  }
806  size_t scaled = 0;
807  size_t total = 0;
808  for (size_t order = 0; order < blocks.size(); ++order) {
809  size_t const pages = blocks[order] << order;
810  scaled += pages * (blocks.size() - 1 - order) / (blocks.size() - 1);
811  total += pages;
812  }
813  return total ? scaled * 100.0 / total : kErrorCodeOutOfMemory;
814  }
small_vector< size_t, kMaxBuddyinfoBlocks > blocks
Definition: DataMgr.cpp:775
size_t Data_Namespace::anonymous_namespace{DataMgr.cpp}::BuddyinfoBlocks::highestBlock ( ) const
inline

Definition at line 816 of file DataMgr.cpp.

816 { return blocks.empty() ? 0 : blocks.back(); }
small_vector< size_t, kMaxBuddyinfoBlocks > blocks
Definition: DataMgr.cpp:775
size_t Data_Namespace::anonymous_namespace{DataMgr.cpp}::BuddyinfoBlocks::sumAvailPages ( ) const
inline

Definition at line 818 of file DataMgr.cpp.

References gpu_enabled::accumulate().

818  {
819  return std::accumulate(blocks.rbegin(), blocks.rend(), size_t(0), Horner{});
820  }
small_vector< size_t, kMaxBuddyinfoBlocks > blocks
Definition: DataMgr.cpp:775
DEVICE auto accumulate(ARGS &&...args)
Definition: gpu_enabled.h:42

+ Here is the call graph for this function:

Member Data Documentation

small_vector<size_t, kMaxBuddyinfoBlocks> Data_Namespace::anonymous_namespace{DataMgr.cpp}::BuddyinfoBlocks::blocks

Definition at line 775 of file DataMgr.cpp.

Referenced by addBlocks().


The documentation for this struct was generated from the following file: