Skip to content

Commit

Permalink
fixed csv headers of custom labels
Browse files Browse the repository at this point in the history
  • Loading branch information
arlotito committed Oct 27, 2021
1 parent 7741b51 commit 77a7b40
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions source/IotEdgePerf.Analysis/Analysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,14 @@ public string GetCsvHeader()
csvRow += String.Format($"DeviceEgressThroughputKBs,");
csvRow += String.Format($"IotHubIngressThroughputKBs,");
csvRow += String.Format($"DeviceToIotHubAvgLatency,DeviceToIotHubMinLatency,DeviceToIotHubMaxLatency,");
csvRow += String.Format($"DeviceAvgTransmissionDuration,DeviceMinTransmissionDuration,DeviceMaxTransmissionDuration,");
csvRow += String.Format($"CustomLabel");
csvRow += String.Format($"DeviceAvgTransmissionDuration,DeviceMinTransmissionDuration,DeviceMaxTransmissionDuration");

int cnt=1;
foreach (var field in CustomLabel.Split(','))
{
csvRow += String.Format($",CustomLabel{cnt++}");
}

csvRow += String.Format($"\n");

return csvRow;
Expand Down Expand Up @@ -241,15 +247,7 @@ public void DoAnalysis(string sessionId)
group item by (item.sessionId, item.burstCounter) into sessionGroup
orderby sessionGroup.Key ascending
select sessionGroup;


// if needed, creates file with header
if (!String.IsNullOrEmpty(this._csvFilename))
{
if (!File.Exists(this._csvFilename))
File.AppendAllText(_csvFilename, new BurstAnalysisData().GetCsvHeader());
}


// perform analysis
foreach (var sessionGroup in query)
{
Expand Down Expand Up @@ -331,6 +329,9 @@ orderby sessionGroup.Key ascending
// saves to CSV file
if (!String.IsNullOrEmpty(this._csvFilename))
{
if (!File.Exists(this._csvFilename))
File.AppendAllText(_csvFilename, burstAnalysisData.GetCsvHeader());

File.AppendAllText(_csvFilename, burstAnalysisData.ToCsvString());
}
}
Expand Down

0 comments on commit 77a7b40

Please sign in to comment.