This commit is contained in:
2020-05-25 15:33:33 +00:00
parent e1934e46c4
commit 768fc55252
4 changed files with 37 additions and 19 deletions

View File

@@ -34,6 +34,8 @@ namespace AyaNova.Biz
public static async Task DoJobAsync(AyContext ct)
{
//https://github.com/sebastienros/memoryleak/blob/master/src/MemoryLeak/MemoryLeak/Controllers/DiagnosticsController.cs
// //DATA TYPES .net to postgres map
//http://www.npgsql.org/doc/types/basic.html
//Gather stats, output to database but only every minute or more
/*
@@ -169,30 +171,32 @@ from generate_series(1, 525600) s(i)
//MEMORY
// The memory occupied by objects.
var Allocated = GC.GetTotalMemory(false);
var Allocated = GC.GetTotalMemory(false);//bigint
// The working set includes both shared and private data. The shared data includes the pages that contain all the
// instructions that the process executes, including instructions in the process modules and the system libraries.
var WorkingSet = _process.WorkingSet64;
var WorkingSet = _process.WorkingSet64;//bigint
// The value returned by this property represents the current size of memory used by the process, in bytes, that
// cannot be shared with other processes.
var PrivateBytes = _process.PrivateMemorySize64;
var PrivateBytes = _process.PrivateMemorySize64;//bigint
// The number of generation 0 collections
var Gen0 = GC.CollectionCount(0);
var Gen0 = GC.CollectionCount(0);//integer
// The number of generation 1 collections
var Gen1 = GC.CollectionCount(1);
var Gen1 = GC.CollectionCount(1);//integer
// The number of generation 2 collections
var Gen2 = GC.CollectionCount(2);
var Gen2 = GC.CollectionCount(2);//integer
var CPU=_cpu;
var CPU=_cpu;// double precision
//write to db
MetricMM mm = new MetricMM();
MetricMM mm = new MetricMM(Allocated,WorkingSet,PrivateBytes,Gen0,Gen1,Gen2,CPU);
await ct.MetricMM.AddAsync(mm);
await ct.SaveChangesAsync();
/////////////////////////////////////////////