summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorBrian Aker <brian@tangent.org>2013-01-07 20:03:28 -0500
committerBrian Aker <brian@tangent.org>2013-01-07 20:03:28 -0500
commit17690735658d7b44f91579df91e31da9ae185158 (patch)
tree21230f00697312c8e15f9deca4e8cccef23c4f62 /clients
parent381d409b224ca3b4510e770a98bc960084cdf2c4 (diff)
downloadlibmemcached-17690735658d7b44f91579df91e31da9ae185158.tar.gz
Update yatl.
Diffstat (limited to 'clients')
-rw-r--r--clients/generator.cc6
-rw-r--r--clients/memslap.cc14
2 files changed, 15 insertions, 5 deletions
diff --git a/clients/generator.cc b/clients/generator.cc
index b2ba67ca..df805153 100644
--- a/clients/generator.cc
+++ b/clients/generator.cc
@@ -20,7 +20,7 @@
#include <iostream>
#include <unistd.h>
-#include "generator.h"
+#include "clients/generator.h"
/* Use this for string generation */
static const char ALPHANUMERICS[]=
@@ -33,12 +33,14 @@ static size_t get_alpha_num(void)
return (size_t)random() % ALPHANUMERICS_SIZE;
}
-static void get_random_string(char *buffer, size_t size)
+void get_random_string(char *buffer, size_t size)
{
char *buffer_ptr= buffer;
while (--size)
+ {
*buffer_ptr++= ALPHANUMERICS[get_alpha_num()];
+ }
*buffer_ptr++= ALPHANUMERICS[get_alpha_num()];
}
diff --git a/clients/memslap.cc b/clients/memslap.cc
index 295ea0db..d32b1c04 100644
--- a/clients/memslap.cc
+++ b/clients/memslap.cc
@@ -224,7 +224,15 @@ int main(int argc, char *argv[])
pthread_mutex_init(&sleeper_mutex, NULL);
pthread_cond_init(&sleep_threshhold, NULL);
- scheduler(servers, &conclusion);
+ int error_code= EXIT_SUCCESS;
+ try {
+ scheduler(servers, &conclusion);
+ }
+ catch(std::exception& e)
+ {
+ std::cerr << "Died with exception: " << e.what() << std::endl;
+ error_code= EXIT_FAILURE;
+ }
free(opt_servers);
@@ -233,7 +241,7 @@ int main(int argc, char *argv[])
conclusions_print(&conclusion);
memcached_server_list_free(servers);
- return EXIT_SUCCESS;
+ return error_code;
}
void scheduler(memcached_server_st *servers, conclusions_st *conclusion)
@@ -305,7 +313,7 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion)
pthread_t *threads= new (std::nothrow) pthread_t[opt_concurrency];
- if (not threads)
+ if (threads == NULL)
{
exit(EXIT_FAILURE);
}