public LogParser(ILogDataStream logDataStream, LogData logData) { m_logDataStream = logDataStream; m_logData = logData; }
FPSBucketsRemotePage CreateFPSBucketsPage(PageMetaData pageMetaData, LogData logData) { RemotePage page = GetPage(pageMetaData.m_title, pageMetaData.m_parentTitle, pageMetaData.m_space); return(new FPSBucketsRemotePage(page, logData, pageMetaData.m_contentMetaData)); }
StatisticsRemotePage CreateStatisticsPage(PageMetaData pageMetaData, LogData logData, string [] groups) { RemotePage page = GetPage(pageMetaData.m_title, pageMetaData.m_parentTitle, pageMetaData.m_space); return(new StatisticsRemotePage(page, logData, pageMetaData.m_contentMetaData, groups)); }
public ConfluenceService(LogData logData) { m_soapService = new ConfluenceSoapServiceService(); m_logData = logData; m_username = ""; }
public void UploadStatsDataPage(PageMetaData pageMetaData, LogData logData, string [] groups, XmlNodeList metrics, bool upload) { StatisticsRemotePage page = CreateStatisticsPage(pageMetaData, logData, groups); if (upload) { GroupsStats stats = new GroupsStats(); logData.GetFrameGroupData(0, logData.FrameRecords.Count - 1, groups, stats); Random random = new Random(); foreach (string group in stats.m_groupStats.Keys) { page.m_page.content += "\n\n"; GroupItemStats groupsStats = stats.GetGroupItemsStats(group); foreach (string item in groupsStats.m_groupItemStats.Keys) { float target = 0.0f; float max = 0.0f; float min = 0.0f; float fail = 0.0f; string path = "/" + group + "/" + item; string units = ""; // logData.FrameRecords[0].m_units[path]; foreach (XmlNode node in metrics) { XmlNode attribute = node.Attributes.GetNamedItem("name"); if (attribute.Value == item) { XmlNode metricNode = node.ChildNodes.Item(0); if (metricNode != null) { if (metricNode.Attributes.GetNamedItem("target") != null) { target = (float)int.Parse(metricNode.Attributes.GetNamedItem("target").Value); } if (metricNode.Attributes.GetNamedItem("heatMax") != null) { max = (float)int.Parse(metricNode.Attributes.GetNamedItem("heatMax").Value) + target; } if (metricNode.Attributes.GetNamedItem("heatMin") != null) { min = (float)int.Parse(metricNode.Attributes.GetNamedItem("heatMin").Value); } if (metricNode.Attributes.GetNamedItem("failure") != null) { fail = (float)int.Parse(metricNode.Attributes.GetNamedItem("failure").Value) + target; } break; } } } Stats statitem = groupsStats.GetItemStats(item); page.m_page.content += "+*Statistic*: {color:blue}" + group + " - " + item + "{color}+\n\n"; page.AddStatOverview(Math.Max(0.0f, statitem.m_min), Math.Max(0.0f, statitem.m_max), Math.Max(0.0f, statitem.m_avg), max, target); page.StartCanvasSection(random.Next()); page.AddTimeLineGraph(group, item, statitem, max, target, units); page.EndCanvasSection(); } } } StorePage(page.m_page); AddAttachment(Compress(pageMetaData.m_contentMetaData.m_logFilename), pageMetaData.m_title, pageMetaData.m_parentTitle, pageMetaData.m_space, "Statoscope Log"); }
static void UploadStatsPages(ConfluenceService confluence, LogData logData, string[] groups, string spaceName, string rootPageName, string platformPageName, string buildPageName, XmlNodeList metrics, bool uploadSummary, string logfile) { try { List <ConfluenceSOAP.RemoteSpaceSummary> spaces = confluence.GetSpaces(); bool spaceExists = false; bool rootPageExists = false; bool platformPageExists = false; bool buildPageExists = false; foreach (ConfluenceSOAP.RemoteSpaceSummary space in spaces) { if (space.key == spaceName) { spaceExists = true; break; } } if (!spaceExists) { confluence.CreateSpace(spaceName); } List <ConfluenceSOAP.RemotePageSummary> pages = confluence.GetPages(spaceName); foreach (ConfluenceSOAP.RemotePageSummary page in pages) { if (page.title == rootPageName) { rootPageExists = true; } if (page.title == platformPageName) { platformPageExists = true; } if (page.title == buildPageName) { buildPageExists = true; } } if (!rootPageExists) { confluence.CreatePage(rootPageName, spaceName); } if (!platformPageExists) { confluence.CreatePage(platformPageName, rootPageName, spaceName); } if (!buildPageExists) { confluence.CreatePage(buildPageName, platformPageName, spaceName); } string timeDateString = DateTime.Now.ToString("dd/MM/yy hh:mm:ss \\(\\U\\T\\Cz\\)"); ConfluenceService.PageContentMetaData pageContentMD = new ConfluenceService.PageContentMetaData(timeDateString, logData.Name, logData.BuildInfo.PlatformString, logData.BuildInfo.BuildNumberString, "", confluence.m_username, "automated build system", false); ConfluenceService.PageMetaData pageMetaData = new ConfluenceService.PageMetaData(spaceName, buildPageName, platformPageName, pageContentMD); confluence.UploadStatsDataPage(pageMetaData, logData, groups, metrics, uploadSummary); foreach (FrameRecordRange frr in logData.LevelRanges) { LogData levelLogData = new LogData(logData, frr); pageContentMD.m_levelName = levelLogData.Name; ConfluenceService.PageMetaData levelPageMD = new ConfluenceService.PageMetaData(spaceName, levelLogData.Name + " - " + buildPageName, buildPageName, pageContentMD); confluence.UploadStatsDataPage(levelPageMD, levelLogData, groups, metrics, true); } } catch (Exception ex) { Console.WriteLine("Something went wrong! :(\n\n" + ex.ToString() + Environment.NewLine + "Stack trace: " + ex.StackTrace); System.Environment.Exit(3); } }
private void UploadButton_Click(object sender, EventArgs e) { try { string spaceName = SpaceComboBox.Text; if (m_spaces.ContainsKey(spaceName)) { spaceName = m_spaces[spaceName].key; } else { m_confluenceService.CreateSpace(spaceName); } string rootPageName = RootPageComboBox.Text; if (!m_pages.ContainsKey(rootPageName)) { m_confluenceService.CreatePage(rootPageName, spaceName); } string platformPageName = PlatformComboBox.Text; if (!m_pages.ContainsKey(platformPageName)) { m_confluenceService.CreatePage(platformPageName, rootPageName, spaceName); } string buildPageName = BuildComboBox.Text; if (!m_pages.ContainsKey(buildPageName)) { m_confluenceService.CreatePage(buildPageName, platformPageName, spaceName); } string timeDateString = DateTime.Now.ToString("dd/MM/yy hh:mm:ss \\(\\U\\T\\Cz\\)"); ConfluenceService.PageContentMetaData pageContentMD = new ConfluenceService.PageContentMetaData( timeDateString, m_logData.Name, m_logData.BuildInfo.PlatformString, m_logData.BuildInfo.BuildNumberString, "", m_confluenceService.m_username, BuildInfoTextBox.Text, AppendRadioButton.Checked); ConfluenceService.PageMetaData pageMetaData = new ConfluenceService.PageMetaData(spaceName, buildPageName, platformPageName, pageContentMD); if (IncludeOverallCheckBox.Checked) { m_confluenceService.UploadFPSDataPage(pageMetaData, m_logData, m_logFilePath); } foreach (FrameRecordRange frr in m_logData.LevelRanges) { if (LevelsCheckedListBox.CheckedItems.Contains(frr.Name)) { LogData levelLogData = new LogData(m_logData, frr); levelLogData.CalculateBucketSets(); pageContentMD.m_levelName = levelLogData.Name; ConfluenceService.PageMetaData levelPageMD = new ConfluenceService.PageMetaData(spaceName, levelLogData.Name + " - " + buildPageName, buildPageName, pageContentMD); m_confluenceService.UploadFPSDataPage(levelPageMD, levelLogData, m_logFilePath); } } Close(); } catch (Exception ex) { MessageBox.Show("Something went wrong! :(\n\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static bool UploadConfluenceData(string settingsfile, string logfile, string[] groups, string platform, string buildid, string metrics, bool uploadSummary) { string username = string.Empty; string password = string.Empty; string space = string.Empty; string parent = string.Empty; string pagepostfix = string.Empty; try { StreamReader stream = new StreamReader(settingsfile); XmlDocument xmlDoc = new XmlDocument(); String xmlstring = stream.ReadToEnd(); stream.Close(); xmlDoc.LoadXml(xmlstring); XmlNode settings = xmlDoc.SelectSingleNode("/settings"); stream = new StreamReader(metrics); xmlDoc = new XmlDocument(); xmlstring = stream.ReadToEnd(); stream.Close(); xmlDoc.LoadXml(xmlstring); XmlNodeList metricNodes = xmlDoc.SelectNodes("//metrics"); foreach (XmlAttribute attrib in settings.Attributes) { if (attrib.Name == "username") { username = attrib.Value; } if (attrib.Name == "password") { password = attrib.Value; } if (attrib.Name == "space") { space = attrib.Value; } if (attrib.Name == "parent") { parent = attrib.Value; } if (attrib.Name == "pageuniqueid") { pagepostfix = attrib.Value; } } FileLogProcessor logProcessor = new FileLogProcessor(logfile); LogData logData = logProcessor.ProcessLog(); if (platform == string.Empty) { platform = logData.BuildInfo.PlatformString + " - Auto-testing Statistics - "; } if (buildid == string.Empty) { buildid = logData.BuildInfo.BuildNumberString + " - Auto-testing Statistics - "; } platform += pagepostfix; buildid += pagepostfix; ConfluenceService confluence = new ConfluenceService(logData); if (confluence.TryLogin(true, username, password)) { UploadStatsPages(confluence, logData, groups, space, parent, platform, buildid, metricNodes, uploadSummary, logfile); } } catch (System.Exception ex) { Console.WriteLine("Error: " + ex.Message + System.Environment.NewLine + "Stack: " + ex.StackTrace + System.Environment.NewLine); System.Environment.Exit(2); } return(true); }
static bool WriteXMLForLog(string logFilename, string[] groups) { FileLogProcessor logProcessor = new FileLogProcessor(logFilename); LogData logData = logProcessor.ProcessLog(); XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = (" "); char[] delims = { '.' }; string[] fileNameElements = logFilename.Split(delims); if (fileNameElements.Length < 2) { Console.WriteLine("Input file name not parseable {0} : Canceling XML Write", logFilename); return(false); } string outputFile = fileNameElements[0] + ".xml"; Console.WriteLine("Writing XML output: {0}", outputFile); using (XmlWriter writer = XmlWriter.Create(outputFile, settings)) { writer.WriteStartElement("testsuites"); CultureInfo decimalCulture = new CultureInfo("en-US"); UserMarkerLocation currentStartMarker = null; writer.WriteStartElement("testsuite"); writer.WriteAttributeString("name", "BasicPerformance"); foreach (FrameRecord fr in logData.FrameRecords) { foreach (UserMarkerLocation markerLocation in fr.UserMarkers) { if (markerLocation.m_name.Split(' ')[0].EndsWith("_start")) { if (currentStartMarker != null) { //Warn about unmatched start marker Console.WriteLine("Warning: Performance Marker End Not Found For {0} at frame index: {1} : Skipping", currentStartMarker.m_name, currentStartMarker.m_fr.Index); } currentStartMarker = markerLocation; continue; } if (markerLocation.m_name.EndsWith("_end")) { if (currentStartMarker == null) { //Warn and skip if we didn't have a start marker we were looking for Console.WriteLine("Warning: Performance Marker End Found With No Matching Start For {0} at frame index: {1} : Skipping", currentStartMarker != null ? currentStartMarker.m_name : "invalid start marker", currentStartMarker != null ? currentStartMarker.m_fr.Index : 0); continue; } string markerNameStart = currentStartMarker.m_name.Replace("_start", "").Split(' ')[0]; string markerExportName = currentStartMarker.m_name.Replace("_start", ""); string markerNameEnd = markerLocation.m_name.Replace("_end", ""); if (markerNameStart != markerNameEnd) { Console.WriteLine("Warning: Performance Marker End: {0} Does not Match Start Marker {1}: Skipping", markerNameStart, markerNameEnd); currentStartMarker = null; continue; } int startIdx = currentStartMarker.m_fr.Index; int endIdx = markerLocation.m_fr.Index; currentStartMarker = null; writer.WriteStartElement("phase"); writer.WriteAttributeString("name", markerExportName); writer.WriteAttributeString("duration", (logData.FrameRecords[endIdx].FrameTimeInS - logData.FrameRecords[startIdx].FrameTimeInS).ToString(decimalCulture)); { float minFrameTime, maxFrameTime, avgFrameTime; logData.GetFrameTimeData(startIdx, endIdx, out minFrameTime, out maxFrameTime, out avgFrameTime); writer.WriteStartElement("metrics"); writer.WriteAttributeString("name", "frameTimes"); writer.WriteStartElement("metric"); writer.WriteAttributeString("name", "min"); writer.WriteAttributeString("value", minFrameTime.ToString(decimalCulture)); writer.WriteEndElement(); writer.WriteStartElement("metric"); writer.WriteAttributeString("name", "max"); writer.WriteAttributeString("value", maxFrameTime.ToString(decimalCulture)); writer.WriteEndElement(); writer.WriteStartElement("metric"); writer.WriteAttributeString("name", "avg"); writer.WriteAttributeString("value", avgFrameTime.ToString(decimalCulture)); writer.WriteEndElement(); writer.WriteEndElement(); } writer.WriteEndElement(); } } } //End testsuite block writer.WriteEndElement(); if (groups != null) { currentStartMarker = null; writer.WriteStartElement("testsuite"); writer.WriteAttributeString("name", "GroupStatistics"); foreach (FrameRecord fr in logData.FrameRecords) { foreach (UserMarkerLocation markerLocation in fr.UserMarkers) { if (markerLocation.m_name.Split(' ')[0].EndsWith("_start")) { if (currentStartMarker != null) { //Warn about unmatched start marker Console.WriteLine("Warning: Performance Marker End Not Found For {0} at frame index: {1} : Skipping", currentStartMarker.m_name, currentStartMarker.m_fr.Index); } currentStartMarker = markerLocation; continue; } if (markerLocation.m_name.EndsWith("_end")) { if (currentStartMarker == null) { //Warn and skip if we didn't have a start marker we were looking for Console.WriteLine("Warning: Performance Marker End Found With No Matching Start For {0} at frame index: {1} : Skipping", currentStartMarker != null ? currentStartMarker.m_name : "invalid start marker", currentStartMarker != null ? currentStartMarker.m_fr.Index : 0); continue; } string markerNameStart = currentStartMarker.m_name.Replace("_start", "").Split(' ')[0]; string markerExportName = currentStartMarker.m_name.Replace("_start", ""); string markerNameEnd = markerLocation.m_name.Replace("_end", ""); if (markerNameStart != markerNameEnd) { Console.WriteLine("Warning: Performance Marker End: {0} Does not Match Start Marker {1}: Skipping", markerNameStart, markerNameEnd); currentStartMarker = null; continue; } int startIdx = currentStartMarker.m_fr.Index; int endIdx = markerLocation.m_fr.Index; currentStartMarker = null; writer.WriteStartElement("phase"); writer.WriteAttributeString("name", markerExportName); writer.WriteAttributeString("duration", (logData.FrameRecords[endIdx].FrameTimeInS - logData.FrameRecords[startIdx].FrameTimeInS).ToString(decimalCulture)); { GroupsStats stats = new GroupsStats(); logData.GetFrameGroupData(startIdx, endIdx, groups, stats); foreach (string group in stats.m_groupStats.Keys) { GroupItemStats groupsStats = stats.GetGroupItemsStats(group); foreach (string item in groupsStats.m_groupItemStats.Keys) { Stats itemStats = groupsStats.GetItemStats(item); writer.WriteStartElement("metrics"); writer.WriteAttributeString("name", item); writer.WriteStartElement("metric"); writer.WriteAttributeString("name", "min"); writer.WriteAttributeString("value", itemStats.m_min.ToString(decimalCulture)); writer.WriteEndElement(); writer.WriteStartElement("metric"); writer.WriteAttributeString("name", "max"); writer.WriteAttributeString("value", itemStats.m_max.ToString(decimalCulture)); writer.WriteEndElement(); writer.WriteStartElement("metric"); writer.WriteAttributeString("name", "avg"); writer.WriteAttributeString("value", itemStats.m_avg.ToString(decimalCulture)); writer.WriteEndElement(); writer.WriteEndElement(); } } } writer.WriteEndElement(); } } } //End testsuite block writer.WriteEndElement(); } //End testsuites block writer.WriteEndElement(); writer.Flush(); return(true); } }
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); }
protected override void glDraw() { while (true) { KeyValuePair <Image, GLTexture> req; lock (m_thumbnailComplete) { if (m_thumbnailComplete.Count == 0) { break; } req = m_thumbnailComplete[0]; m_thumbnailComplete.RemoveAt(0); } if (req.Key != null) { req.Value.Update((Bitmap)req.Key); req.Key.Dispose(); } } if (m_logViews.Count > 0) { LogView lv = m_logViews[0]; LogData ld = lv.m_logData; if (m_remakeTree) { VirtualBounds = new RectD(0, 0, 1, 1); View = new RectD(0, 0, 1, 1); TreemapNode rootNode = CreateTree(); FrameRecord fr = m_frameRecord; if (fr != null) { lock (ld) { List <RDIElementValue <ProfilerRDI> > children = new List <RDIElementValue <ProfilerRDI> >(); float totalSize = 0; foreach (RDIElementValue <ProfilerRDI> prdiEv in m_logControl.m_prdiTree.GetValueEnumerator(fr)) { float size = prdiEv.m_value; if (size == 0.0f) { continue; } children.Add(prdiEv); totalSize += size; } rootNode.Name = String.Format("{0} MB", totalSize); children.Sort((a, b) => - a.m_value.CompareTo(b.m_value)); foreach (RDIElementValue <ProfilerRDI> ev in children) { float size = ev.m_value; string path = ev.m_rdi.Path; int sep = path.LastIndexOf('/'); GLTexture tex = null; if (path.StartsWith("/TexStrm/")) { string texturepath = path.Substring("/TexStrm/".Length).Replace(".dds", ".tif"); tex = RequestThumbnail(texturepath, -size); } TreemapNode child = CreateChild(rootNode); child.Size = size / totalSize; child.Name = (sep >= 0) ? path.Substring(sep + 1) : path; child.Tag = ev; child.Texture = tex; } } } VirtualBounds = new RectD(0, 0, 1, 1); View = new RectD(0, 0, 1, 1); m_remakeTree = false; } } base.glDraw(); }
public LogRange(LogData logData, FrameRecordRange frr) { m_logData = logData; m_frr = frr; }