2

I'm trying to record metrics like cycles, instructions for an application called memcached. For this application to run I followed the following procedure:

1) Start the server using this command:

memcached -t 4 -m 4096 -n 550

2) Start the client using this command:

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

So now memcached is running with 4 threads.

Now I try to capture the metrics using perf tool using this command:

perf stat --log-fd 3 -e cycles memcached -t 4 -m 4096 -n 550 3>result.log

But here as the server is already running so I'm getting an error that port is already in use.

When I try to capture the metrics using -p (pid) argument for perf stat, I think I'm getting wrong outputs. I mean, I want to record metrics of the server when it is already running. Because I think that perf first executes the command and then waits for it to complete its execution and then give out the results. As memcached will run forever I'm not getting any results. Can anyone please explain the alternative (or what am I doing wrong) here?

Bhaskar Jupudi
  • 45
  • 1
  • 11
  • what makes you think you got wrong outputs? – Jakuje Feb 04 '16 at 15:39
  • 1
    Now I've modified the command like this using the pid: perf stat --repeat 10 --log-fd 3 -e cycles -p $pid sleep 1 3>results.log. So now the perf will record the cycles that memcached is utilizing for one second. But I'm getting those in some order of 100's (for example 936) which seems not logical. Because for an infinite for loop in a simple 'C' program, I'm getting those in some order of millions. Am I doing something wrong here? – Bhaskar Jupudi Feb 04 '16 at 18:24
  • Probably, the pid that I'm using is not the full load of that server. Can anyone please tell me the procedure to catch the actual pid of the server? I'm now using ps -ef | grep memcached. But when I'm trying to record metrics for that pid, I'm getting weird results. Please correct me if I'm wrong. – Bhaskar Jupudi Feb 04 '16 at 21:52
  • Bhaskar, try `pgrep` and `pidof` tools to search for server pids. Check in `top` that this was the pid of process which does the actual work. – osgx May 30 '17 at 04:01

0 Answers0