Merge lp:~mwhudson/libmemcached/misc-memaslap-fixes into lp:libmemcached

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 1108
Proposed branch: lp:~mwhudson/libmemcached/misc-memaslap-fixes
Merge into: lp:libmemcached
Diff against target: 142 lines (+19/-14)
7 files modified
clients/include.am (+4/-0)
clients/memaslap.c (+4/-5)
clients/ms_memslap.h (+3/-3)
clients/ms_setting.c (+1/-1)
clients/ms_stats.c (+5/-2)
clients/ms_task.c (+2/-2)
m4/ax_harden_compiler_flags.m4 (+0/-1)
To merge this branch: bzr merge lp:~mwhudson/libmemcached/misc-memaslap-fixes
Reviewer Review Type Date Requested Status
Tangent Trunk Pending
Review via email: mp+188753@code.launchpad.net

Description of the change

Hi,

I've been using memaslap a bit and ran into an assortment of little problems, all fixed in this branch. Please see the individual commits for details. I can split this up into more single-purpose branches if that would be preferable.

Cheers,
mwh

To post a comment you must log in.
Revision history for this message
Brian Aker (brianaker) wrote :

memaslap was written by some folks who didn't maintain it... and frankly it is so ugly I tend to not to want to either.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Well, I can make another merge proposal that deletes it if that would be better :)

It seemed more capable and informative than memslap.

Revision history for this message
Brian Aker (brianaker) wrote :

BTW I am looking into why this seems to be failing in the build system.

Revision history for this message
Brian Aker (brianaker) wrote :

Why did you comment out -Wunsuffixed-float-constants?

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Brian Aker <email address hidden> writes:

> Why did you comment out -Wunsuffixed-float-constants?

