Skip to content

Commit 62c5808

Browse files
authored
Merge pull request #83 from RedisLabs/fix/macos-build
Fix and clean up build on macOS.
2 parents 0fb0a69 + f0430db commit 62c5808

File tree

5 files changed

+35
-25
lines changed

5 files changed

+35
-25
lines changed

README.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ The following libraries are required for building:
2929
The following tools are required
3030
* autoconf
3131
* automake
32+
* pkg-config
3233
* GNU make
3334
* GCC C++ compiler
3435

35-
### CentOS 6.x Prerequisites
36+
#### CentOS 6.x
3637

37-
On a CentOS 6.4 system, use the following to install prerequisites:
38+
On a CentOS 6.x system, use the following to install prerequisites:
3839
```
3940
# yum install autoconf automake make gcc-c++
4041
# yum install pcre-devel zlib-devel libmemcached-devel
@@ -64,33 +65,21 @@ $ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}
6465

6566
Then proceed to follow the build instructions below.
6667

68+
#### Ubuntu/Debian
6769

68-
### Ubuntu 12.x Prerequisites
69-
70-
On recent Ubuntu versions, simply install all prerequisites as follows:
70+
On Ubuntu/Debian distributions, simply install all prerequisites as follows:
7171

7272
```
7373
# apt-get install build-essential autoconf automake libpcre3-dev libevent-dev pkg-config zlib1g-dev
7474
```
7575

76+
#### macOS
7677

77-
### Cluster mode
78-
79-
#### Connections
80-
81-
When using the cluster-mode option, each client opens one connection for each node.
82-
So, when using a large number of threads and clients, the user must verify that he is not
83-
limited by the maximum number of file descriptors.
84-
85-
#### Using sequential key pattern
86-
87-
When there is an asymmetry between the Redis nodes and user set
88-
the --requests option, there may be gaps in the generated keys.
89-
90-
Also, the ratio and the key generator is per client (and not connection).
91-
In this case, setting the ratio to 1:1 does not guarantee 100% hits because
92-
the keys spread to different connections/nodes.
78+
To build natively on macOS, use Homebrew to install the required dependencies::
9379

80+
```
81+
$ brew install autoconf automake libtool libevent pkg-config
82+
```
9483

9584
### Building and installing
9685

@@ -121,5 +110,24 @@ $ memtier_benchmark --help
121110
for command line options.
122111

123112

113+
### Cluster mode
114+
115+
#### Connections
116+
117+
When using the cluster-mode option, each client opens one connection for each node.
118+
So, when using a large number of threads and clients, the user must verify that he is not
119+
limited by the maximum number of file descriptors.
120+
121+
#### Using sequential key pattern
122+
123+
When there is an asymmetry between the Redis nodes and user set
124+
the --requests option, there may be gaps in the generated keys.
125+
126+
Also, the ratio and the key generator is per client (and not connection).
127+
In this case, setting the ratio to 1:1 does not guarantee 100% hits because
128+
the keys spread to different connections/nodes.
129+
130+
131+
124132

125133
[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/c1e8ecf15c469fbeb0e4eb12e8436c82 "githalytics.com")](http://githalytics.com/RedisLabs/memtier_benchmark)

config_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct arbitrary_command {
123123
unsigned int ratio;
124124
};
125125

126-
class arbitrary_command_list {
126+
struct arbitrary_command_list {
127127
private:
128128
std::vector<arbitrary_command> commands_list;
129129

configure.ac

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ AC_FUNC_MALLOC
4545
AC_FUNC_MEMCMP
4646
AC_CHECK_FUNCS([gettimeofday memchr memset socket strerror random_r drand48])
4747

48+
# clock_gettime requires -lrt on old glibc only.
49+
AC_SEARCH_LIBS([clock_gettime], [rt], , AC_MSG_ERROR([rt is required libevent.]))
50+
4851
AC_CHECK_LIB([pcre], [pcre_compile], , AC_MSG_ERROR([pcre is required; try installing libpcre3-dev.]))
4952
AC_CHECK_LIB([z], [deflateInit_], , AC_MSG_ERROR([zlib is required; try installing zlib1g-dev.]))
50-
AC_CHECK_LIB([rt], [clock_gettime], , AC_MSG_ERROR([rt is required for libevent.]))
5153
AC_CHECK_LIB([pthread], [pthread_create], , AC_MSG_ERROR([pthread is required.]))
5254
AC_CHECK_LIB([socket], [gai_strerror])
5355

memtier_benchmark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static void config_init_defaults(struct benchmark_config *cfg)
249249

250250
static int generate_random_seed()
251251
{
252-
int R;
252+
int R = 0;
253253
FILE* f = fopen("/dev/random", "r");
254254
if (f)
255255
{

protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class bulk_el : public mbulk_element {
107107
unsigned int value_len;
108108
};
109109

110-
class protocol_response {
110+
struct protocol_response {
111111
protected:
112112
const char *m_status;
113113
mbulk_size_el *m_mbulk_value;

0 commit comments

Comments
 (0)