X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemslap.c;h=0d77fd6e172be763f923752a1dc5b243e348c360;hb=6bc6cf720913ae042f36e62e09abce7d340607ab;hp=aff2de1ba6b95bec7e0a8cafdada969e935e28a3;hpb=542f2c25afc26ad057ee90a771f8f4766f968a35;p=awesomized%2Flibmemcached diff --git a/clients/memslap.c b/clients/memslap.c index aff2de1b..0d77fd6e 100644 --- a/clients/memslap.c +++ b/clients/memslap.c @@ -1,4 +1,42 @@ -#include "libmemcached/common.h" +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include #include #include #include @@ -131,7 +169,6 @@ int main(int argc, char *argv[]) void scheduler(memcached_server_st *servers, conclusions_st *conclusion) { - unsigned int x; unsigned int actual_loaded= 0; /* Fix warning */ memcached_st *memc; @@ -151,8 +188,10 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion) { memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_USE_UDP, (uint64_t)opt_udp_io); - for(x= 0; x < servers[0].count; x++ ) + for (uint32_t x= 0; x < memcached_server_list_count(servers); x++ ) + { servers[x].type= MEMCACHED_CONNECTION_UDP; + } } memcached_server_push(memc, servers); @@ -173,8 +212,10 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion) free(key_lengths); keys= NULL; key_lengths= NULL; - } else { - for (x= 0; x < actual_loaded; ++x) + } + else + { + for (uint32_t x= 0; x < actual_loaded; ++x) { keys[x]= pairs[x].key; key_lengths[x]= pairs[x].key_length; @@ -196,7 +237,7 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion) master_wakeup= 1; pthread_mutex_unlock(&sleeper_mutex); - for (x= 0; x < opt_concurrency; x++) + for (uint32_t x= 0; x < opt_concurrency; x++) { thread_context_st *context; context= (thread_context_st *)calloc(1, sizeof(thread_context_st));