couchbase-memcached 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (539) hide show
  1. data.tar.gz.sig +2 -0
  2. data/BENCHMARKS +134 -0
  3. data/CHANGELOG +127 -0
  4. data/LICENSE +184 -0
  5. data/Manifest +535 -0
  6. data/README +118 -0
  7. data/Rakefile +83 -0
  8. data/TODO +4 -0
  9. data/couchbase-memcached.gemspec +33 -0
  10. data/ext/extconf-make.rb +25 -0
  11. data/ext/extconf.rb +91 -0
  12. data/ext/libmemcached-0.50/AUTHORS +11 -0
  13. data/ext/libmemcached-0.50/COPYING +33 -0
  14. data/ext/libmemcached-0.50/ChangeLog +392 -0
  15. data/ext/libmemcached-0.50/Makefile.am +114 -0
  16. data/ext/libmemcached-0.50/Makefile.in +4232 -0
  17. data/ext/libmemcached-0.50/NEWS +1 -0
  18. data/ext/libmemcached-0.50/README +43 -0
  19. data/ext/libmemcached-0.50/README.FIRST +31 -0
  20. data/ext/libmemcached-0.50/README.win32 +25 -0
  21. data/ext/libmemcached-0.50/THANKS +14 -0
  22. data/ext/libmemcached-0.50/TODO +11 -0
  23. data/ext/libmemcached-0.50/aclocal.m4 +1077 -0
  24. data/ext/libmemcached-0.50/clients/client_options.h +45 -0
  25. data/ext/libmemcached-0.50/clients/execute.cc +131 -0
  26. data/ext/libmemcached-0.50/clients/execute.h +30 -0
  27. data/ext/libmemcached-0.50/clients/generator.cc +96 -0
  28. data/ext/libmemcached-0.50/clients/generator.h +36 -0
  29. data/ext/libmemcached-0.50/clients/include.am +116 -0
  30. data/ext/libmemcached-0.50/clients/memaslap.c +908 -0
  31. data/ext/libmemcached-0.50/clients/memcapable.cc +2094 -0
  32. data/ext/libmemcached-0.50/clients/memcat.cc +242 -0
  33. data/ext/libmemcached-0.50/clients/memcp.cc +317 -0
  34. data/ext/libmemcached-0.50/clients/memdump.cc +183 -0
  35. data/ext/libmemcached-0.50/clients/memerror.cc +102 -0
  36. data/ext/libmemcached-0.50/clients/memflush.cc +154 -0
  37. data/ext/libmemcached-0.50/clients/memparse.cc +68 -0
  38. data/ext/libmemcached-0.50/clients/memrm.cc +177 -0
  39. data/ext/libmemcached-0.50/clients/memslap.cc +495 -0
  40. data/ext/libmemcached-0.50/clients/memstat.cc +349 -0
  41. data/ext/libmemcached-0.50/clients/ms_atomic.h +69 -0
  42. data/ext/libmemcached-0.50/clients/ms_conn.c +3413 -0
  43. data/ext/libmemcached-0.50/clients/ms_conn.h +241 -0
  44. data/ext/libmemcached-0.50/clients/ms_memslap.h +132 -0
  45. data/ext/libmemcached-0.50/clients/ms_setting.c +1068 -0
  46. data/ext/libmemcached-0.50/clients/ms_setting.h +181 -0
  47. data/ext/libmemcached-0.50/clients/ms_sigsegv.c +126 -0
  48. data/ext/libmemcached-0.50/clients/ms_sigsegv.h +34 -0
  49. data/ext/libmemcached-0.50/clients/ms_stats.c +307 -0
  50. data/ext/libmemcached-0.50/clients/ms_stats.h +69 -0
  51. data/ext/libmemcached-0.50/clients/ms_task.c +1114 -0
  52. data/ext/libmemcached-0.50/clients/ms_task.h +94 -0
  53. data/ext/libmemcached-0.50/clients/ms_thread.c +351 -0
  54. data/ext/libmemcached-0.50/clients/ms_thread.h +78 -0
  55. data/ext/libmemcached-0.50/clients/utilities.cc +231 -0
  56. data/ext/libmemcached-0.50/clients/utilities.h +64 -0
  57. data/ext/libmemcached-0.50/config.h.in +647 -0
  58. data/ext/libmemcached-0.50/config/autorun.sh +126 -0
  59. data/ext/libmemcached-0.50/config/compile +143 -0
  60. data/ext/libmemcached-0.50/config/config.guess +1517 -0
  61. data/ext/libmemcached-0.50/config/config.rpath +666 -0
  62. data/ext/libmemcached-0.50/config/config.sub +1760 -0
  63. data/ext/libmemcached-0.50/config/depcomp +630 -0
  64. data/ext/libmemcached-0.50/config/install-sh +520 -0
  65. data/ext/libmemcached-0.50/config/ltmain.sh +9642 -0
  66. data/ext/libmemcached-0.50/config/missing +376 -0
  67. data/ext/libmemcached-0.50/config/pandora-plugin +752 -0
  68. data/ext/libmemcached-0.50/config/uncrustify.cfg +1112 -0
  69. data/ext/libmemcached-0.50/configure +27103 -0
  70. data/ext/libmemcached-0.50/configure.ac +186 -0
  71. data/ext/libmemcached-0.50/docs/conf.py.in +354 -0
  72. data/ext/libmemcached-0.50/docs/include.am +240 -0
  73. data/ext/libmemcached-0.50/docs/man/hashkit_clone.3 +88 -0
  74. data/ext/libmemcached-0.50/docs/man/hashkit_crc32.3 +105 -0
  75. data/ext/libmemcached-0.50/docs/man/hashkit_create.3 +88 -0
  76. data/ext/libmemcached-0.50/docs/man/hashkit_fnv1_32.3 +105 -0
  77. data/ext/libmemcached-0.50/docs/man/hashkit_fnv1_64.3 +105 -0
  78. data/ext/libmemcached-0.50/docs/man/hashkit_fnv1a_32.3 +105 -0
  79. data/ext/libmemcached-0.50/docs/man/hashkit_fnv1a_64.3 +105 -0
  80. data/ext/libmemcached-0.50/docs/man/hashkit_free.3 +88 -0
  81. data/ext/libmemcached-0.50/docs/man/hashkit_functions.3 +105 -0
  82. data/ext/libmemcached-0.50/docs/man/hashkit_hsieh.3 +105 -0
  83. data/ext/libmemcached-0.50/docs/man/hashkit_is_allocated.3 +88 -0
  84. data/ext/libmemcached-0.50/docs/man/hashkit_jenkins.3 +105 -0
  85. data/ext/libmemcached-0.50/docs/man/hashkit_md5.3 +105 -0
  86. data/ext/libmemcached-0.50/docs/man/hashkit_murmur.3 +105 -0
  87. data/ext/libmemcached-0.50/docs/man/hashkit_value.3 +66 -0
  88. data/ext/libmemcached-0.50/docs/man/libhashkit.3 +57 -0
  89. data/ext/libmemcached-0.50/docs/man/libmemcached.3 +208 -0
  90. data/ext/libmemcached-0.50/docs/man/libmemcached_check_configuration.3 +293 -0
  91. data/ext/libmemcached-0.50/docs/man/libmemcached_configuration.3 +293 -0
  92. data/ext/libmemcached-0.50/docs/man/libmemcached_examples.3 +144 -0
  93. data/ext/libmemcached-0.50/docs/man/libmemcachedutil.3 +68 -0
  94. data/ext/libmemcached-0.50/docs/man/memaslap.1 +1222 -0
  95. data/ext/libmemcached-0.50/docs/man/memcached.3 +293 -0
  96. data/ext/libmemcached-0.50/docs/man/memcached_add.3 +132 -0
  97. data/ext/libmemcached-0.50/docs/man/memcached_add_by_key.3 +132 -0
  98. data/ext/libmemcached-0.50/docs/man/memcached_analyze.3 +77 -0
  99. data/ext/libmemcached-0.50/docs/man/memcached_append.3 +111 -0
  100. data/ext/libmemcached-0.50/docs/man/memcached_append_by_key.3 +111 -0
  101. data/ext/libmemcached-0.50/docs/man/memcached_behavior_get.3 +333 -0
  102. data/ext/libmemcached-0.50/docs/man/memcached_behavior_set.3 +333 -0
  103. data/ext/libmemcached-0.50/docs/man/memcached_callback_get.3 +159 -0
  104. data/ext/libmemcached-0.50/docs/man/memcached_callback_set.3 +159 -0
  105. data/ext/libmemcached-0.50/docs/man/memcached_cas.3 +91 -0
  106. data/ext/libmemcached-0.50/docs/man/memcached_cas_by_key.3 +91 -0
  107. data/ext/libmemcached-0.50/docs/man/memcached_clone.3 +99 -0
  108. data/ext/libmemcached-0.50/docs/man/memcached_create.3 +99 -0
  109. data/ext/libmemcached-0.50/docs/man/memcached_decrement.3 +124 -0
  110. data/ext/libmemcached-0.50/docs/man/memcached_decrement_with_initial.3 +124 -0
  111. data/ext/libmemcached-0.50/docs/man/memcached_delete.3 +83 -0
  112. data/ext/libmemcached-0.50/docs/man/memcached_delete_by_key.3 +83 -0
  113. data/ext/libmemcached-0.50/docs/man/memcached_destroy_sasl_auth_data.3 +95 -0
  114. data/ext/libmemcached-0.50/docs/man/memcached_dump.3 +77 -0
  115. data/ext/libmemcached-0.50/docs/man/memcached_fetch.3 +174 -0
  116. data/ext/libmemcached-0.50/docs/man/memcached_fetch_execute.3 +174 -0
  117. data/ext/libmemcached-0.50/docs/man/memcached_fetch_result.3 +174 -0
  118. data/ext/libmemcached-0.50/docs/man/memcached_flush_buffers.3 +72 -0
  119. data/ext/libmemcached-0.50/docs/man/memcached_free.3 +99 -0
  120. data/ext/libmemcached-0.50/docs/man/memcached_generate_hash.3 +85 -0
  121. data/ext/libmemcached-0.50/docs/man/memcached_generate_hash_value.3 +85 -0
  122. data/ext/libmemcached-0.50/docs/man/memcached_get.3 +174 -0
  123. data/ext/libmemcached-0.50/docs/man/memcached_get_by_key.3 +174 -0
  124. data/ext/libmemcached-0.50/docs/man/memcached_get_memory_allocators.3 +111 -0
  125. data/ext/libmemcached-0.50/docs/man/memcached_get_sasl_callbacks.3 +95 -0
  126. data/ext/libmemcached-0.50/docs/man/memcached_get_user_data.3 +79 -0
  127. data/ext/libmemcached-0.50/docs/man/memcached_increment.3 +124 -0
  128. data/ext/libmemcached-0.50/docs/man/memcached_increment_with_initial.3 +124 -0
  129. data/ext/libmemcached-0.50/docs/man/memcached_lib_version.3 +76 -0
  130. data/ext/libmemcached-0.50/docs/man/memcached_mget.3 +174 -0
  131. data/ext/libmemcached-0.50/docs/man/memcached_mget_by_key.3 +174 -0
  132. data/ext/libmemcached-0.50/docs/man/memcached_mget_execute.3 +174 -0
  133. data/ext/libmemcached-0.50/docs/man/memcached_mget_execute_by_key.3 +174 -0
  134. data/ext/libmemcached-0.50/docs/man/memcached_pool_behavior_get.3 +139 -0
  135. data/ext/libmemcached-0.50/docs/man/memcached_pool_behavior_set.3 +139 -0
  136. data/ext/libmemcached-0.50/docs/man/memcached_pool_create.3 +139 -0
  137. data/ext/libmemcached-0.50/docs/man/memcached_pool_destroy.3 +139 -0
  138. data/ext/libmemcached-0.50/docs/man/memcached_pool_pop.3 +139 -0
  139. data/ext/libmemcached-0.50/docs/man/memcached_pool_push.3 +139 -0
  140. data/ext/libmemcached-0.50/docs/man/memcached_pool_st.3 +139 -0
  141. data/ext/libmemcached-0.50/docs/man/memcached_prepend.3 +111 -0
  142. data/ext/libmemcached-0.50/docs/man/memcached_prepend_by_key.3 +111 -0
  143. data/ext/libmemcached-0.50/docs/man/memcached_quit.3 +74 -0
  144. data/ext/libmemcached-0.50/docs/man/memcached_replace.3 +132 -0
  145. data/ext/libmemcached-0.50/docs/man/memcached_replace_by_key.3 +132 -0
  146. data/ext/libmemcached-0.50/docs/man/memcached_sasl_set_auth_data.3 +95 -0
  147. data/ext/libmemcached-0.50/docs/man/memcached_server_add.3 +141 -0
  148. data/ext/libmemcached-0.50/docs/man/memcached_server_count.3 +141 -0
  149. data/ext/libmemcached-0.50/docs/man/memcached_server_cursor.3 +141 -0
  150. data/ext/libmemcached-0.50/docs/man/memcached_server_list.3 +141 -0
  151. data/ext/libmemcached-0.50/docs/man/memcached_server_list_append.3 +111 -0
  152. data/ext/libmemcached-0.50/docs/man/memcached_server_list_count.3 +111 -0
  153. data/ext/libmemcached-0.50/docs/man/memcached_server_list_free.3 +111 -0
  154. data/ext/libmemcached-0.50/docs/man/memcached_server_push.3 +141 -0
  155. data/ext/libmemcached-0.50/docs/man/memcached_servers_parse.3 +111 -0
  156. data/ext/libmemcached-0.50/docs/man/memcached_set.3 +132 -0
  157. data/ext/libmemcached-0.50/docs/man/memcached_set_by_key.3 +132 -0
  158. data/ext/libmemcached-0.50/docs/man/memcached_set_memory_allocators.3 +111 -0
  159. data/ext/libmemcached-0.50/docs/man/memcached_set_sasl_callbacks.3 +95 -0
  160. data/ext/libmemcached-0.50/docs/man/memcached_set_user_data.3 +79 -0
  161. data/ext/libmemcached-0.50/docs/man/memcached_stat.3 +116 -0
  162. data/ext/libmemcached-0.50/docs/man/memcached_stat_execute.3 +116 -0
  163. data/ext/libmemcached-0.50/docs/man/memcached_stat_get_keys.3 +116 -0
  164. data/ext/libmemcached-0.50/docs/man/memcached_stat_get_value.3 +116 -0
  165. data/ext/libmemcached-0.50/docs/man/memcached_stat_servername.3 +116 -0
  166. data/ext/libmemcached-0.50/docs/man/memcached_strerror.3 +69 -0
  167. data/ext/libmemcached-0.50/docs/man/memcached_verbosity.3 +66 -0
  168. data/ext/libmemcached-0.50/docs/man/memcached_version.3 +76 -0
  169. data/ext/libmemcached-0.50/docs/man/memcapable.1 +92 -0
  170. data/ext/libmemcached-0.50/docs/man/memcat.1 +71 -0
  171. data/ext/libmemcached-0.50/docs/man/memcp.1 +77 -0
  172. data/ext/libmemcached-0.50/docs/man/memdump.1 +66 -0
  173. data/ext/libmemcached-0.50/docs/man/memerror.1 +65 -0
  174. data/ext/libmemcached-0.50/docs/man/memflush.1 +73 -0
  175. data/ext/libmemcached-0.50/docs/man/memrm.1 +72 -0
  176. data/ext/libmemcached-0.50/docs/man/memslap.1 +59 -0
  177. data/ext/libmemcached-0.50/docs/man/memstat.1 +70 -0
  178. data/ext/libmemcached-0.50/example/include.am +24 -0
  179. data/ext/libmemcached-0.50/example/interface_v0.c +594 -0
  180. data/ext/libmemcached-0.50/example/interface_v1.c +411 -0
  181. data/ext/libmemcached-0.50/example/memcached_light.c +474 -0
  182. data/ext/libmemcached-0.50/example/memcached_light.h +7 -0
  183. data/ext/libmemcached-0.50/example/storage.c +172 -0
  184. data/ext/libmemcached-0.50/example/storage.h +27 -0
  185. data/ext/libmemcached-0.50/example/storage_innodb.c +535 -0
  186. data/ext/libmemcached-0.50/libhashkit/algorithm.cc +69 -0
  187. data/ext/libmemcached-0.50/libhashkit/algorithm.h +96 -0
  188. data/ext/libmemcached-0.50/libhashkit/behavior.cc +9 -0
  189. data/ext/libmemcached-0.50/libhashkit/behavior.h +26 -0
  190. data/ext/libmemcached-0.50/libhashkit/common.h +33 -0
  191. data/ext/libmemcached-0.50/libhashkit/configure.h.in +19 -0
  192. data/ext/libmemcached-0.50/libhashkit/crc32.cc +86 -0
  193. data/ext/libmemcached-0.50/libhashkit/digest.cc +62 -0
  194. data/ext/libmemcached-0.50/libhashkit/digest.h +30 -0
  195. data/ext/libmemcached-0.50/libhashkit/fnv.cc +75 -0
  196. data/ext/libmemcached-0.50/libhashkit/function.cc +156 -0
  197. data/ext/libmemcached-0.50/libhashkit/function.h +44 -0
  198. data/ext/libmemcached-0.50/libhashkit/hashkit.cc +100 -0
  199. data/ext/libmemcached-0.50/libhashkit/hashkit.h +95 -0
  200. data/ext/libmemcached-0.50/libhashkit/hashkit.hpp +97 -0
  201. data/ext/libmemcached-0.50/libhashkit/hsieh.cc +70 -0
  202. data/ext/libmemcached-0.50/libhashkit/include.am +69 -0
  203. data/ext/libmemcached-0.50/libhashkit/jenkins.cc +214 -0
  204. data/ext/libmemcached-0.50/libhashkit/ketama.cc +164 -0
  205. data/ext/libmemcached-0.50/libhashkit/md5.cc +367 -0
  206. data/ext/libmemcached-0.50/libhashkit/murmur.cc +77 -0
  207. data/ext/libmemcached-0.50/libhashkit/one_at_a_time.cc +34 -0
  208. data/ext/libmemcached-0.50/libhashkit/str_algorithm.cc +58 -0
  209. data/ext/libmemcached-0.50/libhashkit/str_algorithm.h +48 -0
  210. data/ext/libmemcached-0.50/libhashkit/strerror.cc +25 -0
  211. data/ext/libmemcached-0.50/libhashkit/strerror.h +23 -0
  212. data/ext/libmemcached-0.50/libhashkit/types.h +90 -0
  213. data/ext/libmemcached-0.50/libhashkit/visibility.h +48 -0
  214. data/ext/libmemcached-0.50/libmemcached/allocators.cc +119 -0
  215. data/ext/libmemcached-0.50/libmemcached/allocators.h +87 -0
  216. data/ext/libmemcached-0.50/libmemcached/analyze.cc +110 -0
  217. data/ext/libmemcached-0.50/libmemcached/analyze.h +66 -0
  218. data/ext/libmemcached-0.50/libmemcached/array.c +128 -0
  219. data/ext/libmemcached-0.50/libmemcached/array.h +75 -0
  220. data/ext/libmemcached-0.50/libmemcached/auto.cc +383 -0
  221. data/ext/libmemcached-0.50/libmemcached/auto.h +111 -0
  222. data/ext/libmemcached-0.50/libmemcached/basic_string.h +55 -0
  223. data/ext/libmemcached-0.50/libmemcached/behavior.cc +590 -0
  224. data/ext/libmemcached-0.50/libmemcached/behavior.h +86 -0
  225. data/ext/libmemcached-0.50/libmemcached/byteorder.cc +90 -0
  226. data/ext/libmemcached-0.50/libmemcached/byteorder.h +52 -0
  227. data/ext/libmemcached-0.50/libmemcached/callback.cc +160 -0
  228. data/ext/libmemcached-0.50/libmemcached/callback.h +61 -0
  229. data/ext/libmemcached-0.50/libmemcached/common.h +182 -0
  230. data/ext/libmemcached-0.50/libmemcached/configure.h.in +52 -0
  231. data/ext/libmemcached-0.50/libmemcached/connect.cc +626 -0
  232. data/ext/libmemcached-0.50/libmemcached/constants.h +167 -0
  233. data/ext/libmemcached-0.50/libmemcached/delete.cc +266 -0
  234. data/ext/libmemcached-0.50/libmemcached/delete.h +57 -0
  235. data/ext/libmemcached-0.50/libmemcached/do.cc +100 -0
  236. data/ext/libmemcached-0.50/libmemcached/do.hpp +49 -0
  237. data/ext/libmemcached-0.50/libmemcached/dump.cc +107 -0
  238. data/ext/libmemcached-0.50/libmemcached/dump.h +51 -0
  239. data/ext/libmemcached-0.50/libmemcached/error.cc +419 -0
  240. data/ext/libmemcached-0.50/libmemcached/error.h +61 -0
  241. data/ext/libmemcached-0.50/libmemcached/error.hpp +87 -0
  242. data/ext/libmemcached-0.50/libmemcached/exception.hpp +63 -0
  243. data/ext/libmemcached-0.50/libmemcached/fetch.cc +267 -0
  244. data/ext/libmemcached-0.50/libmemcached/fetch.h +53 -0
  245. data/ext/libmemcached-0.50/libmemcached/flush.cc +149 -0
  246. data/ext/libmemcached-0.50/libmemcached/flush.h +49 -0
  247. data/ext/libmemcached-0.50/libmemcached/flush_buffers.cc +66 -0
  248. data/ext/libmemcached-0.50/libmemcached/flush_buffers.h +49 -0
  249. data/ext/libmemcached-0.50/libmemcached/get.cc +842 -0
  250. data/ext/libmemcached-0.50/libmemcached/get.h +135 -0
  251. data/ext/libmemcached-0.50/libmemcached/hash.cc +178 -0
  252. data/ext/libmemcached-0.50/libmemcached/hash.h +68 -0
  253. data/ext/libmemcached-0.50/libmemcached/hosts.cc +516 -0
  254. data/ext/libmemcached-0.50/libmemcached/include.am +183 -0
  255. data/ext/libmemcached-0.50/libmemcached/initialize_query.cc +70 -0
  256. data/ext/libmemcached-0.50/libmemcached/initialize_query.h +51 -0
  257. data/ext/libmemcached-0.50/libmemcached/internal.h +46 -0
  258. data/ext/libmemcached-0.50/libmemcached/io.cc +920 -0
  259. data/ext/libmemcached-0.50/libmemcached/io.h +119 -0
  260. data/ext/libmemcached-0.50/libmemcached/is.h +48 -0
  261. data/ext/libmemcached-0.50/libmemcached/key.cc +23 -0
  262. data/ext/libmemcached-0.50/libmemcached/libmemcached_probes.d +30 -0
  263. data/ext/libmemcached-0.50/libmemcached/libmemcached_probes.h +118 -0
  264. data/ext/libmemcached-0.50/libmemcached/memcached.cc +437 -0
  265. data/ext/libmemcached-0.50/libmemcached/memcached.h +214 -0
  266. data/ext/libmemcached-0.50/libmemcached/memcached.hpp +799 -0
  267. data/ext/libmemcached-0.50/libmemcached/memcached/README.txt +7 -0
  268. data/ext/libmemcached-0.50/libmemcached/memcached/protocol_binary.h +726 -0
  269. data/ext/libmemcached-0.50/libmemcached/memcached/vbucket.h +26 -0
  270. data/ext/libmemcached-0.50/libmemcached/memcached_util.h +44 -0
  271. data/ext/libmemcached-0.50/libmemcached/memory.h +79 -0
  272. data/ext/libmemcached-0.50/libmemcached/options.cc +178 -0
  273. data/ext/libmemcached-0.50/libmemcached/options.h +49 -0
  274. data/ext/libmemcached-0.50/libmemcached/options.hpp +56 -0
  275. data/ext/libmemcached-0.50/libmemcached/options/context.h +151 -0
  276. data/ext/libmemcached-0.50/libmemcached/options/include.am +19 -0
  277. data/ext/libmemcached-0.50/libmemcached/options/parser.am +0 -0
  278. data/ext/libmemcached-0.50/libmemcached/options/parser.cc +2324 -0
  279. data/ext/libmemcached-0.50/libmemcached/options/parser.h +122 -0
  280. data/ext/libmemcached-0.50/libmemcached/options/scanner.cc +3203 -0
  281. data/ext/libmemcached-0.50/libmemcached/options/scanner.h +479 -0
  282. data/ext/libmemcached-0.50/libmemcached/options/server.h +60 -0
  283. data/ext/libmemcached-0.50/libmemcached/options/symbol.h +57 -0
  284. data/ext/libmemcached-0.50/libmemcached/parse.cc +110 -0
  285. data/ext/libmemcached-0.50/libmemcached/parse.h +23 -0
  286. data/ext/libmemcached-0.50/libmemcached/platform.h +56 -0
  287. data/ext/libmemcached-0.50/libmemcached/prefix_key.cc +65 -0
  288. data/ext/libmemcached-0.50/libmemcached/prefix_key.h +49 -0
  289. data/ext/libmemcached-0.50/libmemcached/protocol/ascii_handler.c +963 -0
  290. data/ext/libmemcached-0.50/libmemcached/protocol/ascii_handler.h +40 -0
  291. data/ext/libmemcached-0.50/libmemcached/protocol/binary_handler.c +1121 -0
  292. data/ext/libmemcached-0.50/libmemcached/protocol/binary_handler.h +47 -0
  293. data/ext/libmemcached-0.50/libmemcached/protocol/cache.c +149 -0
  294. data/ext/libmemcached-0.50/libmemcached/protocol/cache.h +116 -0
  295. data/ext/libmemcached-0.50/libmemcached/protocol/callback.h +418 -0
  296. data/ext/libmemcached-0.50/libmemcached/protocol/common.h +163 -0
  297. data/ext/libmemcached-0.50/libmemcached/protocol/include.am +26 -0
  298. data/ext/libmemcached-0.50/libmemcached/protocol/pedantic.c +202 -0
  299. data/ext/libmemcached-0.50/libmemcached/protocol/protocol_handler.c +365 -0
  300. data/ext/libmemcached-0.50/libmemcached/protocol_handler.h +215 -0
  301. data/ext/libmemcached-0.50/libmemcached/purge.cc +90 -0
  302. data/ext/libmemcached-0.50/libmemcached/quit.cc +139 -0
  303. data/ext/libmemcached-0.50/libmemcached/quit.h +55 -0
  304. data/ext/libmemcached-0.50/libmemcached/response.cc +619 -0
  305. data/ext/libmemcached-0.50/libmemcached/response.h +57 -0
  306. data/ext/libmemcached-0.50/libmemcached/result.cc +173 -0
  307. data/ext/libmemcached-0.50/libmemcached/result.h +100 -0
  308. data/ext/libmemcached-0.50/libmemcached/return.h +98 -0
  309. data/ext/libmemcached-0.50/libmemcached/sasl.c +408 -0
  310. data/ext/libmemcached-0.50/libmemcached/sasl.h +86 -0
  311. data/ext/libmemcached-0.50/libmemcached/server.cc +351 -0
  312. data/ext/libmemcached-0.50/libmemcached/server.h +169 -0
  313. data/ext/libmemcached-0.50/libmemcached/server_list.cc +88 -0
  314. data/ext/libmemcached-0.50/libmemcached/server_list.h +77 -0
  315. data/ext/libmemcached-0.50/libmemcached/stats.cc +623 -0
  316. data/ext/libmemcached-0.50/libmemcached/stats.h +96 -0
  317. data/ext/libmemcached-0.50/libmemcached/storage.cc +567 -0
  318. data/ext/libmemcached-0.50/libmemcached/storage.h +133 -0
  319. data/ext/libmemcached-0.50/libmemcached/strerror.cc +189 -0
  320. data/ext/libmemcached-0.50/libmemcached/strerror.h +50 -0
  321. data/ext/libmemcached-0.50/libmemcached/string.cc +253 -0
  322. data/ext/libmemcached-0.50/libmemcached/string.h +121 -0
  323. data/ext/libmemcached-0.50/libmemcached/touch.cc +106 -0
  324. data/ext/libmemcached-0.50/libmemcached/touch.h +59 -0
  325. data/ext/libmemcached-0.50/libmemcached/types.h +117 -0
  326. data/ext/libmemcached-0.50/libmemcached/util.h +40 -0
  327. data/ext/libmemcached-0.50/libmemcached/util/flush.cc +61 -0
  328. data/ext/libmemcached-0.50/libmemcached/util/flush.h +50 -0
  329. data/ext/libmemcached-0.50/libmemcached/util/include.am +34 -0
  330. data/ext/libmemcached-0.50/libmemcached/util/ping.cc +62 -0
  331. data/ext/libmemcached-0.50/libmemcached/util/ping.h +49 -0
  332. data/ext/libmemcached-0.50/libmemcached/util/pool.cc +392 -0
  333. data/ext/libmemcached-0.50/libmemcached/util/pool.h +78 -0
  334. data/ext/libmemcached-0.50/libmemcached/util/version.cc +87 -0
  335. data/ext/libmemcached-0.50/libmemcached/util/version.h +53 -0
  336. data/ext/libmemcached-0.50/libmemcached/verbosity.cc +97 -0
  337. data/ext/libmemcached-0.50/libmemcached/verbosity.h +50 -0
  338. data/ext/libmemcached-0.50/libmemcached/version.cc +214 -0
  339. data/ext/libmemcached-0.50/libmemcached/version.h +52 -0
  340. data/ext/libmemcached-0.50/libmemcached/virtual_bucket.c +118 -0
  341. data/ext/libmemcached-0.50/libmemcached/virtual_bucket.h +59 -0
  342. data/ext/libmemcached-0.50/libmemcached/visibility.h +51 -0
  343. data/ext/libmemcached-0.50/libmemcached/watchpoint.h +110 -0
  344. data/ext/libmemcached-0.50/libtest/callbacks.h +21 -0
  345. data/ext/libmemcached-0.50/libtest/collection.h +19 -0
  346. data/ext/libmemcached-0.50/libtest/common.h +50 -0
  347. data/ext/libmemcached-0.50/libtest/core.h +11 -0
  348. data/ext/libmemcached-0.50/libtest/error.h +18 -0
  349. data/ext/libmemcached-0.50/libtest/failed.h +52 -0
  350. data/ext/libmemcached-0.50/libtest/framework.cc +57 -0
  351. data/ext/libmemcached-0.50/libtest/framework.h +137 -0
  352. data/ext/libmemcached-0.50/libtest/get.h +22 -0
  353. data/ext/libmemcached-0.50/libtest/include.am +52 -0
  354. data/ext/libmemcached-0.50/libtest/runner.h +19 -0
  355. data/ext/libmemcached-0.50/libtest/server.c +355 -0
  356. data/ext/libmemcached-0.50/libtest/server.h +43 -0
  357. data/ext/libmemcached-0.50/libtest/stats.h +30 -0
  358. data/ext/libmemcached-0.50/libtest/strerror.h +14 -0
  359. data/ext/libmemcached-0.50/libtest/test.cc +319 -0
  360. data/ext/libmemcached-0.50/libtest/test.h +162 -0
  361. data/ext/libmemcached-0.50/libtest/test.hpp +46 -0
  362. data/ext/libmemcached-0.50/libtest/visibility.h +69 -0
  363. data/ext/libmemcached-0.50/m4/ac_cxx_header_stdcxx_98.m4 +83 -0
  364. data/ext/libmemcached-0.50/m4/acx_pthread.m4 +271 -0
  365. data/ext/libmemcached-0.50/m4/byteorder.m4 +19 -0
  366. data/ext/libmemcached-0.50/m4/deprecated.m4 +17 -0
  367. data/ext/libmemcached-0.50/m4/eagain.m4 +28 -0
  368. data/ext/libmemcached-0.50/m4/enable_utillib.m4 +16 -0
  369. data/ext/libmemcached-0.50/m4/gettext.m4 +379 -0
  370. data/ext/libmemcached-0.50/m4/hsieh.m4 +18 -0
  371. data/ext/libmemcached-0.50/m4/iconv.m4 +214 -0
  372. data/ext/libmemcached-0.50/m4/lib-ld.m4 +110 -0
  373. data/ext/libmemcached-0.50/m4/lib-link.m4 +767 -0
  374. data/ext/libmemcached-0.50/m4/lib-prefix.m4 +221 -0
  375. data/ext/libmemcached-0.50/m4/libtool.m4 +7851 -0
  376. data/ext/libmemcached-0.50/m4/ltoptions.m4 +369 -0
  377. data/ext/libmemcached-0.50/m4/ltsugar.m4 +123 -0
  378. data/ext/libmemcached-0.50/m4/ltversion.m4 +23 -0
  379. data/ext/libmemcached-0.50/m4/lt~obsolete.m4 +98 -0
  380. data/ext/libmemcached-0.50/m4/memaslap.m4 +9 -0
  381. data/ext/libmemcached-0.50/m4/memcached.m4 +31 -0
  382. data/ext/libmemcached-0.50/m4/murmur.m4 +18 -0
  383. data/ext/libmemcached-0.50/m4/pandora_64bit.m4 +60 -0
  384. data/ext/libmemcached-0.50/m4/pandora_bison.m4 +33 -0
  385. data/ext/libmemcached-0.50/m4/pandora_canonical.m4 +418 -0
  386. data/ext/libmemcached-0.50/m4/pandora_check_compiler_version.m4 +37 -0
  387. data/ext/libmemcached-0.50/m4/pandora_check_cxx_standard.m4 +23 -0
  388. data/ext/libmemcached-0.50/m4/pandora_cinttypes.m4 +39 -0
  389. data/ext/libmemcached-0.50/m4/pandora_clock_gettime.m4 +15 -0
  390. data/ext/libmemcached-0.50/m4/pandora_compile_stdcxx_0x.m4 +103 -0
  391. data/ext/libmemcached-0.50/m4/pandora_cstdint.m4 +38 -0
  392. data/ext/libmemcached-0.50/m4/pandora_cxx_demangle.m4 +27 -0
  393. data/ext/libmemcached-0.50/m4/pandora_enable_dtrace.m4 +60 -0
  394. data/ext/libmemcached-0.50/m4/pandora_ensure_gcc_version.m4 +62 -0
  395. data/ext/libmemcached-0.50/m4/pandora_extensions.m4 +16 -0
  396. data/ext/libmemcached-0.50/m4/pandora_fdatasync.m4 +25 -0
  397. data/ext/libmemcached-0.50/m4/pandora_flex.m4 +33 -0
  398. data/ext/libmemcached-0.50/m4/pandora_have_better_malloc.m4 +66 -0
  399. data/ext/libmemcached-0.50/m4/pandora_have_boost.m4 +93 -0
  400. data/ext/libmemcached-0.50/m4/pandora_have_gcc_atomics.m4 +37 -0
  401. data/ext/libmemcached-0.50/m4/pandora_have_innodb.m4 +41 -0
  402. data/ext/libmemcached-0.50/m4/pandora_have_libaio.m4 +56 -0
  403. data/ext/libmemcached-0.50/m4/pandora_have_libavahi.m4 +41 -0
  404. data/ext/libmemcached-0.50/m4/pandora_have_libbdb.m4 +40 -0
  405. data/ext/libmemcached-0.50/m4/pandora_have_libboost_date_time.m4 +46 -0
  406. data/ext/libmemcached-0.50/m4/pandora_have_libboost_filesystem.m4 +47 -0
  407. data/ext/libmemcached-0.50/m4/pandora_have_libboost_iostreams.m4 +49 -0
  408. data/ext/libmemcached-0.50/m4/pandora_have_libboost_options.m4 +47 -0
  409. data/ext/libmemcached-0.50/m4/pandora_have_libboost_regex.m4 +54 -0
  410. data/ext/libmemcached-0.50/m4/pandora_have_libboost_test.m4 +45 -0
  411. data/ext/libmemcached-0.50/m4/pandora_have_libboost_thread.m4 +54 -0
  412. data/ext/libmemcached-0.50/m4/pandora_have_libcassandra.m4 +44 -0
  413. data/ext/libmemcached-0.50/m4/pandora_have_libcurl.m4 +62 -0
  414. data/ext/libmemcached-0.50/m4/pandora_have_libdl.m4 +51 -0
  415. data/ext/libmemcached-0.50/m4/pandora_have_libdrizzle.m4 +61 -0
  416. data/ext/libmemcached-0.50/m4/pandora_have_libevent.m4 +66 -0
  417. data/ext/libmemcached-0.50/m4/pandora_have_libgearman.m4 +41 -0
  418. data/ext/libmemcached-0.50/m4/pandora_have_libgtest.m4 +47 -0
  419. data/ext/libmemcached-0.50/m4/pandora_have_libhaildb.m4 +43 -0
  420. data/ext/libmemcached-0.50/m4/pandora_have_libhashkit.m4 +42 -0
  421. data/ext/libmemcached-0.50/m4/pandora_have_libinnodb.m4 +64 -0
  422. data/ext/libmemcached-0.50/m4/pandora_have_libldap.m4 +73 -0
  423. data/ext/libmemcached-0.50/m4/pandora_have_libmemcached.m4 +106 -0
  424. data/ext/libmemcached-0.50/m4/pandora_have_libmysqlclient.m4 +146 -0
  425. data/ext/libmemcached-0.50/m4/pandora_have_libndbclient.m4 +80 -0
  426. data/ext/libmemcached-0.50/m4/pandora_have_libpcre.m4 +73 -0
  427. data/ext/libmemcached-0.50/m4/pandora_have_libpq.m4 +46 -0
  428. data/ext/libmemcached-0.50/m4/pandora_have_libpqxx.m4 +44 -0
  429. data/ext/libmemcached-0.50/m4/pandora_have_libsqlite3.m4 +42 -0
  430. data/ext/libmemcached-0.50/m4/pandora_have_libtokyocabinet.m4 +54 -0
  431. data/ext/libmemcached-0.50/m4/pandora_have_libuuid.m4 +55 -0
  432. data/ext/libmemcached-0.50/m4/pandora_have_libvbucket.m4 +40 -0
  433. data/ext/libmemcached-0.50/m4/pandora_have_libxml2.m4 +52 -0
  434. data/ext/libmemcached-0.50/m4/pandora_have_libz.m4 +51 -0
  435. data/ext/libmemcached-0.50/m4/pandora_have_protobuf.m4 +82 -0
  436. data/ext/libmemcached-0.50/m4/pandora_have_sasl.m4 +133 -0
  437. data/ext/libmemcached-0.50/m4/pandora_have_thrift.m4 +45 -0
  438. data/ext/libmemcached-0.50/m4/pandora_header_assert.m4 +23 -0
  439. data/ext/libmemcached-0.50/m4/pandora_header_stdcxx_98.m4 +83 -0
  440. data/ext/libmemcached-0.50/m4/pandora_intltool.m4 +225 -0
  441. data/ext/libmemcached-0.50/m4/pandora_libtool.m4 +25 -0
  442. data/ext/libmemcached-0.50/m4/pandora_optimize.m4 +75 -0
  443. data/ext/libmemcached-0.50/m4/pandora_platform.m4 +117 -0
  444. data/ext/libmemcached-0.50/m4/pandora_plugins.m4 +62 -0
  445. data/ext/libmemcached-0.50/m4/pandora_print_callstack.m4 +61 -0
  446. data/ext/libmemcached-0.50/m4/pandora_pthread.m4 +258 -0
  447. data/ext/libmemcached-0.50/m4/pandora_python3_devel.m4 +236 -0
  448. data/ext/libmemcached-0.50/m4/pandora_run_cpplint.m4 +8 -0
  449. data/ext/libmemcached-0.50/m4/pandora_sasl.m4 +133 -0
  450. data/ext/libmemcached-0.50/m4/pandora_shared_ptr.m4 +59 -0
  451. data/ext/libmemcached-0.50/m4/pandora_stack_direction.m4 +39 -0
  452. data/ext/libmemcached-0.50/m4/pandora_stl_hash.m4 +94 -0
  453. data/ext/libmemcached-0.50/m4/pandora_swig.m4 +39 -0
  454. data/ext/libmemcached-0.50/m4/pandora_use_pipe.m4 +36 -0
  455. data/ext/libmemcached-0.50/m4/pandora_vc_build.m4 +168 -0
  456. data/ext/libmemcached-0.50/m4/pandora_version.m4 +11 -0
  457. data/ext/libmemcached-0.50/m4/pandora_visibility.m4 +75 -0
  458. data/ext/libmemcached-0.50/m4/pandora_warnings.m4 +447 -0
  459. data/ext/libmemcached-0.50/m4/pandora_with_gettext.m4 +44 -0
  460. data/ext/libmemcached-0.50/m4/pandora_with_lua.m4 +55 -0
  461. data/ext/libmemcached-0.50/m4/pandora_with_memcached.m4 +41 -0
  462. data/ext/libmemcached-0.50/m4/pandora_with_perl.m4 +81 -0
  463. data/ext/libmemcached-0.50/m4/pandora_with_php.m4 +56 -0
  464. data/ext/libmemcached-0.50/m4/pandora_with_python.m4 +37 -0
  465. data/ext/libmemcached-0.50/m4/pandora_with_python3.m4 +44 -0
  466. data/ext/libmemcached-0.50/m4/pandora_with_r.m4 +33 -0
  467. data/ext/libmemcached-0.50/m4/pandora_with_ruby.m4 +79 -0
  468. data/ext/libmemcached-0.50/m4/pandora_with_valgrind.m4 +17 -0
  469. data/ext/libmemcached-0.50/m4/pkg.m4 +157 -0
  470. data/ext/libmemcached-0.50/m4/po.m4 +449 -0
  471. data/ext/libmemcached-0.50/m4/progtest.m4 +92 -0
  472. data/ext/libmemcached-0.50/m4/protocol_binary.m4 +36 -0
  473. data/ext/libmemcached-0.50/m4/setsockopt.m4 +73 -0
  474. data/ext/libmemcached-0.50/m4/socket_send_flags.m4 +66 -0
  475. data/ext/libmemcached-0.50/poll/include.am +8 -0
  476. data/ext/libmemcached-0.50/poll/poll.c +77 -0
  477. data/ext/libmemcached-0.50/poll/poll.h +45 -0
  478. data/ext/libmemcached-0.50/support/include.am +11 -0
  479. data/ext/libmemcached-0.50/support/libmemcached-fc.spec.in +105 -0
  480. data/ext/libmemcached-0.50/support/libmemcached.pc.in +10 -0
  481. data/ext/libmemcached-0.50/support/libmemcached.spec.in +281 -0
  482. data/ext/libmemcached-0.50/support/set_benchmark.sh +5 -0
  483. data/ext/libmemcached-0.50/tests/atomsmasher.cc +295 -0
  484. data/ext/libmemcached-0.50/tests/basic.cc +134 -0
  485. data/ext/libmemcached-0.50/tests/basic.h +66 -0
  486. data/ext/libmemcached-0.50/tests/cpp_example.cc +195 -0
  487. data/ext/libmemcached-0.50/tests/deprecated.cc +72 -0
  488. data/ext/libmemcached-0.50/tests/deprecated.h +49 -0
  489. data/ext/libmemcached-0.50/tests/error_conditions.cc +63 -0
  490. data/ext/libmemcached-0.50/tests/error_conditions.h +48 -0
  491. data/ext/libmemcached-0.50/tests/hash_plus.cc +225 -0
  492. data/ext/libmemcached-0.50/tests/hash_results.h +127 -0
  493. data/ext/libmemcached-0.50/tests/hashkit_functions.cc +619 -0
  494. data/ext/libmemcached-0.50/tests/include.am +342 -0
  495. data/ext/libmemcached-0.50/tests/ketama_test_cases.h +121 -0
  496. data/ext/libmemcached-0.50/tests/ketama_test_cases_spy.h +118 -0
  497. data/ext/libmemcached-0.50/tests/libmemcached_world.h +205 -0
  498. data/ext/libmemcached-0.50/tests/mem_functions.cc +6648 -0
  499. data/ext/libmemcached-0.50/tests/mem_udp.cc +510 -0
  500. data/ext/libmemcached-0.50/tests/output_plus.res +5 -0
  501. data/ext/libmemcached-0.50/tests/parser.cc +599 -0
  502. data/ext/libmemcached-0.50/tests/parser.h +109 -0
  503. data/ext/libmemcached-0.50/tests/plus.cpp +240 -0
  504. data/ext/libmemcached-0.50/tests/pool.cc +78 -0
  505. data/ext/libmemcached-0.50/tests/pool.h +49 -0
  506. data/ext/libmemcached-0.50/tests/print.cc +58 -0
  507. data/ext/libmemcached-0.50/tests/print.h +51 -0
  508. data/ext/libmemcached-0.50/tests/replication.cc +333 -0
  509. data/ext/libmemcached-0.50/tests/replication.h +64 -0
  510. data/ext/libmemcached-0.50/tests/start.cc +29 -0
  511. data/ext/libmemcached-0.50/tests/string.cc +174 -0
  512. data/ext/libmemcached-0.50/tests/string.h +67 -0
  513. data/ext/libmemcached-0.50/tests/virtual_buckets.cc +143 -0
  514. data/ext/libmemcached-0.50/tests/virtual_buckets.h +51 -0
  515. data/ext/libmemcached-0.50/win32/include.am +11 -0
  516. data/ext/libmemcached-0.50/win32/wrappers.h +55 -0
  517. data/ext/rlibmemcached.i +263 -0
  518. data/ext/rlibmemcached_wrap.c +16732 -0
  519. data/lib/memcached.rb +32 -0
  520. data/lib/memcached/auth.rb +16 -0
  521. data/lib/memcached/behaviors.rb +77 -0
  522. data/lib/memcached/exceptions.rb +84 -0
  523. data/lib/memcached/experimental.rb +48 -0
  524. data/lib/memcached/memcached.rb +660 -0
  525. data/lib/memcached/rails.rb +133 -0
  526. data/test/profile/benchmark.rb +245 -0
  527. data/test/profile/c_profiler.rb +14 -0
  528. data/test/profile/exercise.rb +185 -0
  529. data/test/profile/rb_profiler.rb +21 -0
  530. data/test/profile/valgrind.rb +10 -0
  531. data/test/setup.rb +30 -0
  532. data/test/teardown.rb +0 -0
  533. data/test/test_helper.rb +19 -0
  534. data/test/unit/binding_test.rb +8 -0
  535. data/test/unit/memcached_experimental_test.rb +274 -0
  536. data/test/unit/memcached_test.rb +1293 -0
  537. data/test/unit/rails_test.rb +122 -0
  538. metadata +650 -0
  539. metadata.gz.sig +0 -0
