コード例 #1
0
ファイル: LogBuffer.cs プロジェクト: slluis/heap-shot
 LogBuffer(BinaryReader reader)
 {
     this.Header = Header.Read (reader);
     while (reader.BaseStream.Position < reader.BaseStream.Length) {
         buffers.Add (Buffer.Read (reader));
     }
 }
コード例 #2
0
ファイル: LogBuffer.cs プロジェクト: facemao3/heap-shot
 LogBuffer(LogFileReader reader)
 {
     this.Header = Header.Read (reader);
     while (reader.Position < reader.Length) {
         buffers.Add (Buffer.Read (reader));
     }
 }
コード例 #3
0
ファイル: ObjectMapFileReader.cs プロジェクト: mono/heap-shot
        //
        // Code to read the log files generated at runtime
        //
        private void ReadLogFile(IProgressListener progress)
        {
            BufferHeader bheader;
            long start_position = reader.Position;
            long last_pct = 0;

            if (header == null)
                header = Header.Read (reader);
            if (header == null)
                return;

            reader.Header = header;

            while (!reader.IsEof) {
                // We check if we must cancel before reading more data (and after processing all the data we've read).
                // This way we don't cancel in the middle of event processing (since we store data at class level
                // we may end up with corruption the next time we read the same buffer otherwise).
                if (progress != null) {
                    if (progress.Cancelled)
                        return;

                    long pct = (reader.Position - start_position) * 100 / (reader.Length - start_position);
                    if (pct != last_pct) {
                        last_pct = pct;
                        progress.ReportProgress ("Loading profiler log", pct / 100.0f);
                    }
                }

                bheader = BufferHeader.Read (reader);
                if (bheader == null) {
                    // entire buffer isn't available (yet)
                    return;
                }

                //Console.WriteLine ("BUFFER ThreadId: " + bheader.ThreadId + " Len:" + bheader.Length);
                currentObjBase = bheader.ObjBase;
                currentPtrBase = bheader.PtrBase;

                while (!reader.IsBufferEmpty) {
                    MetadataEvent me;
                    HeapEvent he;
                    GcEvent ge;

                    Event e = Event.Read (reader);
                    if ((me = e as MetadataEvent) != null)
                        ReadLogFileChunk_Type (me);
                    else if ((he = e as HeapEvent) != null)
                        ReadLogFileChunk_Object (he);
                    else if ((ge = e as GcEvent) != null)
                        ReadGcEvent (ge);
                }
            }
        }