Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual updates 20241003 improvements data acquisition build timings measurements (20240211) #997

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4cdd906
timings prepared - Stopwatch and Cake Task Duration
moljac Feb 11, 2024
7ebe011
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac May 9, 2024
047182c
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Sep 4, 2024
b99db38
output fixed
moljac Sep 9, 2024
95f12be
output fixed
moljac Sep 9, 2024
552b86c
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Sep 9, 2024
646d392
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Oct 3, 2024
3419f25
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Oct 7, 2024
43641af
Create performance-timings.cake
moljac Oct 9, 2024
7bd1770
refactored to new cake file
moljac Oct 9, 2024
e20670e
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Oct 9, 2024
eea313f
Merge branch 'mu-20240211-improvements-data-acquisition-build-timings…
moljac Oct 9, 2024
9139651
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Oct 10, 2024
ecc1c03
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Oct 23, 2024
3427ceb
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Oct 26, 2024
78431af
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Nov 4, 2024
e1e93c7
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Nov 6, 2024
e15e3d7
Merge branch 'main' into mu-20240211-improvements-data-acquisition-bu…
moljac Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#addin nuget:?package=Cake.MonoApiTools&version=3.0.5
#addin nuget:?package=CsvHelper&version=31.0.3
#addin nuget:?package=SharpZipLib&version=1.4.2
#addin nuget:?package=SharpZipLib&version=1.4.2
moljac marked this conversation as resolved.
Show resolved Hide resolved
#addin nuget:?package=ZString&version=2.6.0

// #addin nuget:?package=NuGet.Protocol&loaddependencies=true&version=5.6.0
// #addin nuget:?package=NuGet.Versioning&loaddependencies=true&version=5.6.0
Expand All @@ -24,6 +26,135 @@ using System.Xml.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using CsvHelper;
using Cysharp.Text;

System.Diagnostics.Stopwatch stopwatch;
List<(DateTime timestamp, string task, TimeSpan duration)> TimingDataStopwatch;
List<(DateTime timestamp, string task, TimeSpan duration)> TimingDataCake;

Setup
(
context =>
{
// Executed BEFORE the first task.
stopwatch = new System.Diagnostics.Stopwatch();
TimingDataStopwatch = new List<(DateTime timestamp, string task, TimeSpan duration)>();
TimingDataCake = new List<(DateTime timestamp, string task, TimeSpan duration)>();

return;
}
);

Teardown
(
context =>
{
// Executed AFTER the last task.

using(var sb1 = ZString.CreateStringBuilder())
using(var sb2 = ZString.CreateStringBuilder())
{
string line_1_1 = ZString.Format
(
"{0,25},{1,20},{2,40},{3,25}",
"#TimingDataStopwatch",
"data.timestamp",
"data.task",
"data.duration"
);
sb1.AppendLine(line_1_1);
foreach(var data in TimingDataStopwatch)
{
string line = ZString.Format
(
"{0,25},{1,20},{2,40},{3,25}",
"#TimingDataStopwatch",
data.timestamp.ToString("yyyyMMdd-HHmmss.ff"),
data.task,
data.duration
);

Information(line);
sb1.AppendLine(line);
}

string line_2_1 = ZString.Format
(
"{0,25},{1,20},{2,40},{3,25}",
"#TimingDataCake",
"data.timestamp",
"data.task",
"data.duration"
);
sb2.AppendLine(line_2_1);
foreach(var data in TimingDataCake)
{
string line = ZString.Format
(
"{0,25},{1,20},{2,40},{3,25}",
"#TimingDataCake",
data.timestamp.ToString("yyyyMMdd-HHmmss.ff"),
data.task,
data.duration
);

Information(line);
sb2.AppendLine(line);
}


EnsureDirectoryExists("./output/timing-data/");
string timestamp = DateTime.Now.ToString("yyyyMMdd-HHmmss");
string filename = context.GetCallerInfo().SourceFilePath.GetFilename().ToString();

System.IO.File.WriteAllText
(
$"./output/timing-data/{filename}.stopwatch.{timestamp}.csv",
sb1.ToString()
);
System.IO.File.WriteAllText
(
$"./output/timing-data/{filename}.cake-timer.{timestamp}.csv",
sb2.ToString()
);

EnsureDirectoryExists($"./data/timings/{timestamp}");
System.IO.File.WriteAllText
(
$"./data/timings/{timestamp}/{filename}.stopwatch.csv",
sb1.ToString()
);
System.IO.File.WriteAllText
(
$"./data/timings/{timestamp}/{filename}.cake-timer.csv",
sb2.ToString()
);
}

return;
}
);

