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

Apply further .NET 8 optimizations, add Pyret to list of known languages #67

Merged
merged 2 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
58 changes: 29 additions & 29 deletions src/Entities/CPUInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@

namespace PrimeView.Entities
{
public class CPUInfo
{
public string? Manufacturer { get; set; }
public string? Brand { get; set; }
public string? Vendor { get; set; }
public string? Family { get; set; }
public string? Model { get; set; }
public string? Stepping { get; set; }
public string? Revision { get; set; }
public string? Voltage { get; set; }
public float? Speed { get; set; }
[JsonPropertyName("speedMin")]
public float? MinimumSpeed { get; set; }
[JsonPropertyName("speedMax")]
public float? MaximumSpeed { get; set; }
public string? Governor { get; set; }
public int? Cores { get; set; }
public int? PhysicalCores { get; set; }
public int? EfficiencyCores { get; set; }
public int? PerformanceCores { get; set; }
public int? Processors { get; set; }
public string? RaspberryProcessor { get; set; }
public string? Socket { get; set; }
public string? Flags { get; set; }
[JsonIgnore]
public string[]? FlagValues => Flags?.Split(' ', StringSplitOptions.RemoveEmptyEntries);
public bool? Virtualization { get; set; }
public Dictionary<string, object>? Cache { get; set; }
}
public class CPUInfo
{
public string? Manufacturer { get; set; }
public string? Brand { get; set; }
public string? Vendor { get; set; }
public string? Family { get; set; }
public string? Model { get; set; }
public string? Stepping { get; set; }
public string? Revision { get; set; }
public string? Voltage { get; set; }
public float? Speed { get; set; }
[JsonPropertyName("speedMin")]
public float? MinimumSpeed { get; set; }
[JsonPropertyName("speedMax")]
public float? MaximumSpeed { get; set; }
public string? Governor { get; set; }
public int? Cores { get; set; }
public int? PhysicalCores { get; set; }
public int? EfficiencyCores { get; set; }
public int? PerformanceCores { get; set; }
public int? Processors { get; set; }
public string? RaspberryProcessor { get; set; }
public string? Socket { get; set; }
public string? Flags { get; set; }
[JsonIgnore]
public string[]? FlagValues => Flags?.Split(' ', StringSplitOptions.RemoveEmptyEntries);
public bool? Virtualization { get; set; }
public Dictionary<string, object>? Cache { get; set; }
}
}
26 changes: 13 additions & 13 deletions src/Entities/DockerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

namespace PrimeView.Entities
{
public class DockerInfo
{
public string? KernelVersion { get; set; }
public string? OperatingSystem { get; set; }
public string? OSVersion { get; set; }
public string? OSType { get; set; }
public string? Architecture { get; set; }
[JsonPropertyName("ncpu")]
public int? CPUCount { get; set; }
[JsonPropertyName("memTotal")]
public long? TotalMemory { get; set; }
public string? ServerVersion { get; set; }
}
public class DockerInfo
{
public string? KernelVersion { get; set; }
public string? OperatingSystem { get; set; }
public string? OSVersion { get; set; }
public string? OSType { get; set; }
public string? Architecture { get; set; }
[JsonPropertyName("ncpu")]
public int? CPUCount { get; set; }
[JsonPropertyName("memTotal")]
public long? TotalMemory { get; set; }
public string? ServerVersion { get; set; }
}
}
16 changes: 8 additions & 8 deletions src/Entities/IReportReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace PrimeView.Entities
{
public interface IReportReader
{
Task<(ReportSummary[] summaries, int total)> GetSummaries(int maxSummaryCount);
Task<(ReportSummary[] summaries, int total)> GetSummaries(string? runnerId, int skipFirst, int maxSummaryCount);
Task<Report> GetReport(string id);
Task<Runner[]> GetRunners();
void FlushCache();
}
public interface IReportReader
{
Task<(ReportSummary[] summaries, int total)> GetSummaries(int maxSummaryCount);
Task<(ReportSummary[] summaries, int total)> GetSummaries(string? runnerId, int skipFirst, int maxSummaryCount);
Task<Report> GetReport(string id);
Task<Runner[]> GetRunners();
void FlushCache();
}
}
34 changes: 17 additions & 17 deletions src/Entities/OperatingSystemInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

