5 #include <glog/logging.h>
8 #include "cache-hash-table.h"
9 #include "cache-hash-table.inline.h"
10 #include "standard-hash-table.h"
11 #include "standard-hash-table.inline.h"
12 #include "tuple-types.h"
20 using namespace impala;
25 CacheHashTable::CacheHashTable() {
26 num_content_allocated_ = 0;
29 void CacheHashTable::BucketSizeDistribution() {
30 std::vector<int> bucket_size;
31 for (
int i = 0; i < BUCKETS; ++i) {
32 int size = buckets_[i].count;
33 if (size >= bucket_size.size()) {
35 bucket_size.resize(size + 1, 0);
40 std::stringstream distr;
41 for (
int i = 0; i < bucket_size.size(); ++i) {
42 distr << i <<
": " << bucket_size[i] <<
"\n";
44 LOG(INFO) <<
"Bucket Size Distribution\n" << distr.str();
52 inline void Process(T* ht,
const ProbeTuple* probe) {
53 BuildTuple *existing = ht->Find(probe);
54 if (existing != NULL) {
71 for (
int i = 0; i < num_tuples; ++i) {
72 Process<T>(ht, &input[i]);
78 int main(
int argc,
char **argv) {
79 google::InitGoogleLogging(argv[0]);
85 const int NUM_BUILD_TUPLES = 4 * CacheHashTable::MaxBuildTuples() / 10;
87 CacheHashTable cache_ht;
88 StandardHashTable std_ht;
90 ProbeTuple* input = GenTuples(NUM_TUPLES, NUM_BUILD_TUPLES);
92 LOG(ERROR) <<
"Cache-aware time: "
96 LOG(ERROR) <<
"Bucket-chained time: "
void Process(T *ht, const ProbeTuple *probe)
static std::string Print(bool value, TUnit::type ignored, bool verbose=false)
int main(int argc, char **argv)
uint64_t Test(T *ht, const ProbeTuple *input, uint64_t num_tuples)
static void Init()
Initialize CpuInfo.