I have a PHP scraper that is running on my RPi. I noticed that since I have installed some additional software to the RPi the scraper takes 3/4 times longer to finish it's task than before. I wonder if there is any way to check what caused this drop in performances.

It doesn't really seem a problem with memory. While the script is up and running the output to free -m is

             total       used       free     shared    buffers     cached
Mem:           438        426         12          0         31        348
-/+ buffers/cache:         45        392
Swap:           99          0         99

That should indicate that I have more free memory (392) that I am actually using (45).


You can install htop, which is an interactive process viewer for Linux. From the htop Wikipedia page (bold emphasis is my own):

Htop is an interactive system-monitor process-viewer written for Linux. It is designed to replace the Unix program top. It shows a frequently updated list of the processes running on a computer, normally ordered by the amount of CPU usage. Unlike top, htop provides a full list of processes running, instead of the top resource-consuming processes. Htop uses color and gives visual information about processor, swap and memory status.

Users often deploy htop in cases where Unix top does not provide enough information about the systems processes, for example when trying to find minor memory leaks in applications. Compared to top, it provides a more convenient, cursor-controlled interface for killing processes.

This is what I use, and I think it works really well.

| improve this answer | |
  • With htop I noticed that the problem is not really memory but processor use. The php script reaches 100% of CPU for every cycle of the crawler. Is it a problem? Or simply does it mean there's no other process running then the crawler takes the whole pie? – Francesco Oct 28 '13 at 23:42
  • 1
    That's when you look at the load averages for the Pi. If the load average is above 1 when the CPU is at 100% then it's slowing everything down. If the load average is below 1 but the CPU usage is at 100%, then it won't slow anything down. – Lawrence Oct 29 '13 at 1:13

Using top you can sort by cpu or memory usage.
Once you run top, hit shift-F to choose how to sort the output.
k sorts by cpu
n sorts by memory usage

| improve this answer | |

You can use the command "top" for see what´s going on each process.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.