Ejemplo n.º 1
0
        internal override void Process(ProfilerSession sess)
        {
            Tracing.PacketTrace("ALLOC: Object allocated at address {0}", m_address);
            ObjectAllocation alloc = new ObjectAllocation();

            alloc.m_thread  = sess.m_currentThreadPID;
            alloc.m_address = m_address;
            alloc.m_size    = m_size;
            if (!sess.m_threadCallStacks.ContainsKey(sess.m_currentThreadPID))
            {
                sess.m_threadCallStacks.Add(sess.m_currentThreadPID, new Stack <uint>());
            }
            alloc.m_callStack = sess.m_threadCallStacks[sess.m_currentThreadPID].ToArray();
            Array.Reverse(alloc.m_callStack);
            sess.ResolveTypeName(m_type);   //Cache type name.

            if (sess.m_liveObjectTable.BinarySearch(m_address) < 0)
            {
                sess.m_liveObjectTable.Add(m_address);
                sess.m_liveObjectTable.Sort();
            }

            alloc.m_objectType = new ObjectType(m_type, m_rank);
            sess.AddEvent(alloc);
        }
Ejemplo n.º 2
0
 private void AllocateObjectsAndSeedCache()
 {
     _objectAllocations = new List <ObjectAllocation>();
     for (int i = 0; i < this.ObjectsAllocated; i++)
     {
         var data = new ObjectAllocation();
         data.Payload  = GeneratePayloadWithSize(this.SizeOfPayload);
         data.CacheKey = Guid.NewGuid().ToString();
         _cache.Set(data.CacheKey, data.Payload);
         _objectAllocations.Add(data);
     }
 }