Exemple #1
0
        public void LogControl_DragDrop(object sender, DragEventArgs e)
        {
            LogControl sourceLogControl = GetDragEventSourceLogControl(e);
            LogRange   sourceLogRange   = GetDragEventSourceLogRange(e);

            if (sourceLogControl != null || sourceLogRange != null)
            {
                foreach (LogView logView in m_logViews)
                {
                    logView.SetSingleOrdiColour(RGB.RandomHueRGB());
                }

                foreach (Control lliControl in logListTableLayoutPanel.Controls)
                {
                    LogListItem lli = (LogListItem)lliControl;
                    lli.UpdateContents();
                }

                logListTableLayoutPanel.SuspendLayout();
                {
                    if (sourceLogControl != null)
                    {
                        foreach (LogView logView in sourceLogControl.m_logViews)
                        {
                            FrameRecordRange frr      = logView.m_logData == logView.m_baseLogData ? null : logView.m_logData.FrameRecordRange;
                            LogRange         logRange = new LogRange(logView.m_baseLogData, frr);
                            AddNewLogRange(logRange);
                        }
                    }
                    else if (sourceLogRange != null)
                    {
                        AddNewLogRange(sourceLogRange);
                    }
                }
                logListTableLayoutPanel.ResumeLayout();

                m_statoscopeForm.SetSessionInfoList(this);

                RefreshItemInfoPanel();
                UpdateControls(0);
                SetUMTreeViewNodeColours();

                foreach (LogView logView in m_logViews)
                {
                    // this is required as in calculating value stats in UpdateControls(), an OnPaint could happen and use invalid data
                    logView.DeleteDisplayListsEndingIn(".MA");
                    logView.DeleteDisplayListsEndingIn(".LM");
                }
            }
            else
            {
                m_statoscopeForm.StatoscopeForm_DragDrop(sender, e);
            }
        }
Exemple #2
0
        void AddNewLogRange(LogRange logRange)
        {
            LogView newLogView = new LogView(this, logRange);

            newLogView.SetSingleOrdiColour(RGB.RandomHueRGB());
            m_logViews.Add(newLogView);

            LogListItem logListItem = new LogListItem(newLogView);

            logListTableLayoutPanel.Controls.Add(logListItem);

            AddZoneHighlighters(newLogView);
        }
