Using perf stat -p argument

Hi,

I'm trying to record metrics for an application called memcached. The procedure that I followed is:

1) Start the server using this command:

memcached -t 4 -m 4096 -n 550

2) Start the client using this command (after warming up the server):

./loader -a ../twitter_dataset/twitter_dataset_30x -s servers.txt -g 0.8 -T 1 -c 200 -w 8 -e -r (requests_per_second)

3) Now after the connection is established, I'm now trying to record the metrics using this command:

perf stat --log-fd 3 -e cycles -p $pid sleep 1 3>results.log

Explanation of perf command that I'm using:
This will record metric - cycles for the server memcached for 1 second.

But I'm getting weird results from the above command. I think that pid that I'm catching is not the full load of the server. I'm getting the results in order of 100's which seems weird. Can anyone please suggest any alternative method to overcome this (or what am I doing wrong here)?