Skip to content

Commit

Permalink
performance tuning individual job details - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcongdon committed Oct 17, 2023
1 parent f6fb493 commit b96a45f
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public string FormVbrFullReport(string htmlString, bool scrub)
if (CGlobals.EXPORTINDIVIDUALJOBHTMLS)
{

IndividualJobHtmlBuilder();
//IndividualJobHtmlBuilder();

}

Expand Down Expand Up @@ -145,7 +145,7 @@ private void JobInfoTable()
HTMLSTRING += _tables.AddJobInfoTable(SCRUB);

}
private void IndividualJobHtmlBuilder()
public void IndividualJobHtmlBuilder()
{
_tables.AddSessionsFiles(SCRUB);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ private void FormVbrFullBody()
_htmldocScrubbed = helper.FormVbrFullReport(_htmldocScrubbed, true);
_htmldocOriginal = helper.FormVbrFullReport(_htmldocOriginal, false);

if (CGlobals.EXPORTINDIVIDUALJOBHTMLS)
{
helper.IndividualJobHtmlBuilder();

//IndividualJobHtmlBuilder();

}


_htmldocOriginal += FormFooter();
_htmldocScrubbed += FormFooter();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Markdig.Extensions.SmartyPants;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -34,7 +35,7 @@ private List<CJobSessionInfo> ReturnJobSessionsList()
return csv;
else
{
csv = res.Where(c => c.CreationTime >= targetDate).ToList();
csv = res.Where(c => c.CreationTime >= targetDate).ToList();
//csv = csv.Where(c => c.CreationTime >= targetDate).ToList();
csv = csv.OrderBy(x => x.Name).ToList();

Expand All @@ -47,7 +48,8 @@ private List<CJobSessionInfo> ReturnJobSessionsList()

public void ParseIndividualSessions(bool scrub)
{
if (scrub) { _scrubber = new(); }
//if (scrub) { _scrubber = new(); }
_scrubber = new();

List<string> processedJobs = new();
double percentCounter = 0;
Expand All @@ -60,55 +62,22 @@ public void ParseIndividualSessions(bool scrub)
{
processedJobs.Add(cs.JobName);

string outDir = "";// CVariables.desiredDir + "\\Original";
// string outDir = "";// CVariables.desiredDir + "\\Original";
string folderName = "\\JobSessionReports";

string mainDir = SetMainDir(folderName, cs);
string scrubDir = SetScrubDir(folderName, cs);

if (cs.JobName.Contains("/"))
{
log.Debug("Caught invalid char: \"/\", replacing with \"-\": " + cs.JobName);
cs.JobName = cs.JobName.Replace("/", "-");
log.Debug("New Name = " + cs.JobName);
}

if (scrub)
{
outDir = CGlobals._desiredPath + CVariables._safeSuffix + folderName;
//log.Warning("SAFE outdir = " + outDir, false);
CheckFolderExists(outDir);
outDir += "\\" + _scrubber.ScrubItem(cs.JobName) + ".html";
cs.JobName = FixInvalidJobName(cs.JobName);
}
else
{
outDir = CGlobals._desiredPath + CVariables._unsafeSuffix + folderName;
CheckFolderExists(outDir);
outDir += "\\" + cs.JobName + ".html";
}
string docName = outDir + "\\";


string s = _form.FormHeader();
s += "<h2>" + cs.JobName + "</h2>";

s += "<table border=\"1\"><tr>";
s += _form.TableHeader("Job Name", "Name of job");
s += _form.TableHeader("VM Name", "Name of VM/Server within the job");
s += _form.TableHeader("Alg", "Job Algorithm");
s += _form.TableHeader("Primary Bottleneck", "Primary detected bottleneck");
s += _form.TableHeader("BottleNeck", "Detected bottleneck breakdown");
s += _form.TableHeader("CompressionRatio", "Calculated compression ratio");
s += _form.TableHeader("Start Time", "Start time of the backup job");
s += _form.TableHeader("BackupSize", "Detected size of backup file");
s += _form.TableHeader("DataSize", "Detected size of original VM/server (provisioned, not actual)");
s += _form.TableHeader("DedupRatio", "Calculated deduplication ratio");
s += _form.TableHeader("Is Retry", "Is this a retry run?");
s += _form.TableHeader("Job Duration", "Duration of job in minutes");
s += _form.TableHeader("Min Time", "Shorted detected job duration in minutes");
s += _form.TableHeader("Max Time", "Longest detected job duration in minutes");
s += _form.TableHeader("Avg Time", "Average job duration in minutes");
s += _form.TableHeader("Processing Mode", "Processing mode used in the job (blank = SAN)");
s += _form.TableHeader("Status", "Final status of the job");
s += _form.TableHeader("Task Duration", "Duration of the VM/server within the job in minutes");
s += "</tr>";

// string docName = outDir + "\\";


string mainString = ReturnTableHeaderString(cs);
string scrubString = ReturnTableHeaderString(cs);

int counter = 1;
foreach (var c in csv)
Expand All @@ -120,39 +89,8 @@ public void ParseIndividualSessions(bool scrub)
{
if (cs.JobName == c.JobName)
{
string jname = c.JobName;
if (jname.Contains("\\"))
{
jname = jname.Replace("\\", "--");
}
string vmName = c.VmName;
//string repo = _scrubber.ScrubItem(c.)
if (scrub)
{
jname = _scrubber.ScrubItem(c.JobName, "job");
vmName = _scrubber.ScrubItem(c.VmName, "vm");
}

s += "<tr>";
s += TableData(jname, "jobName");
s += TableData(vmName, "vmName");
s += TableData(c.Alg, "alg");
s += TableData(c.PrimaryBottleneck, "primBottleneck");
s += TableData(c.Bottleneck, "bottleneck");
s += TableData(c.CompressionRatio, "compression");
s += TableData(c.CreationTime.ToString(), "creationtime");
s += TableData(c.BackupSize.ToString(), "backupsize");
s += TableData(c.DataSize.ToString(), "datasize");
s += TableData(c.DedupRatio, "dedupratio");
s += TableData(c.IsRetry, "isretry");
s += TableData(c.JobDuration, "jobDuration");
s += TableData(c.minTime.ToString(), "minTime");
s += TableData(c.maxTime.ToString(), "maxtime");
s += TableData(c.avgTime.ToString(), "avgTime");
s += TableData(c.ProcessingMode, "processingmode");
s += TableData(c.Status, "status");
s += TableData(c.TaskDuration, "taskDuration");
s += "</tr>";
mainString += FormHtmlString(c, mainString, false);
scrubString += FormHtmlString(c, scrubString, true);

}
}
Expand All @@ -167,7 +105,8 @@ public void ParseIndividualSessions(bool scrub)
//string dir = Path.GetDirectoryName(docName);
//if (!Directory.Exists(dir))
// Directory.CreateDirectory(dir);
File.WriteAllText(outDir, s);
File.WriteAllText(mainDir, mainString);
File.WriteAllText(scrubDir, scrubString);
}
catch (Exception e)
{
Expand All @@ -181,6 +120,94 @@ public void ParseIndividualSessions(bool scrub)
percentCounter++;
}
}
private string SetMainDir(string folderName, CJobSessionInfo cs)
{
var mainDir = CGlobals._desiredPath + CVariables._unsafeSuffix + folderName;
CheckFolderExists(mainDir);
mainDir += "\\" + cs.JobName + ".html";
return mainDir;
}
private string SetScrubDir(string folderName, CJobSessionInfo cs)
{
var scrubDir = CGlobals._desiredPath + CVariables._safeSuffix + folderName;
//log.Warning("SAFE outdir = " + outDir, false);
CheckFolderExists(scrubDir);
scrubDir += "\\" + _scrubber.ScrubItem(cs.JobName) + ".html";
return scrubDir;
}
private string ReturnTableHeaderString(CJobSessionInfo cs)
{
string s = _form.FormHeader();
s += "<h2>" + cs.JobName + "</h2>";

s += "<table border=\"1\"><tr>";
s += _form.TableHeader("Job Name", "Name of job");
s += _form.TableHeader("VM Name", "Name of VM/Server within the job");
s += _form.TableHeader("Alg", "Job Algorithm");
s += _form.TableHeader("Primary Bottleneck", "Primary detected bottleneck");
s += _form.TableHeader("BottleNeck", "Detected bottleneck breakdown");
s += _form.TableHeader("CompressionRatio", "Calculated compression ratio");
s += _form.TableHeader("Start Time", "Start time of the backup job");
s += _form.TableHeader("BackupSize", "Detected size of backup file");
s += _form.TableHeader("DataSize", "Detected size of original VM/server (provisioned, not actual)");
s += _form.TableHeader("DedupRatio", "Calculated deduplication ratio");
s += _form.TableHeader("Is Retry", "Is this a retry run?");
s += _form.TableHeader("Job Duration", "Duration of job in minutes");
s += _form.TableHeader("Min Time", "Shorted detected job duration in minutes");
s += _form.TableHeader("Max Time", "Longest detected job duration in minutes");
s += _form.TableHeader("Avg Time", "Average job duration in minutes");
s += _form.TableHeader("Processing Mode", "Processing mode used in the job (blank = SAN)");
s += _form.TableHeader("Status", "Final status of the job");
s += _form.TableHeader("Task Duration", "Duration of the VM/server within the job in minutes");
s += "</tr>";
return s;
}
private string FormHtmlString(CJobSessionInfo c, string htmlString, bool scrub)
{
string s = ""; // htmlString;
string jname = c.JobName;
if (jname.Contains("\\"))
{
jname = jname.Replace("\\", "--");
}
string vmName = c.VmName;
//string repo = _scrubber.ScrubItem(c.)
if (scrub)
{
jname = _scrubber.ScrubItem(c.JobName, "job");
vmName = _scrubber.ScrubItem(c.VmName, "vm");
}

s += "<tr>";
s += TableData(jname, "jobName");
s += TableData(vmName, "vmName");
s += TableData(c.Alg, "alg");
s += TableData(c.PrimaryBottleneck, "primBottleneck");
s += TableData(c.Bottleneck, "bottleneck");
s += TableData(c.CompressionRatio, "compression");
s += TableData(c.CreationTime.ToString(), "creationtime");
s += TableData(c.BackupSize.ToString(), "backupsize");
s += TableData(c.DataSize.ToString(), "datasize");
s += TableData(c.DedupRatio, "dedupratio");
s += TableData(c.IsRetry, "isretry");
s += TableData(c.JobDuration, "jobDuration");
s += TableData(c.minTime.ToString(), "minTime");
s += TableData(c.maxTime.ToString(), "maxtime");
s += TableData(c.avgTime.ToString(), "avgTime");
s += TableData(c.ProcessingMode, "processingmode");
s += TableData(c.Status, "status");
s += TableData(c.TaskDuration, "taskDuration");
s += "</tr>";

return s;
}
private string FixInvalidJobName(string jobName)
{
log.Debug("Caught invalid char: \"/\", replacing with \"-\": " + jobName);
var name = jobName.Replace("/", "-");
log.Debug("New Name = " + name);
return name;
}
private void LogJobSessionParseProgress(double counter, int total)
{
double percentComplete = counter / total * 100;
Expand Down
4 changes: 2 additions & 2 deletions vHC/HC_Reporting/VeeamHealthCheck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<Company>Veeam</Company>
<Authors>AdamC</Authors>
<ApplicationIcon>Veeam_HealthCheck_228x228.ico</ApplicationIcon>
<AssemblyVersion>1.0.3.765</AssemblyVersion>
<AssemblyVersion>1.0.3.770</AssemblyVersion>
<SignAssembly>False</SignAssembly>
<AssemblyOriginatorKeyFile>vhc_keyfile2.pfx</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<FileVersion>1.0.3.765</FileVersion>
<FileVersion>1.0.3.770</FileVersion>
<DebugType>full</DebugType>
<SelfContained>true</SelfContained>
<!--These 2 lines are what produce the single file utility. Possibly doesn't work...-->
Expand Down

0 comments on commit b96a45f

Please sign in to comment.