Exemple #3
0
        public void LogControl_DragEnter(object sender, DragEventArgs e)
        {
            LogControl sourceLogControl = GetDragEventSourceLogControl(e);
            LogRange   sourceLogRange   = GetDragEventSourceLogRange(e);

            if ((sourceLogControl != null && sourceLogControl != this) || sourceLogRange != null)
            {
                e.Effect = DragDropEffects.Copy;
            }
            else
            {
                m_statoscopeForm.StatoscopeForm_DragEnter(sender, e);
            }
        }
        private void ProcessLogLoadRequest(FileSessionInfo[] sessions)
        {
            using (ProfileSection p = new ProfileSection("Loading log"))

                try
                {
                    List <LogRange> logRanges           = new List <LogRange>();
                    TreeNode        sessionLogsBaseNode = null;

                    foreach (FileSessionInfo session in sessions)
                    {
                        Reset();

                        FileLogProcessor logProcessor = new FileLogProcessor(session);
                        LogData          logData      = logProcessor.ProcessLog();
                        LogRange         logRange     = new LogRange(logData, null);

                        logRanges.Add(logRange);
                        sessionLogsBaseNode = AddToLogRangeList(logRange);
                    }

                    int      numTabPages         = tabControl1.TabPages.Count;
                    string   tabName             = logRanges.Count == 1 ? logRanges[0].m_logData.Name : string.Format("{0} log compare", logRanges.Count);
                    TreeNode sessionTabsBaseNode = CreateLogControlTabPage(logRanges, tabName, null);

                    if (logRanges.Count == 1)
                    {
                        foreach (FrameRecordRange frr in logRanges[0].m_logData.LevelRanges)
                        {
                            List <LogRange> lrs      = new List <LogRange>();
                            LogRange        logRange = new LogRange(logRanges[0].m_logData, frr);

                            lrs.Add(logRange);
                            AddToLogRangeList(logRange, sessionLogsBaseNode, sessionTabsBaseNode);
                        }
                    }

                    SetSessionInfoList(logRanges[0]);

                    tabControl1.SelectTab(numTabPages);                 // select the newly opened page
                }
                catch (Exception e)
                {
                    System.Console.WriteLine(e);
                }
        }
        private void sessionTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TabPage           tabPage           = e.Node.Tag as TabPage;
            LogRangeTreeEntry logRangeTreeEntry = e.Node.Tag as LogRangeTreeEntry;

            if (tabPage != null && tabControl1.TabPages.Contains(tabPage))
            {
                tabControl1.SelectedTab = tabPage;
            }
            else if (logRangeTreeEntry != null)
            {
                LogRange        logRange  = logRangeTreeEntry.LogRange;
                List <LogRange> logRanges = new List <LogRange>();
                logRanges.Add(logRange);
                string   name = logRange.m_frr != null ? logRange.m_frr.Name : logRange.m_logData.Name;
                TreeNode sessionTabsBaseNode = CreateLogControlTabPage(logRanges, name, logRangeTreeEntry.ParentTabNode);
            }
        }
        public TreeNode AddToLogRangeList(LogRange logRange, TreeNode sessionParentLogNode, TreeNode sessionParentTabNode)
        {
            string   name     = logRange.m_frr != null ? logRange.m_frr.Name : logRange.m_logData.Name;
            TreeNode treeNode = new TreeNode(name);

            treeNode.Tag = new LogRangeTreeEntry(logRange, sessionParentTabNode);

            TreeNode logsTreeNode = sessionTreeView.Nodes["Logs"];

            if (sessionParentLogNode == null)
            {
                sessionParentLogNode = logsTreeNode;
            }

            sessionParentLogNode.Nodes.Add(treeNode);
            logsTreeNode.Expand();
            SetSessionInfoList(logRange);

            return(treeNode);
        }
        private void sessionTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TabPage           tabPage           = e.Node.Tag as TabPage;
            LogRangeTreeEntry logRangeTreeEntry = e.Node.Tag as LogRangeTreeEntry;

            if (tabPage != null && tabControl1.TabPages.Contains(tabPage))
            {
                if (tabControl1.SelectedTab == tabPage)
                {
                    // select the session info anyway (tabControl1_Selected() won't be called)
                    LogControl logControl = GetLogControlFromTabPage(tabPage);
                    SetSessionInfoList(logControl);
                }

                tabControl1.SelectedTab = tabPage;
                sessionTreeView.Focus();
            }
            else if (logRangeTreeEntry != null)
            {
                LogRange logRange = logRangeTreeEntry.LogRange;
                SetSessionInfoList(logRange);
            }
        }
 void SetSessionInfoList(LogRange logRange)
 {
     SetSessionInfoList(new LogData[] { logRange.m_logData });
 }
 public TreeNode AddToLogRangeList(LogRange logRange)
 {
     return(AddToLogRangeList(logRange, null, null));
 }
 public LogRangeTreeEntry(LogRange logRange, TreeNode parentTabNode)
 {
     LogRange      = logRange;
     ParentTabNode = parentTabNode;
 }
        public LogData ProcessLog(StatoscopeForm ssForm)
        {
            TcpClient client           = null;
            bool      bShouldLogToFile = false;
            string    connectionName   = "";

            using (ConnectMessageBox connectMsgBox = new ConnectMessageBox())
            {
                bool successful = false;
                while (!successful)
                {
                    if (connectMsgBox.ShowDialog() == DialogResult.OK)
                    {
                        try
                        {
                            client           = new TcpClient(connectMsgBox.IpAddress, connectMsgBox.Port);
                            bShouldLogToFile = connectMsgBox.logToFileCheckBox.Checked;
                            connectionName   = connectMsgBox.ConnectionName;
                            successful       = true;
                        }
                        catch (Exception ex)
                        {
                            ex.ToString();
                            ConnectionErrorDialog ced = new ConnectionErrorDialog();
                            ced.errorLabel.Text += connectMsgBox.IpAddress + ":" + connectMsgBox.Port;
                            ced.ShowDialog();
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }
            }

            string logWriteFilename = "";

            if (bShouldLogToFile)
            {
                SaveFileDialog fd = new SaveFileDialog();
                fd.CheckFileExists = false;
                fd.FileName        = "log.bin";
                fd.Filter          = "Binary log files (*.bin)|*.bin|All files (*.*)|*.*";
                fd.FilterIndex     = 0;

                if (fd.ShowDialog() == DialogResult.OK)
                {
                    logWriteFilename = fd.FileName;
                }
            }

            SocketSessionInfo sessionInfo = new SocketSessionInfo(connectionName, logWriteFilename);
            SocketLogData     logData     = new SocketLogData(sessionInfo);

            logData.ProcessRecords();

            List <LogRange> logRanges = new List <LogRange>();
            LogRange        logRange  = new LogRange(logData, null);

            logRanges.Add(logRange);
            ssForm.AddToLogRangeList(logRange);

            ssForm.CreateLogControlTabPage(logRanges, connectionName, null);

            ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessSocketDataStreamCB), new SSocketParseArgs(logData, logWriteFilename, client));

            return(logData);
        }
