https://bugs.kde.org/show_bug.cgi?id=380942

--- Comment #1 from Julian Seward <jsew...@acm.org> ---
Created attachment 105965
  --> https://bugs.kde.org/attachment.cgi?id=105965&action=edit
Initial implementation

Here's an initial implementation.  Some notes:

* You *must* use --fair-sched=yes.  If you don't, you'll get garbage
  results and no warning.

* The implementation reduces SCHEDULING_QUANTUM from 100000 to 1200,
  so as to give reasonable pseudo-parallel interleaving of threads.
  That is a fine enough interleaving to pick up more than 90% of all
  RFOs from execution of parallel layout algorithms in Firefox.  If
  you have very frequent cache line transfers then you may need to
  set this even lower to get accurate stats.

* The reduction in SCHEDULING_QUANTUM makes Valgrind run more slowly,
  although not catastrophically so.

* This doesn't really simulate the MESI protocol directly.  Instead
  it keeps track of which thread has most recently accessed each
  cache line sized piece of memory, and observes transfers of ownership
  between these cache line sized pieces of memory.

* As a result you can simulate MESI (like) behaviour for any number of
  threads.  It's unrelated to the hardware in your machine.  The line
  size is currently hardwired to 64 bytes.

* Use the flag --simulate-mesi=yes.  You can't use any of the other
  Callgrind simulation facilities (caches, branches, prefetchers etc)
  at the same time.

* The simulation tries to distinguish between true and false sharing.

* This is all very experimental.  It's not really clear whether the RFO
  detection and the true-vs-false sharing detection reflect reality
  accurately enough to be useful.

* 4 different kinds of costs are computed:
     RFOr      -- requests for ownership (transfers) due to reads
     RFOw      -- RFOs due to writes
     RFOrTrue  -- RFOs due to reads, with true sharing
     RFOwTrue  -- RFOs due to writes, with true sharing

* You can display the results in KCachegrind in the normal way.

* Although it is not necessary, it is useful to program the following
  formulas into KCachegrind:

     RFO = RFOr + RFOw              -- total number of RFOs

     RFOTrue = RFOrTrue + RFOwTrue  -- total number of RFOs from true sharing

     RFOFalse = RFOr + RFOw - RFOrTrue - RFOwTrue
                                    -- total number of RFOs from false sharing

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to