| 288 | |
| 289 | using namespace htbenchmark; |
| 290 | std::string ResultString( |
| 291 | vector<std::string> benchmark_names, vector<int64_t> memory_consumption) { |
| 292 | stringstream ss; |
| 293 | int function_out_width = 50; |
| 294 | int mem_width = 20; |
| 295 | int total_width = function_out_width + mem_width; |
| 296 | std::string name("Hash Table Memory Consumption"); |
| 297 | ss << name << ":" << setw(function_out_width - name.size() - 1) << "Function" |
| 298 | << setw(mem_width) << "Bytes Consumed" << std::endl; |
| 299 | for (int i = 0; i < total_width; ++i) { |
| 300 | ss << '-'; |
| 301 | } |
| 302 | ss << std::endl; |
| 303 | for (int i = 0; i < benchmark_names.size(); i++) { |
| 304 | ss << setw(function_out_width) << benchmark_names[i] << setw(mem_width) |
| 305 | << memory_consumption[i] << std::endl; |
| 306 | } |
| 307 | return ss.str(); |
| 308 | } |
| 309 | |
| 310 | int64_t GetMemoryBytesConsumed(HashTable* ht) { |
| 311 | int empty_buckets = ht->EmptyBuckets(); |