TaskSetup
(
context =>
{
// Executed BEFORE the each task.
stopwatch.Start();

return;
}
);

TaskTeardown
(
context =>
{
stopwatch.Stop();
TimingDataStopwatch.Add( (DateTime.Now, context.Task.Name, stopwatch.Elapsed) );
TimingDataCake.Add( (DateTime.Now, context.Task.Name, context.Duration) );
}
);

// The main configuration points
var TARGET = Argument ("t", Argument ("target", "Default"));
Expand Down
131 changes: 131 additions & 0 deletions utilities.cake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#addin nuget:?package=Newtonsoft.Json&version=13.0.3
#addin nuget:?package=Cake.FileHelpers&version=7.0.0
#addin nuget:?package=Mono.Cecil&version=0.11.5
#addin nuget:?package=ZString&version=2.6.0

#addin nuget:?package=HolisticWare.Xamarin.Tools.ComponentGovernance&version=0.0.1.4
#addin nuget:?package=HolisticWare.Core.Net.HTTP&version=0.0.4
Expand All @@ -19,9 +20,139 @@ using System.Collections.Concurrent;
using Mono.Cecil;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Cysharp.Text;

using HolisticWare.Xamarin.Tools.ComponentGovernance;

System.Diagnostics.Stopwatch stopwatch;
List<(DateTime timestamp, string task, TimeSpan duration)> TimingDataStopwatch;
List<(DateTime timestamp, string task, TimeSpan duration)> TimingDataCake;

Setup
(
context =>
{
// Executed BEFORE the first task.
stopwatch = new System.Diagnostics.Stopwatch();
TimingDataStopwatch = new List<(DateTime timestamp, string task, TimeSpan duration)>();
TimingDataCake = new List<(DateTime timestamp, string task, TimeSpan duration)>();

return;
}
);

Teardown
(
context =>
{
// Executed AFTER the last task.

using(var sb1 = ZString.CreateStringBuilder())
using(var sb2 = ZString.CreateStringBuilder())
{
string line_1_1 = ZString.Format
(
"{0,25},{1,20},{2,40},{3,25}",
"#TimingDataStopwatch",
"data.timestamp",
"data.task",
"data.duration"
);
sb1.AppendLine(line_1_1);
foreach(var data in TimingDataStopwatch)
{
string line = ZString.Format
(
"{0,25},{1,20},{2,40},{3,25}",
"#TimingDataStopwatch",
data.timestamp.ToString("yyyyMMdd-HHmmss.FF"),
data.task,
data.duration
);

Information(line);
sb1.AppendLine(line);
}

string line_2_1 = ZString.Format
(
"{0,25},{1,20},{2,40},{3,25}",
"#TimingDataCake",
"data.timestamp",
"data.task",
"data.duration"
);
sb2.AppendLine(line_2_1);
foreach(var data in TimingDataCake)
{
string line = ZString.Format
(
"{0,25},{1,20},{2,40},{3,25}",
"#TimingDataCake",
data.timestamp.ToString("yyyyMMdd-HHmmss.FF"),
data.task,
data.duration
);

Information(line);
sb2.AppendLine(line);
}


EnsureDirectoryExists("./output/timing-data/");
string timestamp = DateTime.Now.ToString("yyyyMMdd-HHmmss");
string filename = context.GetCallerInfo().SourceFilePath.GetFilename().ToString();

System.IO.File.WriteAllText
(
$"./output/timing-data/{filename}.stopwatch.{timestamp}.csv",
sb1.ToString()
);
System.IO.File.WriteAllText
(
$"./output/timing-data/{filename}.cake-timer.{timestamp}.csv",
sb2.ToString()
);

EnsureDirectoryExists($"./data/timings/{timestamp}");
System.IO.File.WriteAllText
(
$"./data/timings/{timestamp}/{filename}.stopwatch.csv",
sb1.ToString()
);
System.IO.File.WriteAllText
(
$"./data/timings/{timestamp}/{filename}.cake-timer.csv",
sb2.ToString()
);
}

return;
}
);

TaskSetup
(
context =>
{
// Executed BEFORE the each task.
stopwatch.Start();

return;
}
);

TaskTeardown
(
context =>
{
stopwatch.Stop();
TimingDataStopwatch.Add( (DateTime.Now, context.Task.Name, stopwatch.Elapsed) );
TimingDataCake.Add( (DateTime.Now, context.Task.Name, context.Duration) );
}
);


var TARGET = Argument ("t", Argument ("target", "Default"));

string file_spell_errors = "./output/spell-errors.txt";
Expand Down