Commit 56dbe99c LN

增加内存验证

1 个父辈 93e90cea
......@@ -106,7 +106,40 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "FeatureOriginal 出错:" + ex.ToString());
}
}
private DateTime lastLogTime = DateTime.Now;
private bool IsHighNc()
{
try
{
TimeSpan sp = DateTime.Now - lastLogTime;
if (sp.TotalMinutes > 10)
{
lastLogTime = DateTime.Now;
Process[] processes = Process.GetProcesses();
StringBuilder sbResult = new StringBuilder();
var prevCpuTime = TimeSpan.Zero;
foreach (Process process in processes)
{
if (process.ProcessName.EndsWith("HCSingleStore"))
{
float neicM = (process.PrivateMemorySize64 / 1024 / 1024F);
if (neicM > 10000)
{
LogUtil.info(Name + "程序 HCSingleStore 当前占用内存:" + neicM + ",超过10000M,不调用视觉检测");
return true;
}
}
}
}
}
catch (Exception ex)
{
LogUtil.error("LogM Error: " + ex.ToString());
}
return false ;
}
private int vcount = 0;
/// <summary>
/// 视觉比较是否有料
......@@ -119,7 +152,7 @@ namespace OnlineStore.DeviceLibrary
LastCheckTime = DateTime.Now;
bool returnResult = false;
exist = new Dictionary<string, bool>();
if (String.IsNullOrEmpty(Config.Camera_Name))
if (String.IsNullOrEmpty(Config.Camera_Name)|| IsHighNc())
{
return ( IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH));
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!