Commit 110c80f6 LN

1

1 个父辈 240b0063
......@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Reflection;
......@@ -425,9 +426,38 @@ namespace OnlineStore.AssemblyLine
Clipboard.SetDataObject(logBox.Text);
MessageBox.Show("已复制日志到粘贴板!");
}
private DateTime lastLogTime = DateTime.Now;
private void LogM()
{
try
{
TimeSpan sp = DateTime.Now - lastLogTime;
if (sp.TotalMinutes > 5)
{
lastLogTime = DateTime.Now;
Process[] processes = Process.GetProcesses();
long totalMemery = 0;
StringBuilder sbResult = new StringBuilder();
foreach (Process process in processes)
{
if (process.ProcessName.EndsWith("AssemblyLine"))
{
sbResult.AppendFormat(DateTime.Now.ToLongTimeString() + ", 名称:{0} 内存大小:{1}M ", process.ProcessName, process.PrivateMemorySize64 / 1024/1024F);
totalMemery += process.PrivateMemorySize64 / 1024;
// string result = string.Format("进程总数 {0} 个,共占内存:{1}MB \n", processes.Length, totalMemery / 1024) + sbResult.ToString();
LogUtil.info(sbResult.ToString());
}
}
}
}catch(Exception ex)
{
LogUtil.error("LogM", ex);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
LogM();
if (!this.Visible)
{
return;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!