25 using namespace impala;
59 static const int UnpaddedSize = 1 + 8 + 2 + 8;
92 int8_t rand_a = rand() % 256;
93 double rand_val = rand() / (double)RAND_MAX;
94 int16_t rand_c = rand() % 30000;
95 int64_t rand_id = rand() %
MAX_ID;
108 *
reinterpret_cast<int8_t*
>(unpadded_ptr) = rand_a;
110 *
reinterpret_cast<double*
>(unpadded_ptr) = rand_val;
112 *
reinterpret_cast<int16_t*
>(unpadded_ptr) = rand_c;
114 *
reinterpret_cast<int64_t*
>(unpadded_ptr) = rand_id;
118 DCHECK_EQ(unpadded_ptr,
119 data->
unaligned_data + NUM_TUPLES * PaddedTupleStruct::UnpaddedSize);
126 for (
int i = 0; i < batch_size; ++i) {
137 for (
int i = 0; i < batch_size; ++i) {
148 for (
int i = 0; i < batch_size; ++i) {
159 for (
int i = 0; i < batch_size; ++i) {
163 int64_t
id = *
reinterpret_cast<int64_t*
>(data_ptr + 11);
165 data->
result += *
reinterpret_cast<double*
>(data_ptr + 1);
174 for (
int i = 0; i < batch_size; ++i) {
186 for (
int i = 0; i < batch_size; ++i) {
198 for (
int i = 0; i < batch_size; ++i) {
203 int64_t
id = *
reinterpret_cast<int64_t*
>(data_ptr + 11);
205 data->
result += *
reinterpret_cast<double*
>(data_ptr + 1);
211 int main(
int argc,
char **argv) {
224 cout << data.
result << endl;
226 cout << data.
result << endl;
228 cout << data.
result << endl;
230 cout << data.
result << endl;
232 cout << data.
result << endl;
234 cout << data.
result << endl;
236 cout << data.
result << endl;
int AddBenchmark(const std::string &name, BenchmarkFunction fn, void *args, int baseline_idx=0)
void TestSequentialUnpadded(int batch_size, void *d)
static std::string GetMachineInfo()
Output machine/build configuration as a string.
PaddedTupleStruct * padded_data
UnpaddedTupleStruct * unpadded_data
void TestSequentialUnaligned(int batch_size, void *d)
vector< int > rand_access_order
std::string Measure()
Runs all the benchmarks and returns the result in a formatted string.
ImpalaTupleStruct * impala_data
void InitTestData(TestData *data)
void TestSequentialImpala(int batch_size, void *d)
void TestRandomUnaligned(int batch_size, void *d)
void TestRandomImpala(int batch_size, void *d)
static const int UnpaddedSize
void TestRandomPadded(int batch_size, void *d)
int main(int argc, char **argv)
static void Init()
Initialize CpuInfo.
void TestSequentialPadded(int batch_size, void *d)