Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
lock-benchmark.cc File Reference
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <sstream>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include "util/benchmark.h"
#include "util/cpu-info.h"
#include "util/spinlock.h"
#include "common/names.h"
Include dependency graph for lock-benchmark.cc:

Go to the source code of this file.

Classes

struct  TestData< Decimal >
 

Typedefs

typedef function< void(int64_t,
int64_t *)> 
Fn
 

Functions

void UnlockedConsumeThread (int64_t n, int64_t *value)
 
void UnlockedProduceThread (int64_t n, int64_t *value)
 
void AtomicConsumeThread (int64_t n, int64_t *value)
 
void AtomicProduceThread (int64_t n, int64_t *value)
 
void SpinLockConsumeThread (int64_t n, int64_t *value)
 
void SpinLockProduceThread (int64_t n, int64_t *value)
 
void BoostConsumeThread (int64_t n, int64_t *value)
 
void BoostProduceThread (int64_t n, int64_t *value)
 
void LaunchThreads (void *d, Fn consume_fn, Fn produce_fn, int64_t scale)
 
void TestUnlocked (int batch_size, void *d)
 
void TestAtomic (int batch_size, void *d)
 
void TestSpinLock (int batch_size, void *d)
 
void TestBoost (int batch_size, void *d)
 
int main (int argc, char **argv)
 

Variables

mutex lock_
 
SpinLock spinlock_
 

Typedef Documentation

typedef function<void (int64_t, int64_t*)> Fn

Definition at line 75 of file lock-benchmark.cc.

Function Documentation

void AtomicConsumeThread ( int64_t  n,
int64_t *  value 
)

Definition at line 92 of file lock-benchmark.cc.

Referenced by TestAtomic().

void AtomicProduceThread ( int64_t  n,
int64_t *  value 
)

Definition at line 97 of file lock-benchmark.cc.

Referenced by TestAtomic().

void BoostConsumeThread ( int64_t  n,
int64_t *  value 
)

Definition at line 116 of file lock-benchmark.cc.

References impala::lock_.

Referenced by TestBoost().

void BoostProduceThread ( int64_t  n,
int64_t *  value 
)

Definition at line 122 of file lock-benchmark.cc.

References impala::lock_.

Referenced by TestBoost().

void SpinLockConsumeThread ( int64_t  n,
int64_t *  value 
)

Definition at line 103 of file lock-benchmark.cc.

References spinlock_.

Referenced by TestSpinLock().

void SpinLockProduceThread ( int64_t  n,
int64_t *  value 
)

Definition at line 109 of file lock-benchmark.cc.

References spinlock_.

Referenced by TestSpinLock().

void TestAtomic ( int  batch_size,
void *  d 
)
void TestBoost ( int  batch_size,
void *  d 
)
void TestSpinLock ( int  batch_size,
void *  d 
)
void TestUnlocked ( int  batch_size,
void *  d 
)

Definition at line 149 of file lock-benchmark.cc.

References LaunchThreads(), UnlockedConsumeThread(), and UnlockedProduceThread().

Referenced by main().

void UnlockedConsumeThread ( int64_t  n,
int64_t *  value 
)

Definition at line 77 of file lock-benchmark.cc.

Referenced by TestUnlocked().

void UnlockedProduceThread ( int64_t  n,
int64_t *  value 
)

Definition at line 84 of file lock-benchmark.cc.

Referenced by TestUnlocked().

Variable Documentation

SpinLock spinlock_

Definition at line 73 of file lock-benchmark.cc.

Referenced by SpinLockConsumeThread(), and SpinLockProduceThread().