Exemplo n.º 1
0
        private unsafe void OnMergeCompleted(IntPtr buffer, int size)
        {
            EventPageHeader header = (EventPageHeader)Marshal.PtrToStructure(buffer, typeof(EventPageHeader));

            try
            {
                using (UnmanagedMemoryStream bufferStream = new UnmanagedMemoryStream((byte *)buffer.ToPointer(), size))
                {
                    bufferStream.Seek(sizeof(EventPageHeader), SeekOrigin.Begin);
                    using (MemoryStream memoryStream = new MemoryStream())
                    {
                        bufferStream.CopyTo(memoryStream);
                        _eventsTrees.Add(header, memoryStream.ToArray());
                    }
                }
            }
            catch (Exception exception)
            {
                LoggingProvider.Current.Log(TraceEventType.Error, exception);
                throw;
            }
            finally
            {
                NativeMethods.Free(buffer);
            }
        }
Exemplo n.º 2
0
        internal void Add(EventPageHeader pageHeader, byte[] pageData)
        {
            SingleEventTree eventTree = new SingleEventTree(pageHeader.EventsTreeGlobalId, pageHeader.ThreadUid, pageHeader.ThreadOsId,
                                                            pageHeader.BeginLifetime, pageHeader.EndLifetime, pageData);

            lock (_collector)
            {
                _collector.Add(eventTree);
            }
        }