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"
21 using namespace impala;
26 CacheHashTable::CacheHashTable() {
27 num_content_allocated_ = 0;
30 void CacheHashTable::BucketSizeDistribution() {
31 std::vector<int> bucket_size;
32 for (
int i = 0; i < BUCKETS; ++i) {
33 int size = buckets_[i].count;
34 if (size >= bucket_size.size()) {
36 bucket_size.resize(size + 1, 0);
41 std::stringstream distr;
42 for (
int i = 0; i < bucket_size.size(); ++i) {
43 distr << i <<
": " << bucket_size[i] <<
"\n";
45 LOG(INFO) <<
"Bucket Size Distribution\n" << distr.str();
53 inline void Process(T* ht,
const ProbeTuple* probe) {
54 BuildTuple *existing = ht->Find(probe);
55 if (existing != NULL) {
72 for (
int i = 0; i < num_tuples; ++i) {
73 Process<T>(ht, &input[i]);
79 int main(
int argc,
char **argv) {
80 google::InitGoogleLogging(argv[0]);
86 const int NUM_BUILD_TUPLES = 4 * CacheHashTable::MaxBuildTuples() / 10;
88 CacheHashTable cache_ht;
89 StandardHashTable std_ht;
91 ProbeTuple* input = GenTuples(NUM_TUPLES, NUM_BUILD_TUPLES);
93 LOG(ERROR) <<
"Cache-aware time: "
97 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.