@@ -0,0 +1,908 @@
1
+ /*
2
+ * memslap
3
+ *
4
+ * (c) Copyright 2009, Schooner Information Technology, Inc.
5
+ * All rights reserved.
6
+ * http://www.schoonerinfotech.com/
7
+ *
8
+ * Use and distribution licensed under the BSD license. See
9
+ * the COPYING file for full text.
10
+ *
11
+ * Authors:
12
+ * Brian Aker
13
+ * Mingqiang Zhuang <mingqiangzhuang@hengtiansoft.com>
14
+ *
15
+ */
16
+ #include "config.h"
17
+
18
+ #include <stdlib.h>
19
+ #include <getopt.h>
20
+ #include <limits.h>
21
+ #if TIME_WITH_SYS_TIME
22
+ # include <sys/time.h>
23
+ # include <time.h>
24
+ #else
25
+ # if HAVE_SYS_TIME_H
26
+ # include <sys/time.h>
27
+ # else
28
+ # include <time.h>
29
+ # endif
30
+ #endif
31
+
32
+
33
+ #include "ms_sigsegv.h"
34
+ #include "ms_setting.h"
35
+ #include "ms_thread.h"
36
+
37
+ #define PROGRAM_NAME "memslap"
38
+ #define PROGRAM_DESCRIPTION \
39
+ "Generates workload against memcached servers."
40
+
41
+ #ifdef __sun
42
+ /* For some odd reason the option struct on solaris defines the argument
43
+ * as char* and not const char*
44
+ */
45
+ #define OPTIONSTRING char*
46
+ #else
47
+ #define OPTIONSTRING const char*
48
+ #endif
49
+
50
+ /* options */
51
+ static struct option long_options[]=
52
+ {
53
+ { (OPTIONSTRING)"servers", required_argument, NULL,
54
+ OPT_SERVERS },
55
+ { (OPTIONSTRING)"threads", required_argument, NULL,
56
+ OPT_THREAD_NUMBER },
57
+ { (OPTIONSTRING)"concurrency", required_argument, NULL,
58
+ OPT_CONCURRENCY },
59
+ { (OPTIONSTRING)"conn_sock", required_argument, NULL,
60
+ OPT_SOCK_PER_CONN },
61
+ { (OPTIONSTRING)"execute_number", required_argument, NULL,
62
+ OPT_EXECUTE_NUMBER },
63
+ { (OPTIONSTRING)"time", required_argument, NULL,
64
+ OPT_TIME },
65
+ { (OPTIONSTRING)"cfg_cmd", required_argument, NULL,
66
+ OPT_CONFIG_CMD },
67
+ { (OPTIONSTRING)"win_size", required_argument, NULL,
68
+ OPT_WINDOW_SIZE },
69
+ { (OPTIONSTRING)"fixed_size", required_argument, NULL,
70
+ OPT_FIXED_LTH },
71
+ { (OPTIONSTRING)"verify", required_argument, NULL,
72
+ OPT_VERIFY },
73
+ { (OPTIONSTRING)"division", required_argument, NULL,
74
+ OPT_GETS_DIVISION },
75
+ { (OPTIONSTRING)"stat_freq", required_argument, NULL,
76
+ OPT_STAT_FREQ },
77
+ { (OPTIONSTRING)"exp_verify", required_argument, NULL,
78
+ OPT_EXPIRE },
79
+ { (OPTIONSTRING)"overwrite", required_argument, NULL,
80
+ OPT_OVERWRITE },
81
+ { (OPTIONSTRING)"reconnect", no_argument, NULL,
82
+ OPT_RECONNECT },
83
+ { (OPTIONSTRING)"udp", no_argument, NULL,
84
+ OPT_UDP },
85
+ { (OPTIONSTRING)"facebook", no_argument, NULL,
86
+ OPT_FACEBOOK_TEST },
87
+ { (OPTIONSTRING)"binary", no_argument, NULL,
88
+ OPT_BINARY_PROTOCOL },
89
+ { (OPTIONSTRING)"tps", required_argument, NULL,
90
+ OPT_TPS },
91
+ { (OPTIONSTRING)"rep_write", required_argument, NULL,
92
+ OPT_REP_WRITE_SRV },
93
+ { (OPTIONSTRING)"verbose", no_argument, NULL,
94
+ OPT_VERBOSE },
95
+ { (OPTIONSTRING)"help", no_argument, NULL,
96
+ OPT_HELP },
97
+ { (OPTIONSTRING)"version", no_argument, NULL,
98
+ OPT_VERSION },
99
+ { 0, 0, 0, 0 },
100
+ };
101
+
102
+ /* Prototypes */
103
+ static void ms_sync_lock_init(void);
104
+ static void ms_sync_lock_destroy(void);
105
+ static void ms_global_struct_init(void);
106
+ static void ms_global_struct_destroy(void);
107
+ static void ms_version_command(const char *command_name);
108
+ static const char *ms_lookup_help(ms_options_t option);
109
+ static int64_t ms_parse_time(void);
110
+ static int64_t ms_parse_size(void);
111
+ static void ms_options_parse(int argc, char *argv[]);
112
+ static int ms_check_para(void);
113
+ static void ms_statistic_init(void);
114
+ static void ms_stats_init(void);
115
+ static void ms_print_statistics(int in_time);
116
+ static void ms_print_memslap_stats(struct timeval *start_time,
117
+ struct timeval *end_time);
118
+ static void ms_monitor_slap_mode(void);
119
+ void ms_help_command(const char *command_name, const char *description);
120
+
121
+
122
+ /* initialize the global locks */
123
+ static void ms_sync_lock_init()
124
+ {
125
+ ms_global.init_lock.count= 0;
126
+ pthread_mutex_init(&ms_global.init_lock.lock, NULL);
127
+ pthread_cond_init(&ms_global.init_lock.cond, NULL);
128
+
129
+ ms_global.warmup_lock.count = 0;
130
+ pthread_mutex_init(&ms_global.warmup_lock.lock, NULL);
131
+ pthread_cond_init(&ms_global.warmup_lock.cond, NULL);
132
+
133
+ ms_global.run_lock.count= 0;
134
+ pthread_mutex_init(&ms_global.run_lock.lock, NULL);
135
+ pthread_cond_init(&ms_global.run_lock.cond, NULL);
136
+
137
+ pthread_mutex_init(&ms_global.quit_mutex, NULL);
138
+ pthread_mutex_init(&ms_global.seq_mutex, NULL);
139
+ } /* ms_sync_lock_init */
140
+
141
+
142
+ /* destroy the global locks */
143
+ static void ms_sync_lock_destroy()
144
+ {
145
+ pthread_mutex_destroy(&ms_global.init_lock.lock);
146
+ pthread_cond_destroy(&ms_global.init_lock.cond);
147
+
148
+ pthread_mutex_destroy(&ms_global.warmup_lock.lock);
149
+ pthread_cond_destroy(&ms_global.warmup_lock.cond);
150
+
151
+ pthread_mutex_destroy(&ms_global.run_lock.lock);
152
+ pthread_cond_destroy(&ms_global.run_lock.cond);
153
+
154
+ pthread_mutex_destroy(&ms_global.quit_mutex);
155
+ pthread_mutex_destroy(&ms_global.seq_mutex);
156
+
157
+ if (ms_setting.stat_freq > 0)
158
+ {
159
+ pthread_mutex_destroy(&ms_statistic.stat_mutex);
160
+ }
161
+ } /* ms_sync_lock_destroy */
162
+
163
+
164
+ /* initialize the global structure */
165
+ static void ms_global_struct_init()
166
+ {
167
+ ms_sync_lock_init();
168
+ ms_global.finish_warmup= false;
169
+ ms_global.time_out= false;
170
+ }
171
+
172
+
173
+ /* destroy the global structure */
174
+ static void ms_global_struct_destroy()
175
+ {
176
+ ms_sync_lock_destroy();
177
+ }
178
+
179
+
180
+ /**
181
+ * output the version information
182
+ *
183
+ * @param command_name, the string of this process
184
+ */
185
+ static void ms_version_command(const char *command_name)
186
+ {
187
+ printf("%s v%u.%u\n", command_name, 1U, 0U);
188
+ exit(0);
189
+ }
190
+
191
+
192
+ /**
193
+ * get the description of the option
194
+ *
195
+ * @param option, option of command line
196
+ *
197
+ * @return char*, description of the command option
198
+ */
199
+ static const char *ms_lookup_help(ms_options_t option)
200
+ {
201
+ switch (option)
202
+ {
203
+ case OPT_SERVERS:
204
+ return
205
+ "List one or more servers to connect. Servers count must be less than\n"
206
+ " threads count. e.g.: --servers=localhost:1234,localhost:11211";
207
+
208
+ case OPT_VERSION:
209
+ return "Display the version of the application and then exit.";
210
+
211
+ case OPT_HELP:
212
+ return "Display this message and then exit.";
213
+
214
+ case OPT_EXECUTE_NUMBER:
215
+ return "Number of operations(get and set) to execute for the\n"
216
+ " given test. Default 1000000.";
217
+
218
+ case OPT_THREAD_NUMBER:
219
+ return
220
+ "Number of threads to startup, better equal to CPU numbers. Default 8.";
221
+
222
+ case OPT_CONCURRENCY:
223
+ return "Number of concurrency to simulate with load. Default 128.";
224
+
225
+ case OPT_FIXED_LTH:
226
+ return "Fixed length of value.";
227
+
228
+ case OPT_VERIFY:
229
+ return "The proportion of date verification, e.g.: --verify=0.01";
230
+
231
+ case OPT_GETS_DIVISION:
232
+ return "Number of keys to multi-get once. Default 1, means single get.";
233
+
234
+ case OPT_TIME:
235
+ return
236
+ "How long the test to run, suffix: s-seconds, m-minutes, h-hours,\n"
237
+ " d-days e.g.: --time=2h.";
238
+
239
+ case OPT_CONFIG_CMD:
240
+ return
241
+ "Load the configure file to get command,key and value distribution list.";
242
+
243
+ case OPT_WINDOW_SIZE:
244
+ return
245
+ "Task window size of each concurrency, suffix: K, M e.g.: --win_size=10k.\n"
246
+ " Default 10k.";
247
+
248
+ case OPT_UDP:
249
+ return
250
+ "UDP support, default memslap uses TCP, TCP port and UDP port of\n"
251
+ " server must be same.";
252
+
253
+ case OPT_EXPIRE:
254
+ return
255
+ "The proportion of objects with expire time, e.g.: --exp_verify=0.01.\n"
256
+ " Default no object with expire time";
257
+
258
+ case OPT_OVERWRITE:
259
+ return
260
+ "The proportion of objects need overwrite, e.g.: --overwrite=0.01.\n"
261
+ " Default never overwrite object.";
262
+
263
+ case OPT_STAT_FREQ:
264
+ return
265
+ "Frequency of dumping statistic information. suffix: s-seconds,\n"
266
+ " m-minutes, e.g.: --resp_freq=10s.";
267
+
268
+ case OPT_SOCK_PER_CONN:
269
+ return "Number of TCP socks per concurrency. Default 1.";
270
+
271
+ case OPT_RECONNECT:
272
+ return
273
+ "Reconnect support, when connection is closed it will be reconnected.";
274
+
275
+ case OPT_VERBOSE:
276
+ return
277
+ "Whether it outputs detailed information when verification fails.";
278
+
279
+ case OPT_FACEBOOK_TEST:
280
+ return
281
+ "Whether it enables facebook test feature, set with TCP and multi-get with UDP.";
282
+
283
+ case OPT_BINARY_PROTOCOL:
284
+ return
285
+ "Whether it enables binary protocol. Default with ASCII protocol.";
286
+
287
+ case OPT_TPS:
288
+ return "Expected throughput, suffix: K, e.g.: --tps=10k.";
289
+
290
+ case OPT_REP_WRITE_SRV:
291
+ return "The first nth servers can write data, e.g.: --rep_write=2.";
292
+
293
+ default:
294
+ return "Forgot to document this option :)";
295
+ } /* switch */
296
+ } /* ms_lookup_help */
297
+
298
+
299
+ /**
300
+ * output the help information
301
+ *
302
+ * @param command_name, the string of this process
303
+ * @param description, description of this process
304
+ * @param long_options, global options array
305
+ */
306
+ void ms_help_command(const char *command_name, const char *description)
307
+ {
308
+ char *help_message= NULL;
309
+
310
+ printf("%s v%u.%u\n", command_name, 1U, 0U);
311
+ printf(" %s\n\n", description);
312
+ printf(
313
+ "Usage:\n"
314
+ " memslap -hV | -s servers [-F config_file] [-t time | -x exe_num] [...]\n\n"
315
+ "Options:\n");
316
+
317
+ for (int x= 0; long_options[x].name; x++)
318
+ {
319
+ printf(" -%c, --%s%c\n", long_options[x].val, long_options[x].name,
320
+ long_options[x].has_arg ? '=' : ' ');
321
+
322
+ if ((help_message= (char *)ms_lookup_help(long_options[x].val)) != NULL)
323
+ {
324
+ printf(" %s\n", help_message);
325
+ }
326
+ }
327
+
328
+ printf(
329
+ "\nExamples:\n"
330
+ " memslap -s 127.0.0.1:11211 -S 5s\n"
331
+ " memslap -s 127.0.0.1:11211 -t 2m -v 0.2 -e 0.05 -b\n"
332
+ " memslap -s 127.0.0.1:11211 -F config -t 2m -w 40k -S 20s -o 0.2\n"
333
+ " memslap -s 127.0.0.1:11211 -F config -t 2m -T 4 -c 128 -d 20 -P 40k\n"
334
+ " memslap -s 127.0.0.1:11211 -F config -t 2m -d 50 -a -n 40\n"
335
+ " memslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m\n"
336
+ " memslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m -p 2\n\n");
337
+
338
+ exit(0);
339
+ } /* ms_help_command */
340
+
341
+
342
+ /* used to parse the time string */
343
+ static int64_t ms_parse_time()
344
+ {
345
+ int64_t ret= 0;
346
+ char unit= optarg[strlen(optarg) - 1];
347
+
348
+ optarg[strlen(optarg) - 1]= '\0';
349
+ ret= atoi(optarg);
350
+
351
+ switch (unit)
352
+ {
353
+ case 'd':
354
+ case 'D':
355
+ ret*= 24;
356
+
357
+ case 'h':
358
+ case 'H':
359
+ ret*= 60;
360
+
361
+ case 'm':
362
+ case 'M':
363
+ ret*= 60;
364
+
365
+ case 's':
366
+ case 'S':
367
+ break;
368
+
369
+ default:
370
+ ret= -1;
371
+ break;
372
+ } /* switch */
373
+
374
+ return ret;
375
+ } /* ms_parse_time */
376
+
377
+
378
+ /* used to parse the size string */
379
+ static int64_t ms_parse_size()
380
+ {
381
+ int64_t ret= -1;
382
+ char unit= optarg[strlen(optarg) - 1];
383
+
384
+ optarg[strlen(optarg) - 1]= '\0';
385
+ ret= strtoll(optarg, (char **)NULL, 10);
386
+
387
+ switch (unit)
388
+ {
389
+ case 'k':
390
+ case 'K':
391
+ ret*= 1024;
392
+ break;
393
+
394
+ case 'm':
395
+ case 'M':
396
+ ret*= 1024 * 1024;
397
+ break;
398
+
399
+ case 'g':
400
+ case 'G':
401
+ ret*= 1024 * 1024 * 1024;
402
+ break;
403
+
404
+ default:
405
+ ret= -1;
406
+ break;
407
+ } /* switch */
408
+
409
+ return ret;
410
+ } /* ms_parse_size */
411
+
412
+
413
+ /* used to parse the options of command line */
414
+ static void ms_options_parse(int argc, char *argv[])
415
+ {
416
+ int option_index= 0;
417
+ int option_rv;
418
+
419
+ while ((option_rv= getopt_long(argc, argv, "VhURbaBs:x:T:c:X:v:d:"
420
+ "t:S:F:w:e:o:n:P:p:",
421
+ long_options, &option_index)) != -1)
422
+ {
423
+ switch (option_rv)
424
+ {
425
+ case 0:
426
+ break;
427
+
428
+ case OPT_VERSION: /* --version or -V */
429
+ ms_version_command(PROGRAM_NAME);
430
+ break;
431
+
432
+ case OPT_HELP: /* --help or -h */
433
+ ms_help_command(PROGRAM_NAME, PROGRAM_DESCRIPTION);
434
+ break;
435
+
436
+ case OPT_SERVERS: /* --servers or -s */
437
+ ms_setting.srv_str= strdup(optarg);
438
+ break;
439
+
440
+ case OPT_CONCURRENCY: /* --concurrency or -c */
441
+ ms_setting.nconns= (uint32_t)strtoul(optarg, (char **) NULL, 10);
442
+ if (ms_setting.nconns <= 0)
443
+ {
444
+ fprintf(stderr, "Concurrency must be greater than 0.:-)\n");
445
+ exit(1);
446
+ }
447
+ break;
448
+
449
+ case OPT_EXECUTE_NUMBER: /* --execute_number or -x */
450
+ ms_setting.exec_num= (int)strtol(optarg, (char **) NULL, 10);
451
+ if (ms_setting.exec_num <= 0)
452
+ {
453
+ fprintf(stderr, "Execute number must be greater than 0.:-)\n");
454
+ exit(1);
455
+ }
456
+ break;
457
+
458
+ case OPT_THREAD_NUMBER: /* --threads or -T */
459
+ ms_setting.nthreads= (uint32_t)strtoul(optarg, (char **) NULL, 10);
460
+ if (ms_setting.nthreads <= 0)
461
+ {
462
+ fprintf(stderr, "Threads number must be greater than 0.:-)\n");
463
+ exit(1);
464
+ }
465
+ break;
466
+
467
+ case OPT_FIXED_LTH: /* --fixed_size or -X */
468
+ ms_setting.fixed_value_size= (size_t)strtoull(optarg, (char **) NULL, 10);
469
+ if ((ms_setting.fixed_value_size <= 0)
470
+ || (ms_setting.fixed_value_size > MAX_VALUE_SIZE))
471
+ {
472
+ fprintf(stderr, "Value size must be between 0 and 1M.:-)\n");
473
+ exit(1);
474
+ }
475
+ break;
476
+
477
+ case OPT_VERIFY: /* --verify or -v */
478
+ ms_setting.verify_percent= atof(optarg);
479
+ if ((ms_setting.verify_percent <= 0)
480
+ || (ms_setting.verify_percent > 1.0))
481
+ {
482
+ fprintf(stderr, "Data verification rate must be "
483
+ "greater than 0 and less than 1.0. :-)\n");
484
+ exit(1);
485
+ }
486
+ break;
487
+
488
+ case OPT_GETS_DIVISION: /* --division or -d */
489
+ ms_setting.mult_key_num= (int)strtol(optarg, (char **) NULL, 10);
490
+ if (ms_setting.mult_key_num <= 0)
491
+ {
492
+ fprintf(stderr, "Multi-get key number must be greater than 0.:-)\n");
493
+ exit(1);
494
+ }
495
+ break;
496
+
497
+ case OPT_TIME: /* --time or -t */
498
+ ms_setting.run_time= (int)ms_parse_time();
499
+ if (ms_setting.run_time == -1)
500
+ {
501
+ fprintf(stderr, "Please specify the run time. :-)\n"
502
+ "'s' for second, 'm' for minute, 'h' for hour, "
503
+ "'d' for day. e.g.: --time=24h (means 24 hours).\n");
504
+ exit(1);
505
+ }
506
+
507
+ if (ms_setting.run_time == 0)
508
+ {
509
+ fprintf(stderr, "Running time can not be 0. :-)\n");
510
+ exit(1);
511
+ }
512
+ break;
513
+
514
+ case OPT_CONFIG_CMD: /* --cfg_cmd or -F */
515
+ ms_setting.cfg_file= strdup(optarg);
516
+ break;
517
+
518
+ case OPT_WINDOW_SIZE: /* --win_size or -w */
519
+ ms_setting.win_size= (size_t)ms_parse_size();
520
+ if (ms_setting.win_size == (size_t)-1)
521
+ {
522
+ fprintf(
523
+ stderr,
524
+ "Please specify the item window size. :-)\n"
525
+ "e.g.: --win_size=10k (means 10k task window size).\n");
526
+ exit(1);
527
+ }
528
+ break;
529
+
530
+ case OPT_UDP: /* --udp or -U*/
531
+ ms_setting.udp= true;
532
+ break;
533
+
534
+ case OPT_EXPIRE: /* --exp_verify or -e */
535
+ ms_setting.exp_ver_per= atof(optarg);
536
+ if ((ms_setting.exp_ver_per <= 0) || (ms_setting.exp_ver_per > 1.0))
537
+ {
538
+ fprintf(stderr, "Expire time verification rate must be "
539
+ "greater than 0 and less than 1.0. :-)\n");
540
+ exit(1);
541
+ }
542
+ break;
543
+
544
+ case OPT_OVERWRITE: /* --overwrite or -o */
545
+ ms_setting.overwrite_percent= atof(optarg);
546
+ if ((ms_setting.overwrite_percent <= 0)
547
+ || (ms_setting.overwrite_percent > 1.0))
548
+ {
549
+ fprintf(stderr, "Objects overwrite rate must be "
550
+ "greater than 0 and less than 1.0. :-)\n");
551
+ exit(1);
552
+ }
553
+ break;
554
+
555
+ case OPT_STAT_FREQ: /* --stat_freq or -S */
556
+ ms_setting.stat_freq= (int)ms_parse_time();
557
+ if (ms_setting.stat_freq == -1)
558
+ {
559
+ fprintf(stderr, "Please specify the frequency of dumping "
560
+ "statistic information. :-)\n"
561
+ "'s' for second, 'm' for minute, 'h' for hour, "
562
+ "'d' for day. e.g.: --time=24h (means 24 hours).\n");
563
+ exit(1);
564
+ }
565
+
566
+ if (ms_setting.stat_freq == 0)
567
+ {
568
+ fprintf(stderr, "The frequency of dumping statistic information "
569
+ "can not be 0. :-)\n");
570
+ exit(1);
571
+ }
572
+ break;
573
+
574
+ case OPT_SOCK_PER_CONN: /* --conn_sock or -n */
575
+ ms_setting.sock_per_conn= (uint32_t)strtoul(optarg, (char **) NULL, 10);
576
+ if (ms_setting.sock_per_conn <= 0)
577
+ {
578
+ fprintf(stderr, "Number of socks of each concurrency "
579
+ "must be greater than 0.:-)\n");
580
+ exit(1);
581
+ }
582
+ break;
583
+
584
+ case OPT_RECONNECT: /* --reconnect or -R */
585
+ ms_setting.reconnect= true;
586
+ break;
587
+
588
+ case OPT_VERBOSE: /* --verbose or -b */
589
+ ms_setting.verbose= true;
590
+ break;
591
+
592
+ case OPT_FACEBOOK_TEST: /* --facebook or -a */
593
+ ms_setting.facebook_test= true;
594
+ break;
595
+
596
+ case OPT_BINARY_PROTOCOL: /* --binary or -B */
597
+ ms_setting.binary_prot= true;
598
+ break;
599
+
600
+ case OPT_TPS: /* --tps or -P */
601
+ ms_setting.expected_tps= (int)ms_parse_size();
602
+ if (ms_setting.expected_tps == -1)
603
+ {
604
+ fprintf(stderr,
605
+ "Please specify the item expected throughput. :-)\n"
606
+ "e.g.: --tps=10k (means 10k throughput).\n");
607
+ exit(1);
608
+ }
609
+ break;
610
+
611
+ case OPT_REP_WRITE_SRV: /* --rep_write or -p */
612
+ ms_setting.rep_write_srv= (uint32_t)strtoul(optarg, (char **) NULL, 10);
613
+ if (ms_setting.rep_write_srv <= 0)
614
+ {
615
+ fprintf(stderr,
616
+ "Number of replication writing server must be greater "
617
+ "than 0.:-)\n");
618
+ exit(1);
619
+ }
620
+ break;
621
+
622
+ case '?':
623
+ /* getopt_long already printed an error message. */
624
+ exit(1);
625
+
626
+ default:
627
+ abort();
628
+ } /* switch */
629
+ }
630
+ } /* ms_options_parse */
631
+
632
+
633
+ static int ms_check_para()
634
+ {
635
+ if (ms_setting.srv_str == NULL)
636
+ {
637
+ char *temp;
638
+
639
+ if ((temp= getenv("MEMCACHED_SERVERS")))
640
+ {
641
+ ms_setting.srv_str= strdup(temp);
642
+ }
643
+ else
644
+ {
645
+ fprintf(stderr, "No Servers provided\n\n");
646
+ return -1;
647
+ }
648
+ }
649
+
650
+ if (ms_setting.nconns % (uint32_t)ms_setting.nthreads != 0)
651
+ {
652
+ fprintf(stderr, "Concurrency must be the multiples of threads count.\n");
653
+ return -1;
654
+ }
655
+
656
+ if (ms_setting.win_size % UNIT_ITEMS_COUNT != 0)
657
+ {
658
+ fprintf(stderr, "Window size must be the multiples of 1024.\n\n");
659
+ return -1;
660
+ }
661
+
662
+ return EXIT_SUCCESS;
663
+ } /* ms_check_para */
664
+
665
+
666
+ /* initialize the statistic structure */
667
+ static void ms_statistic_init()
668
+ {
669
+ pthread_mutex_init(&ms_statistic.stat_mutex, NULL);
670
+ ms_init_stats(&ms_statistic.get_stat, "Get");
671
+ ms_init_stats(&ms_statistic.set_stat, "Set");
672
+ ms_init_stats(&ms_statistic.total_stat, "Total");
673
+ } /* ms_statistic_init */
674
+
675
+
676
+ /* initialize the global state structure */
677
+ static void ms_stats_init()
678
+ {
679
+ memset(&ms_stats, 0, sizeof(ms_stats_t));
680
+ if (ms_setting.stat_freq > 0)
681
+ {
682
+ ms_statistic_init();
683
+ }
684
+ } /* ms_stats_init */
685
+
686
+
687
+ /* use to output the statistic */
688
+ static void ms_print_statistics(int in_time)
689
+ {
690
+ int obj_size= (int)(ms_setting.avg_key_size + ms_setting.avg_val_size);
691
+
692
+ printf("\033[1;1H\033[2J\n");
693
+ ms_dump_format_stats(&ms_statistic.get_stat, in_time,
694
+ ms_setting.stat_freq, obj_size);
695
+ ms_dump_format_stats(&ms_statistic.set_stat, in_time,
696
+ ms_setting.stat_freq, obj_size);
697
+ ms_dump_format_stats(&ms_statistic.total_stat, in_time,
698
+ ms_setting.stat_freq, obj_size);
699
+ } /* ms_print_statistics */
700
+
701
+
702
+ /* used to print the states of memslap */
703
+ static void ms_print_memslap_stats(struct timeval *start_time,
704
+ struct timeval *end_time)
705
+ {
706
+ char buf[1024];
707
+ char *pos= buf;
708
+
709
+ pos+= snprintf(pos,
710
+ sizeof(buf), "cmd_get: %lu\n",
711
+ (unsigned long) ms_stats.cmd_get);
712
+ pos+= snprintf(pos,
713
+ sizeof(buf) - (size_t)(pos -buf),
714
+ "cmd_set: %lu\n",
715
+ (unsigned long) ms_stats.cmd_set);
716
+ pos+= snprintf(pos,
717
+ sizeof(buf) - (size_t)(pos -buf),
718
+ "get_misses: %lu\n",
719
+ (unsigned long) ms_stats.get_misses);
720
+
721
+ if (ms_setting.verify_percent > 0)
722
+ {
723
+ pos+= snprintf(pos,
724
+ sizeof(buf) - (size_t)(pos -buf),
725
+ "verify_misses: %lu\n",
726
+ (unsigned long) ms_stats.vef_miss);
727
+ pos+= snprintf(pos,
728
+ sizeof(buf) - (size_t)(pos -buf),
729
+ "verify_failed: %lu\n",
730
+ (unsigned long) ms_stats.vef_failed);
731
+ }
732
+
733
+ if (ms_setting.exp_ver_per > 0)
734
+ {
735
+ pos+= snprintf(pos,
736
+ sizeof(buf) - (size_t)(pos -buf),
737
+ "expired_get: %lu\n",
738
+ (unsigned long) ms_stats.exp_get);
739
+ pos+= snprintf(pos,
740
+ sizeof(buf) - (size_t)(pos -buf),
741
+ "unexpired_unget: %lu\n",
742
+ (unsigned long) ms_stats.unexp_unget);
743
+ }
744
+
745
+ pos+= snprintf(pos,
746
+ sizeof(buf) - (size_t)(pos -buf),
747
+ "written_bytes: %lu\n",
748
+ (unsigned long) ms_stats.bytes_written);
749
+ pos+= snprintf(pos,
750
+ sizeof(buf) - (size_t)(pos -buf),
751
+ "read_bytes: %lu\n",
752
+ (unsigned long) ms_stats.bytes_read);
753
+ pos+= snprintf(pos,
754
+ sizeof(buf) - (size_t)(pos -buf),
755
+ "object_bytes: %lu\n",
756
+ (unsigned long) ms_stats.obj_bytes);
757
+
758
+ if (ms_setting.udp || ms_setting.facebook_test)
759
+ {
760
+ pos+= snprintf(pos,
761
+ sizeof(buf) - (size_t)(pos -buf),
762
+ "packet_disorder: %lu\n",
763
+ (unsigned long) ms_stats.pkt_disorder);
764
+ pos+= snprintf(pos,
765
+ sizeof(buf) - (size_t)(pos -buf),
766
+ "packet_drop: %lu\n",
767
+ (unsigned long)ms_stats.pkt_drop);
768
+ pos+= snprintf(pos,
769
+ sizeof(buf) - (size_t)(pos -buf),
770
+ "udp_timeout: %lu\n",
771
+ (unsigned long)ms_stats.udp_timeout);
772
+ }
773
+
774
+ if (ms_setting.stat_freq > 0)
775
+ {
776
+ ms_dump_stats(&ms_statistic.get_stat);
777
+ ms_dump_stats(&ms_statistic.set_stat);
778
+ ms_dump_stats(&ms_statistic.total_stat);
779
+ }
780
+
781
+ int64_t time_diff= ms_time_diff(start_time, end_time);
782
+ pos+= snprintf(pos,
783
+ sizeof(buf) - (size_t)(pos -buf),
784
+ "\nRun time: %.1fs Ops: %llu TPS: %.0Lf Net_rate: %.1fM/s\n",
785
+ (double)time_diff / 1000000,
786
+ (unsigned long long)(ms_stats.cmd_get + ms_stats.cmd_set),
787
+ (ms_stats.cmd_get
788
+ + ms_stats.cmd_set) / ((long double)time_diff / 1000000),
789
+ (double)(
790
+ ms_stats.bytes_written
791
+ + ms_stats.bytes_read) / 1024 / 1024
792
+ / ((double)time_diff / 1000000));
793
+ assert(pos <= buf);
794
+
795
+ fprintf(stdout, "%s", buf);
796
+ fflush(stdout);
797
+ } /* ms_print_memslap_stats */
798
+
799
+
800
+ /* the loop of the main thread, wait the work threads to complete */
801
+ static void ms_monitor_slap_mode()
802
+ {
803
+ int second= 0;
804
+ struct timeval start_time, end_time;
805
+
806
+ /* Wait all the threads complete initialization. */
807
+ pthread_mutex_lock(&ms_global.init_lock.lock);
808
+ while (ms_global.init_lock.count < ms_setting.nthreads)
809
+ {
810
+ pthread_cond_wait(&ms_global.init_lock.cond,
811
+ &ms_global.init_lock.lock);
812
+ }
813
+ pthread_mutex_unlock(&ms_global.init_lock.lock);
814
+
815
+ /* only when there is no set operation it need warm up */
816
+ if (ms_setting.cmd_distr[CMD_SET].cmd_prop < PROP_ERROR)
817
+ {
818
+ /* Wait all the connects complete warm up. */
819
+ pthread_mutex_lock(&ms_global.warmup_lock.lock);
820
+ while (ms_global.warmup_lock.count < ms_setting.nconns)
821
+ {
822
+ pthread_cond_wait(&ms_global.warmup_lock.cond, &ms_global.warmup_lock.lock);
823
+ }
824
+ pthread_mutex_unlock(&ms_global.warmup_lock.lock);
825
+ }
826
+ ms_global.finish_warmup= true;
827
+
828
+ /* running in "run time" mode, user specify run time */
829
+ if (ms_setting.run_time > 0)
830
+ {
831
+ gettimeofday(&start_time, NULL);
832
+ while (1)
833
+ {
834
+ sleep(1);
835
+ second++;
836
+
837
+ if ((ms_setting.stat_freq > 0) && (second % ms_setting.stat_freq == 0)
838
+ && (ms_stats.active_conns >= ms_setting.nconns)
839
+ && (ms_stats.active_conns <= INT_MAX))
840
+ {
841
+ ms_print_statistics(second);
842
+ }
843
+
844
+ if (ms_setting.run_time <= second)
845
+ {
846
+ ms_global.time_out= true;
847
+ break;
848
+ }
849
+
850
+ /* all connections disconnect */
851
+ if ((second > 5) && (ms_stats.active_conns == 0))
852
+ {
853
+ break;
854
+ }
855
+ }
856
+ gettimeofday(&end_time, NULL);
857
+ sleep(1); /* wait all threads clean up */
858
+ }
859
+ else
860
+ {
861
+ /* running in "execute number" mode, user specify execute number */
862
+ gettimeofday(&start_time, NULL);
863
+
864
+ /*
865
+ * We loop until we know that all connects have cleaned up.
866
+ */
867
+ pthread_mutex_lock(&ms_global.run_lock.lock);
868
+ while (ms_global.run_lock.count < ms_setting.nconns)
869
+ {
870
+ pthread_cond_wait(&ms_global.run_lock.cond, &ms_global.run_lock.lock);
871
+ }
872
+ pthread_mutex_unlock(&ms_global.run_lock.lock);
873
+
874
+ gettimeofday(&end_time, NULL);
875
+ }
876
+
877
+ ms_print_memslap_stats(&start_time, &end_time);
878
+ } /* ms_monitor_slap_mode */
879
+
880
+
881
+ /* the main function */
882
+ int main(int argc, char *argv[])
883
+ {
884
+ srandom((unsigned int)time(NULL));
885
+ ms_global_struct_init();
886
+
887
+ /* initialization */
888
+ ms_setting_init_pre();
889
+ ms_options_parse(argc, argv);
890
+ if (ms_check_para())
891
+ {
892
+ ms_help_command(PROGRAM_NAME, PROGRAM_DESCRIPTION);
893
+ exit(1);
894
+ }
895
+ ms_setting_init_post();
896
+ ms_stats_init();
897
+ ms_thread_init();
898
+
899
+ /* waiting work thread complete its task */
900
+ ms_monitor_slap_mode();
901
+
902
+ /* clean up */
903
+ ms_thread_cleanup();
904
+ ms_global_struct_destroy();
905
+ ms_setting_cleanup();
906
+
907
+ return EXIT_SUCCESS;
908
+ } /* main */