初始化

This commit is contained in:
2025-11-21 08:48:01 +08:00
commit b4d684a84c
202 changed files with 28585 additions and 0 deletions

View File

@@ -0,0 +1,27 @@

using System.Collections.Concurrent;
using CommonTools;
namespace BLWLogProduce.Services
{
public class CPUDataCollect : BackgroundService
{
public static ConcurrentBag<double> CPU_Data = new ConcurrentBag<double>();
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
return Task.Factory.StartNew(async () =>
{
var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));
while (await timer.WaitForNextTickAsync(stoppingToken))
{
Console.WriteLine("HostServiceTest_A is doing work.");
double d = CPUData.GetCPU();
CPUDataCollect.CPU_Data.Add(d);
}
Console.WriteLine("HostServiceTest_A task done.");
}, TaskCreationOptions.LongRunning);
}
}
}