コード例 #1
0
ファイル: ProfileEvents.cs プロジェクト: roseboych/mmorpg-xfw
        public void Serialize(BinaryReader reader, ProfileEventData data)
        {
            m_NbProfiles = reader.ReadUInt32();
            m_ThreadID   = reader.ReadUInt32();
            m_NbEvents   = reader.ReadUInt32();

            // read all the profiles
            EventFileProfileDesc profileDesc = new EventFileProfileDesc();

            for (int i = 0; i < m_NbProfiles; i++)
            {
                profileDesc.Serialize(reader);
                data.AddProfile(profileDesc.m_ProfileID, profileDesc.m_Name);
            }

            ProfileEventData.ProfileContext eventsContext = data.GetEventContext(m_ThreadID);

            // read all the events
            ProfileEvent profileEvent = new ProfileEvent();

            for (int i = 0; i < m_NbEvents; i++)
            {
                profileEvent.Serialize(reader);

                string name = data.GetProfileName(profileEvent.m_ProfileID);
                eventsContext.AddEvent(profileEvent.m_Time, profileEvent.m_ProfileID, profileEvent.m_Type);
            }

            // Send stop events with the last recorded time
            while (!eventsContext.IsTerminated)
            {
                eventsContext.AddEvent(profileEvent.m_Time, 0, ProfileEventData.ProfileContext.Event.EventStop);
            }
        }
コード例 #2
0
ファイル: ProfileEvents.cs プロジェクト: roseboych/mmorpg-xfw
        public void Serialize(BinaryReader reader, ProfileEventData data)
        {
            m_NbThreads = reader.ReadUInt32();
            m_Frequency = reader.ReadUInt64();
            EventFileThreadDesc threadDesc = new EventFileThreadDesc();

            for (int i = 0; i < m_NbThreads; i++)
            {
                threadDesc.Serialize(reader);

                // register the context
                data.AddContext(threadDesc.m_ThreadID, threadDesc.m_Name);
            }
        }
コード例 #3
0
        private void OpenFile(string fileName)
        {
            openFileName = fileName;

            Stream stream;

            try
            {
                // get the file name and open a stream
                stream = new FileStream(fileName, FileMode.Open);
            }
            catch
            {
                String errorMsg = "Cannot open " + fileName;
                System.Windows.Forms.MessageBox.Show(errorMsg, "Error!");
                openFileName = null;
                return;
            }

            if (stream != null)
            {
                m_Data = new ProfileEventData(stream);

                // set the time start to the extent
                TimeExtent extent = m_Data.TimeExtent;

                m_TimeStart = (Time)extent.Min;
                m_TimeEnd   = (Time)extent.Max;

                this.Text = "Profile Event Viewer - " + fileName;

                Invalidate();
                stream.Close();
            }

            m_Summary.PostShow(this);
            m_Bookmarks.PostShow(this);
        }