On 29 April 2013 18:14, Jann Horn <[email protected]> wrote:
> Hello.
>
> A few days ago, I bought a Raspberry Pi. Those things don't exactly have much
> computation power (700MHz ARM), but they're still quite nice. Well, when I ran
> "htop", I was a bit disappointed about it using quite some CPU resources. I 
> had
> a look at the output of `strace` and saw that there was an anonymous mmap per
> opened file (because of stdio) and that there were many invocations of
> gettimeofday. Also, callgrind showed that quite some time was spent for 
> parsing
> scanf format strings.
>
> I wrote a small patch that makes htop run faster (see the attachment). On my
> Raspberry Pi, when filtering for "htop" and sorting by PID, htop with my patch
> uses ~4-6% CPU while htop without my patch (from SVN) uses ~7-11% CPU – but
> please measure yourself.
>
> In some places, this makes the code a little bit bigger, but I think that the
> increase in speed is worth it.
>
> What do you think about this? Will you merge this patch?

I think it's good! The code looks a bit more long-winded, but not that
much, and I could measure the performance improvements in my machine
as well. I just committed your patch (with very minor style
variations).

Thank you!

-- Hisham

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
htop-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htop-general

Reply via email to