7 #include "cache-hash-table.h"
8 #include "cache-hash-table.inline.h"
9 #include "standard-hash-table.h"
10 #include "standard-hash-table.inline.h"
11 #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) {
70 for (
int i = 0; i < num_tuples; ++i) {
71 Process<T>(ht, &input[i]);
77 int main(
int argc,
char **argv) {
78 google::InitGoogleLogging(argv[0]);
84 const int NUM_BUILD_TUPLES = 4 * CacheHashTable::MaxBuildTuples() / 10;
86 CacheHashTable cache_ht;
87 StandardHashTable std_ht;
89 ProbeTuple* input = GenTuples(NUM_TUPLES, NUM_BUILD_TUPLES);
91 LOG(ERROR) <<
"Cache-aware time: "
95 LOG(ERROR) <<
"Bucket-chained time: "
uint64_t ElapsedTime() const
Returns time in cpu ticks.
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.