redis/redis-rest-storage-performance.rb
def parse_slowlog(slowlog, redis_calls)
	first_id = slowlog.length-5
	start_id = slowlog[first_id].to_i

	i = slowlog.length-1
	next_id = start_id
	redis_call_str = Array.new
	redis_calls_str = Array.new
	while i >=0 do
		next_line = slowlog[i].strip
		redis_call_str << next_line
		if next_line == next_id.to_s
			next_id +=1
			redis_calls_str << redis_call_str
			redis_call_str = Array.new
		end
		i -= 1
	end

	redis_calls_str.each do |redis_call_str|

		time = redis_call_str[redis_call_str.length-3].to_i
		command = redis_call_str[redis_call_str.length-4]

		key = ""
		if(command == "evalsha")
			key = redis_call_str[redis_call_str.length-7]
		else
			key = redis_call_str[redis_call_str.length-5]
		end

		if(!key.start_with?("rest-storage") && !key.start_with?(":nemo"))
			next
		end

		command_key = command+"_"+key

		if(redis_calls.has_key?(command_key))
			redis_calls[command_key][:time] << time
		else
			redis_call = {:key => key, :time => [time], :command => command}
			redis_calls[command_key] = redis_call
		end

	end

	return redis_calls
end
############################################################################################
# Parse the redis slowlog and create an object of every entry
# Because we have no separator, we take the unique progressive identifier as identifier 
# for a new entry
# 
# slowlog: the slowlog of the actual run
# redis_calls: the redis_calls the executed runs
############################################################################################
Parse the redis slowlog and create an object of every entry
Because we have no separator, we take the unique progressive identifier as identifier
for a new entry

the slowlog of the actual run
redis_calls: the redis_calls the executed runs
Parse the redis slowlog and create an object of every entry Because we have no separator we take the unique progressive identifier as identifier for a new entry the slowlog of the actual run redis_calls : the redis_calls the executed runs
def parse_slowlog(slowlog, redis_calls)
	first_id = slowlog.length-5
	start_id = slowlog[first_id].to_i
	i = slowlog.length-1
	next_id = start_id
	redis_call_str = Array.new
	redis_calls_str = Array.new
	while i >=0 do
		next_line = slowlog[i].strip
		redis_call_str << next_line
		if next_line == next_id.to_s
			next_id +=1
			redis_calls_str << redis_call_str
			redis_call_str = Array.new
		end
		i -= 1
	end
	redis_calls_str.each do |redis_call_str|
		time = redis_call_str[redis_call_str.length-3].to_i
		command = redis_call_str[redis_call_str.length-4]
		key = ""
		if(command == "evalsha")
			key = redis_call_str[redis_call_str.length-7]
		else
			key = redis_call_str[redis_call_str.length-5]
		end
		if(!key.start_with?("rest-storage") && !key.start_with?(":nemo"))
			next
		end
		command_key = command+"_"+key
		if(redis_calls.has_key?(command_key))
			redis_calls[command_key][:time] << time
		else
			redis_call = {:key => key, :time => [time], :command => command}
			redis_calls[command_key] = redis_call
		end
	end
	return redis_calls
end
def parse_slowlog ( slowlog , redis_calls ) first_id = slowlog . length - 5 start_id = slowlog [ first_id ] . to_i i = slowlog . length - 1 next_id = start_id redis_call_str = Array . new redis_calls_str = Array . new while i >= 0 do next_line = slowlog [ i ] . strip redis_call_str << next_line if next_line == next_id . to_s next_id += 1 redis_calls_str << redis_call_str redis_call_str = Array . new end i -= 1 end redis_calls_str . each do | redis_call_str | time = redis_call_str [ redis_call_str . length - 3 ] . to_i command = redis_call_str [ redis_call_str . length - 4 ] key = "" if ( command == "evalsha" ) key = redis_call_str [ redis_call_str . length - 7 ] else key = redis_call_str [ redis_call_str . length - 5 ] end if ( ! key . start_with? ( "rest-storage" ) && ! key . start_with? ( ":nemo" ) ) next end command_key = command + "_" + key if ( redis_calls . has_key? ( command_key ) ) redis_calls [ command_key ] [ :time ] << time else redis_call = { :key => key , :time => [ time ] , :command => command } redis_calls [ command_key ] = redis_call end end return redis_calls end
Parse the redis slowlog and create an object of every entry
Because we have no separator, we take the unique progressive identifier as identifier
for a new entry
Parse the redis slowlog and create an object of every entry Because we have no separator we take the unique progressive identifier as identifier for a new entry
slowlog
redis_calls