新增内存集备用数据

This commit is contained in:
dathlin
2017-06-28 21:59:46 +08:00
parent 52a54501c3
commit 3abb0b749d

View File

@@ -11,6 +11,7 @@ using System.Threading;
using CommonLibrary; using CommonLibrary;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using HslCommunication.BasicFramework; using HslCommunication.BasicFramework;
using System.Diagnostics;
/****************************************************************************************** /******************************************************************************************
@@ -757,6 +758,7 @@ namespace 软件系统服务端模版
statusStrip1.LayoutStyle = ToolStripLayoutStyle.StackWithOverflow; statusStrip1.LayoutStyle = ToolStripLayoutStyle.StackWithOverflow;
toolStripStatusLabel_time.ForeColor = Color.Purple;//紫色 toolStripStatusLabel_time.ForeColor = Color.Purple;//紫色
Thread thread = new Thread(new ThreadStart(ThreadTimeTick)); Thread thread = new Thread(new ThreadStart(ThreadTimeTick));
thread.IsBackground = true; thread.IsBackground = true;
thread.Start(); thread.Start();
@@ -765,14 +767,22 @@ namespace 软件系统服务端模版
/// 缓存的上次内存占用 /// 缓存的上次内存占用
/// </summary> /// </summary>
private long GC_Memery { get; set; } private long GC_Memery { get; set; }
/// <summary>
/// 程序的内存对象
/// </summary>
private long Pm_Memery { get; set; }
private void MethodOccurEverySecond() private void MethodOccurEverySecond()
{ {
long current = GC.GetTotalMemory(false); long current1 = GC.GetTotalMemory(false);
long current2 = 0;
toolStripStatusLabel_time.Text = DateTime.Now.ToString(); toolStripStatusLabel_time.Text = DateTime.Now.ToString();
label_GC_Memery.Text = current.ToString(); label_GC_Memery.Text = current1.ToString();
label_GC_Memery.BackColor = current < GC_Memery ? Color.Tomato : SystemColors.Control; label_Pm_Memery.Text = "备用";//current2.ToString();
GC_Memery = current; label_GC_Memery.BackColor = current1 < GC_Memery ? Color.Tomato : SystemColors.Control;
label_Pm_Memery.BackColor = current2 < Pm_Memery ? Color.Tomato : SystemColors.Control;
GC_Memery = current1;
Pm_Memery = current2;
} }