Gestione lettura conf periodi sampling + setup x cicli principali del periodo di sampling

This commit is contained in:
Samuele Locatelli
2020-09-25 09:49:00 +02:00
parent b4fe6f0c05
commit a554e42f06
3 changed files with 27 additions and 9 deletions
+19 -9
View File
@@ -38,6 +38,20 @@ public static class ThreadsFunctions
private static ConcurrentDictionary<string, long> Counter = new ConcurrentDictionary<string, long>();
private static Thread ConnThread;
/// <summary>
/// restituisce il periodo di campionamento SE configurato, altrimenti 1000 ms
/// </summary>
/// <param name="threadName"></param>
/// <returns></returns>
private static int samplMsec(string threadName)
{
int answ = 500;
if (ThreadSamplingConfig.ContainsKey(threadName))
{
answ = ThreadSamplingConfig[threadName];
}
return answ;
}
#region Functions
@@ -526,7 +540,7 @@ public static class ThreadsFunctions
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
// Wait
Thread.Sleep(CalcSleepTime(200, (int)sw.ElapsedMilliseconds));
Thread.Sleep(CalcSleepTime(samplMsec("axis"), (int)sw.ElapsedMilliseconds));
}
}
catch (ThreadAbortException)
@@ -613,7 +627,7 @@ public static class ThreadsFunctions
//Update thread timer
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
// Wait
Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
Thread.Sleep(CalcSleepTime(samplMsec("gauges"), (int)sw.ElapsedMilliseconds));
}
}
catch (ThreadAbortException)
@@ -697,7 +711,7 @@ public static class ThreadsFunctions
//Update thread timer
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
// Wait
Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
Thread.Sleep(CalcSleepTime(samplMsec("prodInfo"), (int)sw.ElapsedMilliseconds));
}
}
catch (ThreadAbortException)
@@ -739,7 +753,7 @@ public static class ThreadsFunctions
//Update thread timer
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
// Wait
Thread.Sleep(CalcSleepTime(1000, (int)sw.ElapsedMilliseconds));
Thread.Sleep(CalcSleepTime(samplMsec("prodCycle"), (int)sw.ElapsedMilliseconds));
}
}
catch (ThreadAbortException)
@@ -925,7 +939,7 @@ public static class ThreadsFunctions
// Update thread timer
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
// Wait
Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
Thread.Sleep(CalcSleepTime(samplMsec("modules"), (int)sw.ElapsedMilliseconds));
}
}
catch (ThreadAbortException)
@@ -933,7 +947,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
public static void ReadMComandsData()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -980,7 +993,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
public static void ReadM154Data()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -1155,8 +1167,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
public static void SetupCmsConnect()
{
NcAdapter ncAdapter = new NcAdapter();