namespace PrimeView.Entities
{
public class OperatingSystemInfo
{
public string? Platform { get; set; }
[JsonPropertyName("distro")]
public string? Distribution { get; set; }
public string? Release { get; set; }
public string? CodeName { get; set; }
public string? Kernel { get; set; }
[JsonPropertyName("arch")]
public string? Architecture { get; set; }
public string? CodePage { get; set; }
public string? LogoFile { get; set; }
public string? Build { get; set; }
public string? ServicePack { get; set; }
[JsonPropertyName("uefi")]
public bool? IsUefi { get; set; }
}
public class OperatingSystemInfo
{
public string? Platform { get; set; }
[JsonPropertyName("distro")]
public string? Distribution { get; set; }
public string? Release { get; set; }
public string? CodeName { get; set; }
public string? Kernel { get; set; }
[JsonPropertyName("arch")]
public string? Architecture { get; set; }
public string? CodePage { get; set; }
public string? LogoFile { get; set; }
public string? Build { get; set; }
public string? ServicePack { get; set; }
[JsonPropertyName("uefi")]
public bool? IsUefi { get; set; }
}
}
22 changes: 11 additions & 11 deletions src/Entities/Report.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace PrimeView.Entities
{
public class Report
{
public string? Id { get; set; }
public string? User { get; set; }
public DateTime? Date { get; set; }
public CPUInfo? CPU { get; set; }
public OperatingSystemInfo? OperatingSystem { get; set; }
public SystemInfo? System { get; set; }
public DockerInfo? DockerInfo { get; set; }
public Result[]? Results { get; set; }
}
public class Report
{
public string? Id { get; set; }
public string? User { get; set; }
public DateTime? Date { get; set; }
public CPUInfo? CPU { get; set; }
public OperatingSystemInfo? OperatingSystem { get; set; }
public SystemInfo? System { get; set; }
public DockerInfo? DockerInfo { get; set; }
public Result[]? Results { get; set; }
}
}
34 changes: 17 additions & 17 deletions src/Entities/ReportSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

namespace PrimeView.Entities
{
public class ReportSummary
{
public string? Id { get; set; }
public DateTime? Date { get; set; }
public string? User { get; set; }
public string? CpuVendor { get; set; }
public string? CpuBrand { get; set; }
public int? CpuCores { get; set; }
public int? CpuProcessors { get; set; }
public string? OsPlatform { get; set; }
public string? OsDistro { get; set; }
public string? OsRelease { get; set; }
public string? Architecture { get; set; }
public bool? IsSystemVirtual { get; set; }
public string? DockerArchitecture { get; set; }
public int ResultCount { get; set; } = 0;
}
public class ReportSummary
{
public string? Id { get; set; }
public DateTime? Date { get; set; }
public string? User { get; set; }
public string? CpuVendor { get; set; }
public string? CpuBrand { get; set; }
public int? CpuCores { get; set; }
public int? CpuProcessors { get; set; }
public string? OsPlatform { get; set; }
public string? OsDistro { get; set; }
public string? OsRelease { get; set; }
public string? Architecture { get; set; }
public bool? IsSystemVirtual { get; set; }
public string? DockerArchitecture { get; set; }
public int ResultCount { get; set; } = 0;
}
}
108 changes: 54 additions & 54 deletions src/Entities/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,58 @@

