Ejemplo n.º 1
0
 public static void LogSnapshot(WeakEventTable table, string title)
 {
     _log.Add(new Snapshot(title).Populate(table));
     if (_log.Count > 10000)
     {
         _log.RemoveRange(0, 7000);
     }
 }
Ejemplo n.º 2
0
            internal override void OnShutDown(object target, object sender, EventArgs e)
            {
                WeakEventTable table = (WeakEventTable)target;

                table.OnShutDown();
            }
Ejemplo n.º 3
0
 public WeakEventTableShutDownListener(WeakEventTable target) : base(target)
 {
 }
Ejemplo n.º 4
0
                public Snapshot Populate(WeakEventTable table)
                {
                    ThreadId   = table.Dispatcher.Thread.ManagedThreadId;
                    Size       = table._dataTable.Count;
                    Reads      = table._readCount;
                    Writes     = table._writeCount;
                    Purges     = table._purgeCount;
                    PurgeNoops = table._purgeNoops;

                    AllocationRecord record;

                    if (table._allocations.TryGetValue(typeof(WeakEventLogger), out record))
                    {
                        AllocationCount = record.Count;
                        AllocationBytes = record.Bytes;
                    }
                    if (table._LOHallocations.TryGetValue(typeof(WeakEventLogger), out record))
                    {
                        LOHCount = record.Count;
                        LOHBytes = record.Bytes;
                    }

                    foreach (EventKey key in table._dataTable.Keys)
                    {
                        object source = key.Source;
                        Type   type   = (source == null) ? typeof(WeakEventTable) : source.GetType();
                        System.Collections.Generic.List <LoggerPair> list;

                        if (!Data.TryGetValue(type, out list))
                        {
                            list = new System.Collections.Generic.List <LoggerPair>();
                            list.Add(new LoggerPair());
                            Data[type] = list;
                        }

                        WeakEventManager manager = key.Manager;
                        bool             found   = false;
                        foreach (LoggerPair pair in list)
                        {
                            if (null == pair.Manager)
                            {
                                pair.Count += 1;
                            }
                            else if (manager == pair.Manager)
                            {
                                found       = true;
                                pair.Count += 1;
                                break;
                            }
                        }

                        if (!found)
                        {
                            list.Add(new LoggerPair {
                                Manager = manager, Count = 1
                            });
                        }
                    }

                    return(this);
                }
Ejemplo n.º 5
0
 public WeakEventTableShutDownListener(WeakEventTable target) : base(target)
 {
 }