Files
UnrealEngineUWP/Engine/Source/Programs/CSVTools/PerfReportTool/Summaries/EventSummary.cs
ben woodhouse 5fbb76f7c2 PerfReportTool 4.76 : Add support for unstripped stats in FPSCharts.
- FPSChart stats can now be tagged as unstripped. Add "unstripped" in the stat bracket parameters, space-separated to enable, e.g MemFreeMB (min unstripped).
- Simplify column handling code
- Don't generate CsvToSvg commandline args if we're not running as a separate process

Note: The unstripped parameter does not affect the column name. E.g MemFreeMB(Min Unstripped) will be output as MemFreeMB Min.

#ROBOMERGE-AUTHOR: ben.woodhouse
#ROBOMERGE-SOURCE: CL 20315540 via CL 20315544 via CL 20315547
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v948-20297126)

[CL 20315662 by ben woodhouse in ue5-main branch]
2022-05-22 16:34:09 -04:00

94 lines
2.6 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using PerfReportTool;
using CSVStats;
namespace PerfSummaries
{
class EventSummary : Summary
{
public EventSummary(XElement element, string baseXmlDirectory)
{
title = element.GetSafeAttibute("title", "Events");
summaryStatName = element.Attribute("summaryStatName").Value;
events = element.Element("events").Value.Split(',');
colourThresholds = ReadColourThresholdsXML(element.Element("colourThresholds"));
}
public EventSummary() { }
public override string GetName() { return "event"; }
public override void WriteSummaryData(System.IO.StreamWriter htmlFile, CsvStats csvStats, CsvStats csvStatsUnstripped, bool bWriteSummaryCsv, SummaryTableRowData rowData, string htmlFileName)
{
Dictionary<string, int> eventCountsDict = new Dictionary<string, int>();
int eventCount = 0;
foreach (CsvEvent ev in csvStats.Events)
{
foreach (string eventName in events)
{
if (CsvStats.DoesSearchStringMatch(ev.Name, eventName))
{
int len = eventName.Length;
if (eventName.EndsWith("*"))
{
len--;
}
string eventContent = ev.Name.Substring(len).Trim();
if (eventCountsDict.ContainsKey(eventContent))
{
eventCountsDict[eventContent]++;
}
else
{
eventCountsDict.Add(eventContent, 1);
}
eventCount++;
}
}
}
// Output HTML
if (htmlFile != null && eventCountsDict.Count > 0)
{
htmlFile.WriteLine(" <h2>" + title + "</h2>");
htmlFile.WriteLine(" <table border='0' style='width:1200'>");
htmlFile.WriteLine(" <tr><th>Name</th><th><b>Count</th></tr>");
foreach (KeyValuePair<string, int> pair in eventCountsDict.ToList())
{
htmlFile.WriteLine(" <tr><td>" + pair.Key + "</td><td>" + pair.Value + "</td></tr>");
}
htmlFile.WriteLine(" </table>");
}
// Output summary table row data
if (rowData != null)
{
ColourThresholdList thresholdList = null;
if (colourThresholds != null)
{
thresholdList = new ColourThresholdList();
for (int i = 0; i < colourThresholds.Length; i++)
{
thresholdList.Add(new ThresholdInfo(colourThresholds[i]));
}
}
rowData.Add(SummaryTableElement.Type.SummaryTableMetric, summaryStatName, (double)eventCount, thresholdList);
}
}
public override void PostInit(ReportTypeInfo reportTypeInfo, CsvStats csvStats)
{
}
string[] events;
double[] colourThresholds;
string title;
string summaryStatName;
};
}