Exemple #12
0
        public LogView(LogControl logControl, LogRange logRange)
        {
            m_logControl  = logControl;
            m_baseLogData = logRange.m_logData;
            m_baseViewFRs = new List <ViewFrameRecord>(m_baseLogData.FrameRecords.Count);
            m_viewPaths   = new FrameRecordPathCollection();
            ExpandBaseVFRs(m_baseLogData.FrameRecords.Count - 1);

            SocketLogData socketLogData = m_baseLogData as SocketLogData;

            if (socketLogData != null)
            {
                socketLogData.AddListeningLogView(this);
            }

            if (logRange.m_frr != null)
            {
                FrameRecordRange frr = logRange.m_frr;
                m_logData = new LogData(m_baseLogData, frr);
                m_viewFRs = new List <ViewFrameRecord>(m_baseViewFRs.GetRange(frr.StartIdx, frr.EndIdx - frr.StartIdx + 1));
            }
            else
            {
                m_logData = m_baseLogData;
                m_viewFRs = m_baseViewFRs;
            }

            string logName = m_logData.Name;

            int idx = logName.LastIndexOf('\\') + 1;

            if (idx != -1)
            {
                logName = logName.Substring(idx);                  // get the filename without the path
            }

            idx = logName.IndexOf(".bin");

            if (idx != -1)
            {
                logName = logName.Substring(0, idx);                  // remove .bin
            }

            m_name = logName;

            // these are searched in order
            m_graphDescs = new IGraphDesc[]
            {
                new CProfileGraphDesc("/Threads/", new ProfileGraphLeafDesc("selfTimeInMS", EItemType.Float)),
                new CProfileGraphDesc("/ParticlesColliding/", new ProfileGraphLeafDesc("count", EItemType.Int)),
                new CProfileGraphDesc("/PhysEntities/", new ProfileGraphLeafDesc("time", EItemType.Float)),
                new CProfileGraphDesc("/DrawCalls/", new ProfileGraphLeafDesc("totalDrawCallCount", EItemType.Int)),
                new CProfileGraphDesc("/NetworkProfile/", new ProfileGraphLeafDesc("totalBits", EItemType.Int)),
                new CProfileGraphDesc("/TexStrm/", new ProfileGraphLeafDesc("requiredMB", EItemType.Float), new ProfileGraphLeafDesc("mip", EItemType.Float)),
                new CProfileGraphDesc("/TexPools/", new ProfileGraphLeafDesc("n", EItemType.Int)),
                new CProfileGraphDesc("/SoundInfo/", new ProfileGraphLeafDesc("count", EItemType.Int)),
                new CProfileGraphDesc("/ObjMan/", new ProfileGraphLeafDesc("sizeKB", EItemType.Float)),
                new COverviewGraphDesc("/**")
            };

            m_viewPaths.AddPath(logControl.m_prdiTree.LeafPath);
        }