diff --git a/devdocs/tools.txt b/devdocs/tools.txt index ea20e350..9d703bc4 100644 --- a/devdocs/tools.txt +++ b/devdocs/tools.txt @@ -496,6 +496,9 @@ The key is to input the size of the file in bytes so here are some common file s 10 TB =10995116277760 bytes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + //DATA TYPES .net to postgres map + //http://www.npgsql.org/doc/types/basic.html + ICON GENERATOR =-=-=-=-=-=-=-=- diff --git a/server/AyaNova/generator/CoreJobMetricsSnapshot.cs b/server/AyaNova/generator/CoreJobMetricsSnapshot.cs index a49eba49..592aa3e7 100644 --- a/server/AyaNova/generator/CoreJobMetricsSnapshot.cs +++ b/server/AyaNova/generator/CoreJobMetricsSnapshot.cs @@ -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(); + ///////////////////////////////////////////// diff --git a/server/AyaNova/models/MetricMM.cs b/server/AyaNova/models/MetricMM.cs index ce7c5492..31249305 100644 --- a/server/AyaNova/models/MetricMM.cs +++ b/server/AyaNova/models/MetricMM.cs @@ -9,18 +9,26 @@ namespace AyaNova.Models /// public class MetricMM { - //DATA TYPES .net to postgres map - //http://www.npgsql.org/doc/types/basic.html - [Required] public DateTime t { get; set; } - [Required] - public float v { get; set; } - - public MetricMM() + public long Allocated { get; set; } + public long WorkingSet { get; set; } + public long PrivateBytes { get; set; } + public int Gen0 { get; set; } + public int Gen1 { get; set; } + public int Gen2 { get; set; } + public double CPU { get; set; } + + public MetricMM(long allocated, long workingSet, long privateBytes, int gen0, int gen1, int gen2, double cpu) { t = System.DateTime.UtcNow; - v=0; + Allocated = allocated; + WorkingSet=workingSet; + PrivateBytes=privateBytes; + Gen0=gen0; + Gen1=gen1; + Gen2=gen2; + CPU=cpu; } }//eoc }//eons diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index fc3ed0e1..92ba96ff 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -34,6 +34,9 @@ namespace AyaNova.Util MAXIMUM POSTGRES OBJECT NAME LENGTH: 63 CHARACTERS CURRENCY: use decimal(19,4) + //DATA TYPES .net to postgres map + //http://www.npgsql.org/doc/types/basic.html + HOW TO INDEX @@ -244,8 +247,8 @@ namespace AyaNova.Util //METRICS TABLES - //CPU - await ExecQueryAsync("CREATE TABLE ametricmm (t timestamp not null, v real not null default 0)"); + //One minute metrics + await ExecQueryAsync("CREATE TABLE ametricmm (t timestamp not null, allocated bigint,workingset bigint,privatebytes bigint,gen0 integer,gen1 integer,gen2 integer,cpu double precision)"); //SEARCH TABLES