namespace PrimeView.Entities
{
[EpplusTable(PrintHeaders = true, ShowTotal = true, TableStyle = TableStyles.Light1)]
public class Result
{
public const int LanguageColumnIndex = 1;
[EpplusTableColumn(Order = LanguageColumnIndex, TotalsRowLabel = "Count:")]
public string? Language { get; set; }

public const int SolutionColumnIndex = 2;
[EpplusTableColumn(Order = SolutionColumnIndex, TotalsRowFunction = RowFunctions.Count)]
public string? Solution { get; set; }

public const int SolutionUriColumnIndex = 3;
[EpplusTableColumn(Order = SolutionUriColumnIndex, Header = "Solution link")]
public string? SolutionUrl { get; set; }

public const int LabelColumnIndex = 4;
[EpplusTableColumn(Order = LabelColumnIndex)]
public string? Label { get; set; }

public const int IsMultiThreadedColumnIndex = 5;
[EpplusTableColumn(Order = IsMultiThreadedColumnIndex, Header = "Multithreaded?")]
public bool IsMultiThreaded => Threads > 1;

public const int PassesColumnIndex = 6;
[EpplusTableColumn(Order = PassesColumnIndex, Header = "Number of passes")]
public long? Passes { get; set; }

public const int DurationColumnIndex = 7;
[EpplusTableColumn(Order = DurationColumnIndex)]
public double? Duration { get; set; }

public const int ThreadsColumnIndex = 8;
[EpplusTableColumn(Order = ThreadsColumnIndex, Header = "Number of threads")]
public int? Threads { get; set; }

public const int PassesPerSecondColumnIndex = 9;
[EpplusTableColumn(Order = PassesPerSecondColumnIndex, Header = "Passes / thread / second")]
public double? PassesPerSecond => (double?)Passes / Threads / Duration;

public const int AlgorithmColumnIndex = 10;
[EpplusTableColumn(Order = AlgorithmColumnIndex)]
public string? Algorithm { get; set; }

public const int IsFaithfulColumnIndex = 11;
[EpplusTableColumn(Order = IsFaithfulColumnIndex, Header = "Faithful?")]
public bool? IsFaithful { get; set; }

public const int BitsColumnIndex = 12;
[EpplusTableColumn(Order = BitsColumnIndex, Header = "Bits per prime")]
public int? Bits { get; set; }

[EpplusIgnore]
public string? Status { get; set; }
}
[EpplusTable(PrintHeaders = true, ShowTotal = true, TableStyle = TableStyles.Light1)]
public class Result
{
public const int LanguageColumnIndex = 1;
[EpplusTableColumn(Order = LanguageColumnIndex, TotalsRowLabel = "Count:")]
public string? Language { get; set; }

public const int SolutionColumnIndex = 2;
[EpplusTableColumn(Order = SolutionColumnIndex, TotalsRowFunction = RowFunctions.Count)]
public string? Solution { get; set; }

public const int SolutionUriColumnIndex = 3;
[EpplusTableColumn(Order = SolutionUriColumnIndex, Header = "Solution link")]
public string? SolutionUrl { get; set; }

public const int LabelColumnIndex = 4;
[EpplusTableColumn(Order = LabelColumnIndex)]
public string? Label { get; set; }

public const int IsMultiThreadedColumnIndex = 5;
[EpplusTableColumn(Order = IsMultiThreadedColumnIndex, Header = "Multithreaded?")]
public bool IsMultiThreaded => Threads > 1;

public const int PassesColumnIndex = 6;
[EpplusTableColumn(Order = PassesColumnIndex, Header = "Number of passes")]
public long? Passes { get; set; }

public const int DurationColumnIndex = 7;
[EpplusTableColumn(Order = DurationColumnIndex)]
public double? Duration { get; set; }

public const int ThreadsColumnIndex = 8;
[EpplusTableColumn(Order = ThreadsColumnIndex, Header = "Number of threads")]
public int? Threads { get; set; }

public const int PassesPerSecondColumnIndex = 9;
[EpplusTableColumn(Order = PassesPerSecondColumnIndex, Header = "Passes / thread / second")]
public double? PassesPerSecond => (double?)Passes / Threads / Duration;

public const int AlgorithmColumnIndex = 10;
[EpplusTableColumn(Order = AlgorithmColumnIndex)]
public string? Algorithm { get; set; }

public const int IsFaithfulColumnIndex = 11;
[EpplusTableColumn(Order = IsFaithfulColumnIndex, Header = "Faithful?")]
public bool? IsFaithful { get; set; }

public const int BitsColumnIndex = 12;
[EpplusTableColumn(Order = BitsColumnIndex, Header = "Bits per prime")]
public int? Bits { get; set; }

[EpplusIgnore]
public string? Status { get; set; }
}
}
8 changes: 2 additions & 6 deletions src/Entities/Runner.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text;

namespace PrimeView.Entities
{
Expand Down Expand Up @@ -32,7 +28,7 @@ public string Description

if (CPU?.Brand != null)
builder.Append($"{CPU.Brand} ");

if (CPU?.Cores != null)
builder.Append($"({CPU.Cores} cores) ");

Expand Down
24 changes: 12 additions & 12 deletions src/Entities/SystemInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace PrimeView.Entities
{
public class SystemInfo
{
public string? Manufacturer { get; set; }
public string? Model { get; set; }
public string? Version { get; set; }
public string? SKU { get; set; }
public string? RaspberryManufacturer { get; set; }
public string? RaspberryType { get; set; }
public string? RaspberryRevision { get; set; }
[JsonPropertyName("virtual")]
public bool? IsVirtual { get; set; }
}
public class SystemInfo
{
public string? Manufacturer { get; set; }
public string? Model { get; set; }
public string? Version { get; set; }
public string? SKU { get; set; }
public string? RaspberryManufacturer { get; set; }
public string? RaspberryType { get; set; }
public string? RaspberryRevision { get; set; }
[JsonPropertyName("virtual")]
public bool? IsVirtual { get; set; }
}
}
Loading
Loading