From 6e7ba5654e64c537354830177d4d0958f3e47602 Mon Sep 17 00:00:00 2001
From: Adeel <3840695+am11@users.noreply.github.com>
Date: Tue, 16 Apr 2024 01:34:21 +0300
Subject: [PATCH 1/2] Upgrade GCLogParser to NetCoreAppToolCurrent
---
src/coreclr/tools/GCLogParser/App.config | 6 -
.../GCLogParser/Properties/AssemblyInfo.cs | 36 ---
src/coreclr/tools/GCLogParser/parse-hb-log.cs | 240 +++++++++---------
.../tools/GCLogParser/parse-hb-log.csproj | 67 +----
4 files changed, 128 insertions(+), 221 deletions(-)
delete mode 100644 src/coreclr/tools/GCLogParser/App.config
delete mode 100644 src/coreclr/tools/GCLogParser/Properties/AssemblyInfo.cs
diff --git a/src/coreclr/tools/GCLogParser/App.config b/src/coreclr/tools/GCLogParser/App.config
deleted file mode 100644
index c8f375802e873..0000000000000
--- a/src/coreclr/tools/GCLogParser/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/coreclr/tools/GCLogParser/Properties/AssemblyInfo.cs b/src/coreclr/tools/GCLogParser/Properties/AssemblyInfo.cs
deleted file mode 100644
index b08b750df856e..0000000000000
--- a/src/coreclr/tools/GCLogParser/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("parse-hb-log")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("parse-hb-log")]
-[assembly: AssemblyCopyright("Copyright \u00A9 2019")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("6ae26cd6-c971-48d6-8c03-2ffa272b942c")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/coreclr/tools/GCLogParser/parse-hb-log.cs b/src/coreclr/tools/GCLogParser/parse-hb-log.cs
index 2f0b5888f1c1e..365c19c69f672 100644
--- a/src/coreclr/tools/GCLogParser/parse-hb-log.cs
+++ b/src/coreclr/tools/GCLogParser/parse-hb-log.cs
@@ -1,4 +1,7 @@
-// parse-hb-log.exe -ia 1 -l gclog.pid.log
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+// parse-hb-log.exe -ia 1 -l gclog.pid.log
// where gclog.pid.log is the log you get from GC with HEAP_BALANCE_LOG. See
// comments for it in gcpriv.h
//
@@ -36,19 +39,20 @@
using System;
using System.Collections.Generic;
-using System.Text;
using System.IO;
using System.Linq;
+using System.Text;
namespace parse_hb_log
{
- enum HeapBalanceFlagMask
+ file enum HeapBalanceFlagMask
{
MutipleProcs = 0xf,
EnterDueToProc = 0xf0,
SetIdeal = 0xf00,
};
- struct SampleInfo
+
+ file struct SampleInfo
{
// -1 means uninit.
public int tid;
@@ -70,17 +74,18 @@ public SampleInfo(int _tid, int _allocHeap, int _countSamples, int _flags, int _
}
};
- enum PassOneViewType
+ file enum PassOneViewType
{
Thread = 0,
AllocHeap = 1,
MaxType = 2
};
- class Program
+
+ file sealed class Program
{
- static bool fLogging = false;
+ private static bool fLogging = false;
- static string ParseString(string str, string strStart, string strEnd, out string strRemaining)
+ private static string ParseString(string str, string strStart, string strEnd, out string strRemaining)
{
int startIndex = 0;
if (strStart != null)
@@ -98,7 +103,7 @@ static string ParseString(string str, string strStart, string strEnd, out string
//string strRest = str.Substring(startIndex + strStart.Length);
string strRest = str.Substring(startIndex);
- string strRet = null;
+ string strRet;
//Console.WriteLine(strRest);
if (strEnd == null)
{
@@ -116,39 +121,39 @@ static string ParseString(string str, string strStart, string strEnd, out string
return strRet;
}
- static StreamWriter swPassZero = null;
- static string strPassZeroLog = "pass-zero.txt";
- static int totalProcs = 0;
- static int totalNodes = 0;
- static int procsPerNode = 0;
+ private static StreamWriter swPassZero = null;
+ private static string strPassZeroLog = "pass-zero.txt";
+ private static int totalProcs = 0;
+ private static int totalNodes = 0;
+ private static int procsPerNode = 0;
// this is qpf / 1000 so we calculate ms instead of s.
- static UInt64 qpfAdjusted = 0;
+ private static ulong qpfAdjusted = 0;
// we log the current qpc so subtract by this.
- static UInt64 qpcStart = 0;
- static Int32 totalAllocThreads = 0;
- static Dictionary threadMapping = new Dictionary(112);
+ private static ulong qpcStart = 0;
+ private static int totalAllocThreads = 0;
+ private static Dictionary threadMapping = new Dictionary(112);
// We do compress the samples, this stores the aggregated sample counts for all procs.
- static int[] aggregatedSampleCount = null;
+ private static int[] aggregatedSampleCount = null;
- static int timeUnitMS = 1;
+ private static int timeUnitMS = 1;
// We wanna compress the log by compressing the samples in the same unit of time.
// We get samples by procs, so on the same proc if we observe the same thread
// allocating on the same alloc heap in the same time unit we simply count the total
// samples. However we do want to remember if any of the p/m/i is set.
- static string strLastTID = null;
- static string strTID = null;
- static string strLastThreadAllocHeap = null;
- static string strAllocHeap = null;
- static string strIdealProc = null;
- static int lastTimeUnit = 0;
- static int lastThreadSampleCount = 0;
- static int lastThreadPCount = 0;
- static int lastThreadMCount = 0;
- static int lastThreadICount = 0;
- static int lastProcIndex = -1;
- static int largestTimeInBetweenGCs = 0;
-
- static void InitSampleInfoPassZero()
+ private static string strLastTID = null;
+ private static string strTID = null;
+ private static string strLastThreadAllocHeap = null;
+ private static string strAllocHeap = null;
+ private static string strIdealProc = null;
+ private static int lastTimeUnit = 0;
+ private static int lastThreadSampleCount = 0;
+ private static int lastThreadPCount = 0;
+ private static int lastThreadMCount = 0;
+ private static int lastThreadICount = 0;
+ private static int lastProcIndex = -1;
+ private static int largestTimeInBetweenGCs = 0;
+
+ private static void InitSampleInfoPassZero()
{
strLastTID = null;
strTID = null;
@@ -161,7 +166,7 @@ static void InitSampleInfoPassZero()
lastThreadICount = 0;
}
- static void LogPassZeroAggregatedSample(int _lastTimeUnit, int _tid, int _sampleCount, string _strAllocHeap)
+ private static void LogPassZeroAggregatedSample(int _lastTimeUnit, int _tid, int _sampleCount, string _strAllocHeap)
{
swPassZero.WriteLine("{0}ms,{1}({2}),{3},m:{4},p:{5},i:{6}({7})",
_lastTimeUnit,
@@ -177,7 +182,7 @@ static void LogPassZeroAggregatedSample(int _lastTimeUnit, int _tid, int _sample
// Aside from writing out a new log this also prints out some stats for further processing:
// How many samples are observed on each proc. Because we could use this for many proc analysis,
// it's impractical to have a wide enough window to display all procs.
- static void PassZero(string strLog)
+ private static void PassZero(string strLog)
{
swPassZero = new StreamWriter(strPassZeroLog);
string strTemp, strRemaining;
@@ -187,7 +192,7 @@ static void PassZero(string strLog)
while ((s = sr.ReadLine()) != null)
{
- if (s.StartsWith("["))
+ if (s.StartsWith('['))
{
string strAfterTID = ParseString(s, "]", null, out strRemaining);
//Console.WriteLine(s);
@@ -196,18 +201,18 @@ static void PassZero(string strLog)
{
// [15900]qpf=10000000, start: 17262240813778(1726224081)
strTemp = ParseString(s, "qpf=", ",", out strRemaining);
- qpfAdjusted = UInt64.Parse(strTemp) / 1000;
+ qpfAdjusted = ulong.Parse(strTemp) / 1000;
strTemp = ParseString(strRemaining, "start:", "(", out strRemaining);
- qpcStart = UInt64.Parse(strTemp);
+ qpcStart = ulong.Parse(strTemp);
Console.WriteLine("QPF adjusted: {0}, init QPC: {1}", qpfAdjusted, qpcStart);
}
else if (strAfterTID.StartsWith("total: "))
{
// [15900]total: 112, numa: 2
strTemp = ParseString(strAfterTID, "total: ", ",", out strRemaining);
- totalProcs = Int32.Parse(strTemp);
+ totalProcs = int.Parse(strTemp);
strTemp = ParseString(strRemaining, "numa: ", null, out strRemaining);
- totalNodes = Int32.Parse(strTemp);
+ totalNodes = int.Parse(strTemp);
Console.WriteLine("total procs: {0}, nodes: {1}", totalProcs, totalNodes);
procsPerNode = totalProcs / totalNodes;
swPassZero.WriteLine("P: {0}, N: {1}", totalProcs, totalNodes);
@@ -260,7 +265,7 @@ static void PassZero(string strLog)
//Console.WriteLine(strAfterTID);
swPassZero.WriteLine(strAfterTID);
strTemp = ParseString(strAfterTID, "p", "]", out strRemaining);
- lastProcIndex = Int32.Parse(strTemp);
+ lastProcIndex = int.Parse(strTemp);
}
else if (strAfterTID.StartsWith("[GCA#"))
{
@@ -272,11 +277,11 @@ static void PassZero(string strLog)
// convert the raw ts to relative ms.
strTemp = ParseString(strAfterTID, "-", "-", out strRemaining);
//Console.WriteLine("min ts is {0}", strTemp);
- UInt64 minTimestampMS = UInt64.Parse(strTemp);
+ ulong minTimestampMS = ulong.Parse(strTemp);
minTimestampMS /= qpfAdjusted;
strTemp = ParseString(strRemaining, "-", "]", out strRemaining);
//Console.WriteLine("max ts is {0}", strTemp);
- UInt64 maxTimestampMS = UInt64.Parse(strTemp);
+ ulong maxTimestampMS = ulong.Parse(strTemp);
maxTimestampMS /= qpfAdjusted;
strTemp = ParseString(strAfterTID, null, "-", out strRemaining);
swPassZero.WriteLine("{0}-{1}-{2}", strTemp, minTimestampMS, maxTimestampMS);
@@ -320,8 +325,8 @@ static void PassZero(string strLog)
//
strTemp = ParseString(s, "]", ",", out strRemaining);
//UInt64 currentQPC = UInt64.Parse(strTemp);
- UInt64 currentQPC = 0;
- if (!UInt64.TryParse(strTemp, out currentQPC))
+ ulong currentQPC = 0;
+ if (!ulong.TryParse(strTemp, out currentQPC))
{
continue;
}
@@ -339,6 +344,7 @@ static void PassZero(string strLog)
{
Console.WriteLine(s);
}
+
if (!threadMapping.ContainsKey(strTID))
{
threadMapping.Add(strTID, totalAllocThreads);
@@ -355,14 +361,14 @@ static void PassZero(string strLog)
bool alloc_count_p = true;
bool set_ideal_p = false;
- if (strRemaining.Contains("|"))
+ if (strRemaining.Contains('|'))
{
strAllocHeap = ParseString(strRemaining, ",", "|", out strRemaining);
- if (strRemaining.Contains("m"))
+ if (strRemaining.Contains('m'))
multiple_procs_p = true;
- if (strRemaining.Contains("p"))
+ if (strRemaining.Contains('p'))
alloc_count_p = false;
- if (strRemaining.Contains("i"))
+ if (strRemaining.Contains('i'))
set_ideal_p = true;
}
else
@@ -495,45 +501,45 @@ static void PassZero(string strLog)
//=========================================================================
// Pass one. TODO: should separate this from pass zero.
//=========================================================================
- static StreamWriter[] swPassOneFiles = null;
+ private static StreamWriter[] swPassOneFiles = null;
// It's difficult to print all of the procs on one line so we only print per node.
- static int nodeIndexToPrint = -1;
- static bool fIncludeAllTime = false;
- static bool fPrintThreadInfoPerTimeUnit = false;
+ private static int nodeIndexToPrint = -1;
+ private static bool fIncludeAllTime = false;
+ private static bool fPrintThreadInfoPerTimeUnit = false;
// This represents the samples for all the procs inbetween GCs so it doesn't grow very large.
// Cleared every GC.
- static SampleInfo[][] samples;
+ private static SampleInfo[][] samples;
// This is the min/max time for inbetween each GC.
- static int startTimeMS = 0;
- static int endTimeMS = 0;
- static int currentProcIndex = -1;
- static int lastTimeIndex = -1;
+ private static int startTimeMS = 0;
+ private static int endTimeMS = 0;
+ private static int currentProcIndex = -1;
+ private static int lastTimeIndex = -1;
// This respresents the threads we see in samples so we can get info such as when threads
// start running and how active they are.
// Cleared every GC.
- static List threadsSeenPerTimeUnit = new List(56);
- static Dictionary threadsSeen = new Dictionary(56);
- static Dictionary threadsSeenTotal = new Dictionary(56);
- static List threadsToPrint = new List(8);
- static string strThreadIndices = null;
- static int gcIndexToPrintStart = -1;
- static int gcIndexToPrintEnd = 1000000;
- static string strGCRange = null;
- static int totalGCCount = 0;
- static int totalGCDurationMS = 0;
- static int totalAllocMB = 0;
- static int totalBudgetMB = 0;
+ private static List threadsSeenPerTimeUnit = new List(56);
+ private static Dictionary threadsSeen = new Dictionary(56);
+ private static Dictionary threadsSeenTotal = new Dictionary(56);
+ private static List threadsToPrint = new List(8);
+ private static string strThreadIndices = null;
+ private static int gcIndexToPrintStart = -1;
+ private static int gcIndexToPrintEnd = 1000000;
+ private static string strGCRange = null;
+ private static int totalGCCount = 0;
+ private static int totalGCDurationMS = 0;
+ private static int totalAllocMB = 0;
+ private static int totalBudgetMB = 0;
// This represents allocated MB on each heap; parse from the lines following [GC_alloc_mb]
- static int[] AllocMB;
- static int budgetMB = 0;
+ private static int[] AllocMB;
+ private static int budgetMB = 0;
// These are subscript chars for 0-9.
- static char[] unicodeChars = { '\x2080', '\x2081', '\x2082', '\x2083', '\x2084', '\x2085', '\x2086', '\x2087', '\x2088', '\x2089' };
- static string[] passOneFileTypes = { "thread", "alloc" };
+ private static char[] unicodeChars = ['\x2080', '\x2081', '\x2082', '\x2083', '\x2084', '\x2085', '\x2086', '\x2087', '\x2088', '\x2089'];
+ private static string[] passOneFileTypes = ["thread", "alloc"];
- static void PrintToAllPassOneFiles(string strLine)
+ private static void PrintToAllPassOneFiles(string strLine)
{
for (int fileIndex = 0; fileIndex < (int)PassOneViewType.MaxType; fileIndex++)
{
@@ -541,13 +547,13 @@ static void PrintToAllPassOneFiles(string strLine)
}
}
- static void PrintAllocToAllPassOneFiles()
+ private static void PrintAllocToAllPassOneFiles()
{
string strAlloc = string.Format("{0,6}", nodeIndexToPrint);
int procStart = procsPerNode * nodeIndexToPrint;
int procEnd = procsPerNode * (nodeIndexToPrint + 1);
- int currentGCAllocMBAllHeaps = 0;
+ // int currentGCAllocMBAllHeaps = 0;
int currentGCAllocMB = 0;
for (int procIndex = procStart; procIndex < procEnd; procIndex++)
{
@@ -557,7 +563,7 @@ static void PrintAllocToAllPassOneFiles()
// currentGCAllocMB);
}
- currentGCAllocMBAllHeaps = currentGCAllocMB;
+ // currentGCAllocMBAllHeaps = currentGCAllocMB;
currentGCAllocMB /= procsPerNode;
totalAllocMB += currentGCAllocMB;
totalBudgetMB += budgetMB;
@@ -578,7 +584,8 @@ static void PrintAllocToAllPassOneFiles()
strAlloc += string.Format("|");
PrintToAllPassOneFiles(strAlloc);
}
- static void CloseAllPassOneFiles()
+
+ private static void CloseAllPassOneFiles()
{
Console.WriteLine("Total {0} GCs, avg {1}ms, node {2}: BFR %{3:f2}",
totalGCCount,
@@ -592,7 +599,7 @@ static void CloseAllPassOneFiles()
}
}
- static void PrintHeader()
+ private static void PrintHeader()
{
// TEMP..
//procsPerNode = 16;
@@ -613,7 +620,7 @@ static void PrintHeader()
}
// Note that I'm only allocating 2 chars for count and we don't expect to have more than 99 of them.
- static string FormatCount(int count)
+ private static string FormatCount(int count)
{
if (count > 99)
{
@@ -632,7 +639,7 @@ static string FormatCount(int count)
return strFormattedCount;
}
- static string FormatFlags(int flags)
+ private static string FormatFlags(int flags)
{
string strFormattedFlags = "";
if ((flags & (int)HeapBalanceFlagMask.MutipleProcs) != 0)
@@ -665,7 +672,7 @@ static string FormatFlags(int flags)
// We take the last one on the same time unless we see one with interesting
// info (ie, one of m/p/i isn't 0); or one with higher sample count.
//
- static void PrintProcActivityOnNode()
+ private static void PrintProcActivityOnNode()
{
// TEMP..
//procsPerNode = 16;
@@ -775,18 +782,18 @@ static void PrintProcActivityOnNode()
//}
}
- static int GetAdjustedProcIndex(int pIndex)
+ private static int GetAdjustedProcIndex(int pIndex)
{
return (pIndex % procsPerNode);
}
- static void ParseThreadIndices(string _strThreadIndices)
+ private static void ParseThreadIndices(string _strThreadIndices)
{
strThreadIndices = _strThreadIndices;
- string[] fields = strThreadIndices.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+ string[] fields = strThreadIndices.Split([','], StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < fields.Length; i++)
{
- threadsToPrint.Add(Int32.Parse(fields[i]));
+ threadsToPrint.Add(int.Parse(fields[i]));
}
int len = threadsToPrint.Count;
@@ -797,11 +804,11 @@ static void ParseThreadIndices(string _strThreadIndices)
}
}
- static void ParseGCRange(string _strGCRange)
+ private static void ParseGCRange(string _strGCRange)
{
strGCRange = _strGCRange;
- int dashIndex= strGCRange.IndexOf('-');
- if (dashIndex== -1)
+ int dashIndex = strGCRange.IndexOf('-');
+ if (dashIndex == -1)
{
Console.WriteLine("Invalid GC range {0}", strGCRange);
return;
@@ -811,20 +818,20 @@ static void ParseGCRange(string _strGCRange)
string strEnd = strGCRange.Substring(dashIndex + 1);
if (strStart != "start")
- gcIndexToPrintStart = Int32.Parse(strStart);
+ gcIndexToPrintStart = int.Parse(strStart);
if (strEnd != "end")
- gcIndexToPrintEnd = Int32.Parse(strEnd);
+ gcIndexToPrintEnd = int.Parse(strEnd);
Console.WriteLine("printing GC {0}->{1}", gcIndexToPrintStart, gcIndexToPrintEnd);
}
- static void PassOne(string strPassZeroLog)
+ private static void PassOne(string strPassZeroLog)
{
// This generates 2 files - thread view and alloc heap view. This is just so you could
// compare them SxS.
string strLogNameWithoutExtension = Path.GetFileNameWithoutExtension(strPassZeroLog);
string strIncludeAll = (fIncludeAllTime ? "-ia1-" : "-ia0-");
- string strTI = ((strThreadIndices == null) ? "" : strThreadIndices);
+ string strTI = strThreadIndices ?? "";
string strPassOneLog = strLogNameWithoutExtension + "-pass1-n" + nodeIndexToPrint + strIncludeAll + strTI;
if (strGCRange != null)
@@ -848,9 +855,9 @@ static void PassOne(string strPassZeroLog)
{
//P: 112, N: 2
strTemp = ParseString(s, "P: ", ",", out strRemaining);
- totalProcs = Int32.Parse(strTemp);
+ totalProcs = int.Parse(strTemp);
strTemp = ParseString(strRemaining, "N: ", null, out strRemaining);
- totalNodes = Int32.Parse(strTemp);
+ totalNodes = int.Parse(strTemp);
procsPerNode = totalProcs / totalNodes;
PrintHeader();
@@ -898,7 +905,7 @@ static void PassOne(string strPassZeroLog)
// GCA#gc_index time_since_last_gc-min_time-max_time
//[GCA#1 270-42-268
strTemp = ParseString(s, "A#", " ", out strRemaining);
- int gcIndex = Int32.Parse(strTemp);
+ int gcIndex = int.Parse(strTemp);
fSkip = !((gcIndex >= gcIndexToPrintStart) && (gcIndex <= gcIndexToPrintEnd));
@@ -913,9 +920,9 @@ static void PassOne(string strPassZeroLog)
}
//swPassOne.WriteLine("[GC#{0}-GC#{1}]", (gcIndex - 1), gcIndex);
strTemp = ParseString(s, "-", "-", out strRemaining);
- startTimeMS = Int32.Parse(strTemp);
+ startTimeMS = int.Parse(strTemp);
strTemp = ParseString(strRemaining, "-", null, out strRemaining);
- endTimeMS = Int32.Parse(strTemp);
+ endTimeMS = int.Parse(strTemp);
//Console.WriteLine("Before GC#{0} time {1} {2}, {3} entries",
// gcIndex, startTimeMS, endTimeMS, ((endTimeMS - startTimeMS) / timeUnitMS));
}
@@ -926,7 +933,7 @@ static void PassOne(string strPassZeroLog)
//[p78]-192-225ms
strTemp = ParseString(s, "[p", "]", out strRemaining);
- currentProcIndex = Int32.Parse(strTemp);
+ currentProcIndex = int.Parse(strTemp);
lastTimeIndex = -1;
//currentProcIndex = GetAdjustedProcIndex(currentProcIndex);
}
@@ -946,13 +953,13 @@ static void PassOne(string strPassZeroLog)
//Console.WriteLine(s);
int procIndexBase = totalNodesRead * procsPerNode;
strTemp = ParseString(s, "[N#", "]", out strRemaining);
- budgetMB = Int32.Parse(strTemp);
+ budgetMB = int.Parse(strTemp);
string strAllocLine = s.Substring(7);
//Console.WriteLine("spliting {0}", strAllocLine);
- string[] fieldsAlloc = strAllocLine.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+ string[] fieldsAlloc = strAllocLine.Split([','], StringSplitOptions.RemoveEmptyEntries);
for (int fieldIndex = 0; fieldIndex < procsPerNode; fieldIndex++)
{
- AllocMB[procIndexBase + fieldIndex] = Int32.Parse(fieldsAlloc[fieldIndex]);
+ AllocMB[procIndexBase + fieldIndex] = int.Parse(fieldsAlloc[fieldIndex]);
}
totalNodesRead++;
if (totalNodesRead == totalNodes)
@@ -973,7 +980,7 @@ static void PassOne(string strPassZeroLog)
//[GC#1-15-2911711]
strTemp = ParseString(s, "-", "-", out strRemaining);
totalGCCount++;
- totalGCDurationMS += Int32.Parse(strTemp);
+ totalGCDurationMS += int.Parse(strTemp);
//Console.WriteLine(s);
//Console.WriteLine("GC#{0} {1}ms ->total {2}ms", totalGCCount, Int32.Parse(strTemp), totalGCDurationMS);
@@ -993,7 +1000,7 @@ static void PassOne(string strPassZeroLog)
// Majority of the log, (83) is the ideal proc for that thread.
//1051ms,95(1),83,m:0,p:0,i:0(83)
strTemp = ParseString(s, null, "ms", out strRemaining);
- int currentTimeIndex = Int32.Parse(strTemp);
+ int currentTimeIndex = int.Parse(strTemp);
if (currentTimeIndex < lastTimeIndex)
{
@@ -1006,19 +1013,19 @@ static void PassOne(string strPassZeroLog)
currentTimeIndex -= startTimeMS;
currentTimeIndex /= timeUnitMS;
strTemp = ParseString(strRemaining, ",", "(", out strRemaining);
- int tid = Int32.Parse(strTemp);
+ int tid = int.Parse(strTemp);
strTemp = ParseString(strRemaining, "(", ")", out strRemaining);
- int countSamples = Int32.Parse(strTemp);
+ int countSamples = int.Parse(strTemp);
strTemp = ParseString(strRemaining, ",", ",", out strRemaining);
- int allocHeap = Int32.Parse(strTemp);
+ int allocHeap = int.Parse(strTemp);
strTemp = ParseString(strRemaining, ",m:", ",", out strRemaining);
- int flags = Int32.Parse(strTemp);
+ int flags = int.Parse(strTemp);
strTemp = ParseString(strRemaining, ",p:", ",", out strRemaining);
- flags |= Int32.Parse(strTemp) << 4;
+ flags |= int.Parse(strTemp) << 4;
strTemp = ParseString(strRemaining, ",i:", "(", out strRemaining);
- flags |= Int32.Parse(strTemp) << 8;
+ flags |= int.Parse(strTemp) << 8;
strTemp = ParseString(strRemaining, "(", ")", out strRemaining);
- int idealProcNo = Int32.Parse(strTemp);
+ int idealProcNo = int.Parse(strTemp);
//Console.WriteLine("ADDING time {0}ms, entry {1}, thread #{2}, ah {3}, ideal {4}",
// currentTimeIndex, currentProcIndex, tid, allocHeap, idealProcNo);
samples[currentTimeIndex][currentProcIndex] = new SampleInfo(tid, allocHeap, countSamples, flags, idealProcNo);
@@ -1040,9 +1047,8 @@ static void PassOne(string strPassZeroLog)
// TODO: in pass zero there's merit in assigning thread indices based on the first CPU they appear on,
// instead of just assigning one as we come across them.
- static void Main(string[] args)
+ private static void Main(string[] args)
{
- int len = args.Length;
string strLog = null;
for (int i = 0; i < args.Length; ++i)
@@ -1056,7 +1062,7 @@ static void Main(string[] args)
else if (currentArg.Equals("-ia") || currentArg.Equals("-IncludeAll"))
{
currentArgValue = args[++i];
- fIncludeAllTime = (Int32.Parse(currentArgValue) == 1);
+ fIncludeAllTime = (int.Parse(currentArgValue) == 1);
}
else if (currentArg.Equals("-ti") || currentArg.Equals("-ThreadIndices"))
{
@@ -1080,7 +1086,7 @@ static void Main(string[] args)
// total procs they ran on during that time. This shows us how volatile threads
// are jumping between procs.
currentArgValue = args[++i];
- if (Int32.Parse(currentArgValue) == 1)
+ if (int.Parse(currentArgValue) == 1)
fPrintThreadInfoPerTimeUnit = true;
}
}
diff --git a/src/coreclr/tools/GCLogParser/parse-hb-log.csproj b/src/coreclr/tools/GCLogParser/parse-hb-log.csproj
index 5bff6087f5109..476218ce55e7a 100644
--- a/src/coreclr/tools/GCLogParser/parse-hb-log.csproj
+++ b/src/coreclr/tools/GCLogParser/parse-hb-log.csproj
@@ -1,66 +1,9 @@
-
-
-
+
+
- Debug
- AnyCPU
- {6AE26CD6-C971-48D6-8C03-2FFA272B942C}
Exe
- parse_hb_log
- parse-hb-log
- v4.7.2
- true
- true
+ $(NetCoreAppToolCurrent)
+ $(NoWarn);CA1805;CA1854;CA1864;
-
- AnyCPU
- true
- full
- false
- artifacts\Debug\
- DEBUG;TRACE
-
-
- AnyCPU
- pdbonly
- true
- artifacts\Release\
- TRACE
-
-
- true
- artifacts\x64\Debug\
- DEBUG;TRACE
- full
- x64
- MinimumRecommendedRules.ruleset
- true
-
-
- artifacts\x64\Release\
- TRACE
- true
- pdbonly
- x64
- MinimumRecommendedRules.ruleset
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
From 66b43d7bd22ce5dbe165c345b5cd109252844067 Mon Sep 17 00:00:00 2001
From: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Date: Mon, 13 May 2024 18:56:03 +0300
Subject: [PATCH 2/2] Cleanup
---
src/coreclr/tools/GCLogParser/parse-hb-log.cs | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/coreclr/tools/GCLogParser/parse-hb-log.cs b/src/coreclr/tools/GCLogParser/parse-hb-log.cs
index 365c19c69f672..ebf1a01a32245 100644
--- a/src/coreclr/tools/GCLogParser/parse-hb-log.cs
+++ b/src/coreclr/tools/GCLogParser/parse-hb-log.cs
@@ -553,7 +553,6 @@ private static void PrintAllocToAllPassOneFiles()
int procStart = procsPerNode * nodeIndexToPrint;
int procEnd = procsPerNode * (nodeIndexToPrint + 1);
- // int currentGCAllocMBAllHeaps = 0;
int currentGCAllocMB = 0;
for (int procIndex = procStart; procIndex < procEnd; procIndex++)
{
@@ -563,7 +562,6 @@ private static void PrintAllocToAllPassOneFiles()
// currentGCAllocMB);
}
- // currentGCAllocMBAllHeaps = currentGCAllocMB;
currentGCAllocMB /= procsPerNode;
totalAllocMB += currentGCAllocMB;
totalBudgetMB += budgetMB;