Because putting 'd' after all the floating point constants seemed really
tedious and the syntax is only supported by relatively new versions of
gcc (gcc.gnu.org/bugzilla/show_bug.cgi?id=39027 -- well, 4.5, I guess
that's fairly old now).

FWIW, memaslap contains the only floaing point constants in the entire
codebase, as far as I could tell.

Cheers,
mwh

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'clients/include.am'
--- clients/include.am 2013-06-11 12:31:47 +0000
+++ clients/include.am 2013-10-02 01:01:19 +0000
@@ -94,9 +94,13 @@
94clients_memaslap_SOURCES+= clients/ms_thread.c94clients_memaslap_SOURCES+= clients/ms_thread.c
9595
96clients_memaslap_SOURCES+= clients/generator.cc clients/execute.cc96clients_memaslap_SOURCES+= clients/generator.cc clients/execute.cc
97
98clients_memaslap_CXXFLAGS= @PTHREAD_CFLAGS@
99
97clients_memaslap_LDADD=100clients_memaslap_LDADD=
98clients_memaslap_LDADD+= @LIBEVENT_LIB@101clients_memaslap_LDADD+= @LIBEVENT_LIB@
99clients_memaslap_LDADD+= $(CLIENTS_LDADDS)102clients_memaslap_LDADD+= $(CLIENTS_LDADDS)
103clients_memaslap_LDADD+= @PTHREAD_LIBS@
100104
101clients_memcapable_SOURCES=105clients_memcapable_SOURCES=
102clients_memcapable_SOURCES+= clients/memcapable.cc106clients_memcapable_SOURCES+= clients/memcapable.cc
103107
=== modified file 'clients/memaslap.c'
--- clients/memaslap.c 2013-02-23 10:17:33 +0000
+++ clients/memaslap.c 2013-10-02 01:01:19 +0000
@@ -753,12 +753,12 @@
753753
754 pos+= snprintf(pos,754 pos+= snprintf(pos,
755 sizeof(buf) - (size_t)(pos -buf),755 sizeof(buf) - (size_t)(pos -buf),
756 "written_bytes: %lu\n",756 "written_bytes: %llu\n",
757 (unsigned long) ms_stats.bytes_written);757 (unsigned long long) ms_stats.bytes_written);
758 pos+= snprintf(pos,758 pos+= snprintf(pos,
759 sizeof(buf) - (size_t)(pos -buf),759 sizeof(buf) - (size_t)(pos -buf),
760 "read_bytes: %lu\n",760 "read_bytes: %llu\n",
761 (unsigned long) ms_stats.bytes_read);761 (unsigned long long) ms_stats.bytes_read);
762 pos+= snprintf(pos,762 pos+= snprintf(pos,
763 sizeof(buf) - (size_t)(pos -buf),763 sizeof(buf) - (size_t)(pos -buf),
764 "object_bytes: %lu\n",764 "object_bytes: %lu\n",
@@ -799,7 +799,6 @@
799 ms_stats.bytes_written799 ms_stats.bytes_written
800 + ms_stats.bytes_read) / 1024 / 1024800 + ms_stats.bytes_read) / 1024 / 1024
801 / ((double)time_diff / 1000000));801 / ((double)time_diff / 1000000));
802 assert(pos <= buf);
803802
804 fprintf(stdout, "%s", buf);803 fprintf(stdout, "%s", buf);
805 fflush(stdout);804 fflush(stdout);
806805
=== modified file 'clients/ms_memslap.h'
--- clients/ms_memslap.h 2011-04-28 00:28:00 +0000
+++ clients/ms_memslap.h 2013-10-02 01:01:19 +0000
@@ -72,9 +72,9 @@
72typedef struct stats72typedef struct stats
73{73{
74 volatile uint32_t active_conns; /* active connections */74 volatile uint32_t active_conns; /* active connections */
75 size_t bytes_read; /* read bytes */75 uint64_t bytes_read; /* read bytes */
76 size_t bytes_written; /* written bytes */76 uint64_t bytes_written; /* written bytes */
77 size_t obj_bytes; /* object bytes */77 uint64_t obj_bytes; /* object bytes */
78 size_t pre_cmd_get; /* previous total get command count */78 size_t pre_cmd_get; /* previous total get command count */
79 size_t pre_cmd_set; /* previous total set command count */79 size_t pre_cmd_set; /* previous total set command count */
80 size_t cmd_get; /* current total get command count */80 size_t cmd_get; /* current total get command count */
8181
=== modified file 'clients/ms_setting.c'
--- clients/ms_setting.c 2012-11-19 04:57:41 +0000
+++ clients/ms_setting.c 2013-10-02 01:01:19 +0000
@@ -11,7 +11,7 @@
1111
12#include "mem_config.h"12#include "mem_config.h"
1313
14#include <libmemcached/memcached.h>14#include <libmemcached-1.2/memcached.h>
1515
16#include <ctype.h>16#include <ctype.h>
17#include <inttypes.h>17#include <inttypes.h>
1818
=== modified file 'clients/ms_stats.c'
--- clients/ms_stats.c 2012-11-19 04:57:41 +0000
+++ clients/ms_stats.c 2013-10-02 01:01:19 +0000
@@ -186,6 +186,8 @@
186 }186 }
187 }187 }
188188
189#pragma GCC diagnostic push
190#pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
189 for (int i= min_non_zero; i <= max_non_zero; i++)191 for (int i= min_non_zero; i <= max_non_zero; i++)
190 {192 {
191 if ((i % 4) == 0)193 if ((i % 4) == 0)
@@ -194,6 +196,7 @@
194 }196 }
195 printf(" %6" PRIu64 , stat->dist[i]);197 printf(" %6" PRIu64 , stat->dist[i]);
196 }198 }
199#pragma GCC diagnostic pop
197200
198 printf("\n\n");201 printf("\n\n");
199} /* ms_dump_stats */202} /* ms_dump_stats */
@@ -271,7 +274,7 @@
271 freq,274 freq,
272 (long long)diff_events,275 (long long)diff_events,
273 (long long)period_tps,276 (long long)period_tps,
274 global_rate,277 period_rate,
275 (long long)(stat->get_miss - stat->pre_get_miss),278 (long long)(stat->get_miss - stat->pre_get_miss),
276 (long long)stat->period_min_time,279 (long long)stat->period_min_time,
277 (long long)stat->period_max_time,280 (long long)stat->period_max_time,
@@ -285,7 +288,7 @@
285 run_time,288 run_time,
286 (long long)events,289 (long long)events,
287 (long long)global_tps,290 (long long)global_tps,
288 period_rate,291 global_rate,
289 (long long)stat->get_miss,292 (long long)stat->get_miss,
290 (long long)stat->min_time,293 (long long)stat->min_time,
291 (long long)stat->max_time,294 (long long)stat->max_time,
292295
=== modified file 'clients/ms_task.c'
--- clients/ms_task.c 2012-11-19 04:57:41 +0000
+++ clients/ms_task.c 2013-10-02 01:01:19 +0000
@@ -690,8 +690,8 @@
690 */690 */
691int64_t ms_time_diff(struct timeval *start_time, struct timeval *end_time)691int64_t ms_time_diff(struct timeval *start_time, struct timeval *end_time)
692{692{
693 int64_t endtime= end_time->tv_sec * 1000000 + end_time->tv_usec;693 int64_t endtime= ((int64_t)end_time->tv_sec) * 1000000 + end_time->tv_usec;
694 int64_t starttime= start_time->tv_sec * 1000000 + start_time->tv_usec;694 int64_t starttime= ((int64_t)start_time->tv_sec) * 1000000 + start_time->tv_usec;
695695
696 assert(endtime >= starttime);696 assert(endtime >= starttime);
697697
698698
=== modified file 'm4/ax_harden_compiler_flags.m4'
--- m4/ax_harden_compiler_flags.m4 2013-09-16 06:38:46 +0000
+++ m4/ax_harden_compiler_flags.m4 2013-10-02 01:01:19 +0000
@@ -162,7 +162,6 @@
162 _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail])162 _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail])
163# Anything below this comment please keep sorted.163# Anything below this comment please keep sorted.
164# _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute])164# _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute])
165 _APPEND_COMPILE_FLAGS_ERROR([-Wunsuffixed-float-constants])
166 _APPEND_COMPILE_FLAGS_ERROR([-Wjump-misses-init])165 _APPEND_COMPILE_FLAGS_ERROR([-Wjump-misses-init])
167 _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes])166 _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes])
168 _APPEND_COMPILE_FLAGS_ERROR([-Waddress])167 _APPEND_COMPILE_FLAGS_ERROR([-Waddress])

Subscribers

People subscribed via source and target branches

to all changes: