This commit is contained in:
Evan Weaver 2009-08-03 12:20:16 -07:00
Родитель c9a12a5cb4
Коммит 3f9e0be994
4 изменённых файлов: 32 добавлений и 38 удалений

Просмотреть файл

@ -379,10 +379,9 @@ Please note that when pipelining is enabled, setter and deleter methods do not r
# Checks the return code from Rlibmemcached against the exception list. Raises the corresponding exception if the return code is not Memcached::Success or Memcached::ActionQueued. Accepts an integer return code and an optional key, for exception messages.
def check_return_code(ret, key = nil) #:doc:
return if ret == 0 # Lib::MEMCACHED_SUCCESS
return if ret == Lib::MEMCACHED_BUFFERED
if ret == Lib::MEMCACHED_NOTFOUND and !options[:show_backtraces]
if ret == 0 # Lib::MEMCACHED_SUCCESS
elsif ret == Lib::MEMCACHED_BUFFERED
elsif ret == Lib::MEMCACHED_NOTFOUND and !options[:show_backtraces]
raise @not_found_instance
else
message = "Key #{inspect_keys(key, (detect_failure if ret == Lib::MEMCACHED_SERVER_MARKED_DEAD)).inspect}"

Просмотреть файл

@ -1,18 +1,13 @@
HERE = File.dirname(__FILE__)
$LOAD_PATH << "#{HERE}/../../lib/"
require "#{File.dirname(__FILE__)}/../setup"
$LOAD_PATH << "#{File.dirname(__FILE__)}/../../lib/"
require 'rubygems'
require 'memcached'
require 'ruby-prof'
@cache = Memcached.new(
'127.0.0.1:43042', '127.0.0.1:43043'],
:namespace => "namespace"
)
result = RubyProf.profile do
load "#{HERE}/valgrind.rb"
load "#{HERE}/profile/valgrind.rb"
end
printer = RubyProf::GraphPrinter.new(result)

Просмотреть файл

@ -1,14 +1,14 @@
HERE = File.dirname(__FILE__)
$LOAD_PATH << "#{HERE}/../../lib/"
require "#{File.dirname(__FILE__)}/../setup"
$LOAD_PATH << "#{File.dirname(__FILE__)}/../../lib/"
require 'memcached'
require 'rubygems'
class Worker
def initialize(method_name, iterations)
@method = method_name || 'mixed'
@i = (iterations || 1000).to_i
@i = (iterations || 10000).to_i
@key1 = "key1-"*8
@key2 = "key2-"*8
@ -17,15 +17,13 @@ class Worker
@marshalled = Marshal.dump(@value)
@opts = [
['127.0.0.1:43042', '127.0.0.1:43043'],
["#{UNIX_SOCKET_NAME}0", "#{UNIX_SOCKET_NAME}1"],
{
:buffer_requests => false,g
:buffer_requests => false,
:no_block => false,
:namespace => "namespace"
}
]
system("ruby #{HERE}/../setup.rb")
sleep(1)
@cache = Memcached.new(*@opts)
@cache.set @key1, @value

Просмотреть файл

@ -1,20 +1,22 @@
HERE = File.dirname(__FILE__)
UNIX_SOCKET_NAME = File.join(ENV['TMPDIR']||'/tmp','memcached')
# Kill memcached
system("killall -9 memcached")
# Start memcached
verbosity = (ENV['DEBUG'] ? "-vv" : "")
log = "/tmp/memcached.log"
system ">#{log}"
# Network memcached
(43042..43046).each do |port|
system "memcached #{verbosity} -U #{port} -p #{port} >> #{log} 2>&1 &"
unless defined? UNIX_SOCKET_NAME
HERE = File.dirname(__FILE__)
UNIX_SOCKET_NAME = File.join(ENV['TMPDIR']||'/tmp','memcached')
# Kill memcached
system("killall -9 memcached")
# Start memcached
verbosity = (ENV['DEBUG'] ? "-vv" : "")
log = "/tmp/memcached.log"
system ">#{log}"
# Network memcached
(43042..43046).each do |port|
system "memcached #{verbosity} -U #{port} -p #{port} >> #{log} 2>&1 &"
end
# Domain socket memcached
(0..1).each do |i|
system "memcached -M -s #{UNIX_SOCKET_NAME}#{i} #{verbosity} >> #{log} 2>&1 &"
end
end
# Domain socket memcached
(0..1).each do |i|
system "memcached -M -s #{UNIX_SOCKET_NAME}#{i} #{verbosity} >> #{log} 2>&1 &"
end