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?