From: Ivan N. <nov...@gm...> - 2009-05-27 23:53:18
|
---------- Forwarded message ---------- From: Ivan Novick <nov...@gm...> Date: Wed, May 27, 2009 at 4:52 PM Subject: Re: [Valgrind-users] False Sharing Detection To: Nicholas Nethercote <n.n...@gm...> A report that would be very help full for application developers would be like this: LINE OF CODE # of INSTANCES OF FALSE SHARING DETECTED array[x] = val; main.c:44 1,234,567 b = y; main.c:124 134,233 k = l; sum.c:233 44,123 ...... etc To help app developers quickly find the biggest violators Regards, Ivan Novick On Wed, May 27, 2009 at 4:45 PM, Nicholas Nethercote <n.n...@gm... > wrote: > On Thu, May 28, 2009 at 9:12 AM, Ivan Novick <nov...@gm...> wrote: > > Hi, > > I would like to detect cases of false sharing in my program. > > By this I mean cases where multiple threads are both trying to write data > to > > different memory locations but those locations are closest enough in > memory > > that they are on the on the same cache line. > > The result would be delays on threads even though there are enough CPU's > to > > do the work. > > Are there any tools in valgrind to do this? > > No, but it wouldn't be too hard to write a new one that did this. For > each cache-line-sized chunk of memory, you'd record which thread last > wrote to it and when, and then if another thread wrote to a chunk > sufficiently soon after a previous thread you'd give a warning. You > could record thread numbers and addresses and stack traces and the > like, there'd be trade-offs in how much overhead you'd have vs. how > much info you'd get in each report. > > Nick > |