Mir

Mir protocol code uses too much CPU (24%) vs rendering of graphics (75%)

Bug #1352210 reported by Daniel van Vugt
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mir
Expired
High
Unassigned

Bug Description

The Mir protocol code uses too much CPU (24%) vs rendering of graphics (75%).

My intuition is that we should be spending all our time rendering, and not sucking up any significant CPU cycles on the protocol logic.

Tags: performance
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Just FYI, you can divide up Mir's server profile results fairly cleanly in two by looking at inclusive cycles:
75% mir::compositor:: ...
24% boost::asio:: ...

If you assume that:
  (1) there is no boost::asio code called from under mir::compositor; and
  (2) there is no mir::compositor code call from under boost::asio
then they are logically separate regions of the server.

[The proof of (2) is that 24 < 75 and therefore can't be including the mir::compositor stuff]

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Hmm, actually with our new(ish) callback system in BufferQueue there probably is boost::asio code being called by mir::compositor (on compositor buffer release we send the freed buffer to the client immediately). But that might not make the problem description terribly inaccurate still.

Revision history for this message
kevin gunn (kgunn72) wrote :

so is this really a problem in the boost::asio isn't efficient ?
also, rather than percentages, can you post the average times of the split? curious, i mean if the time values are in absolute terms small then 25% is maybe not that bad.

Changed in mir:
status: New → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I can't make conclusive comments on boost::asio other than it's complex and seems to have very deep call stacks when it does anything. Although that's probably partly Mir's fault.

Sorry, but only relative percentages are available when profiling because absolute percentage is always up around 100%. And I think it's reasonable to say 25% for the protocol is too much for sending messages only 60 times per second when you compare it to the amount of work the graphics system is doing millions of times per second. But there was more evidence than that...

When I last did a direct comparison between /alternatives/ and Mir, I found their load on libGL was about equal. However Mir's total CPU usage was higher and the only obvious diff was the protocol layer. "Alternative" protocols seemed to use a much lower amount of CPU (<5%) relative to the graphics load. Sorry I can't find where I wrote all that down.

Changed in mir:
status: Incomplete → New
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

That's not to say that changing protocol library would immediately help. If enough of the bottleneck was in the Mir frontend code that sits of top of that then it would be Mir that needs optimizing and not the protocol itself. Needs further analysis...

Revision history for this message
kevin gunn (kgunn72) wrote :

if you have relative % dwell times. I don't think you can draw conclusions without stating the following.
GPU chipset id
GPU clock
emif bus width
emif clock
CPU chipset id
CPU clock
as well as, what exactly is being drawn/processed on the gpu....# of pixels? # of shader operations?
Are you sure that the 25% doesn't include any idle time at all ?

Changed in mir:
status: New → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Last time I did a fair comparison with Weston it was running the same app (glmark2), although Weston was doing so under the Wayland X layer and still had lower CPU than Mir. So we need to improve...

As for idle time, definitely not. Callgrind does not report idle time, only real CPU time consumed by instructions. I often wish callgrind could report idle time too, but it can't.

Changed in mir:
status: Incomplete → New
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

25% sounds huge. Marking this as high so it can get attention.

Changed in mir:
importance: Undecided → High
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Incomplete. We need fresh stats.

Changed in mir:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Mir because there has been no activity for 60 days.]

Changed in mir:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.