Ancora test con nuova modalità accesso, 15-30ms x 4kb
This commit is contained in:
@@ -14,6 +14,7 @@ using NLog;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Threading;
|
||||
|
||||
namespace Siemens_S7_Test
|
||||
{
|
||||
@@ -64,6 +65,10 @@ namespace Siemens_S7_Test
|
||||
/// </summary>
|
||||
public static Logger lg;
|
||||
/// <summary>
|
||||
/// oggetto uiTimer
|
||||
/// </summary>
|
||||
protected System.Windows.Forms.Timer uiTimer = new System.Windows.Forms.Timer();
|
||||
/// <summary>
|
||||
/// Gestione statistiche
|
||||
/// </summary>
|
||||
public TimingData PerfStats;
|
||||
@@ -77,7 +82,21 @@ namespace Siemens_S7_Test
|
||||
InitializeComponent();
|
||||
|
||||
myInit();
|
||||
|
||||
startUiTimer();
|
||||
}
|
||||
|
||||
private void startUiTimer()
|
||||
{
|
||||
uiTimer.Tick += UiTimer_Tick;
|
||||
uiTimer.Start();
|
||||
}
|
||||
|
||||
private void UiTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
advProgBar();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// inizializzo
|
||||
/// </summary>
|
||||
@@ -94,6 +113,8 @@ namespace Siemens_S7_Test
|
||||
rack = 0
|
||||
};
|
||||
setParamPlc();
|
||||
// timer
|
||||
uiTimer.Interval = 20;
|
||||
}
|
||||
/// <summary>
|
||||
/// Imposto parametri PLC
|
||||
@@ -165,9 +186,15 @@ namespace Siemens_S7_Test
|
||||
/// </summary>
|
||||
protected void updateStats()
|
||||
{
|
||||
lblTimeMin.Text = $"{PerfStats.currStat.min:0.00} s";
|
||||
lblTimeMax.Text = $"{PerfStats.currStat.max:0.00} s";
|
||||
lblTimeAvg.Text = $"{PerfStats.currStat.avg:0.00} s";
|
||||
int numByte = 1;
|
||||
int.TryParse(txtMemSize.Text, out numByte);
|
||||
int numTest = 1;
|
||||
int.TryParse(txtNumRep.Text, out numTest);
|
||||
lblTimeMin.Text = $"{PerfStats.currStat.min} ms";
|
||||
lblTimeMax.Text = $"{PerfStats.currStat.max} ms";
|
||||
lblTimeAvg.Text = $"{PerfStats.currStat.avg} ms";
|
||||
lblTotSize.Text = $"{numByte * numTest / 1024} kb";
|
||||
lblThroughtput.Text = $"{numByte / (1024 * PerfStats.currStat.avg) * 1000} bps";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -184,6 +211,8 @@ namespace Siemens_S7_Test
|
||||
int.TryParse(txtMemSize.Text, out numByte);
|
||||
int numTest = 1;
|
||||
int.TryParse(txtNumRep.Text, out numTest);
|
||||
//tslRTime.Text = "Start reading BYTE";
|
||||
//tslRTime.Invalidate();
|
||||
// effettuo numero di test secondo indicazioni...
|
||||
for (int i = 0; i < numTest; i++)
|
||||
{
|
||||
@@ -192,7 +221,7 @@ namespace Siemens_S7_Test
|
||||
memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
|
||||
sw.Stop();
|
||||
// salvo risultati
|
||||
PerfStats.addValue((double)sw.ElapsedMilliseconds / 1000);
|
||||
PerfStats.addValue((double)sw.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
// mostro update lettura
|
||||
@@ -234,7 +263,7 @@ namespace Siemens_S7_Test
|
||||
memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
|
||||
sw.Stop();
|
||||
// salvo risultati
|
||||
PerfStats.addValue((double)sw.ElapsedMilliseconds / 1000);
|
||||
PerfStats.addValue((double)sw.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
// mostro update lettura
|
||||
@@ -278,7 +307,7 @@ namespace Siemens_S7_Test
|
||||
memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
|
||||
sw.Stop();
|
||||
// salvo risultati
|
||||
PerfStats.addValue((double)sw.ElapsedMilliseconds / 1000);
|
||||
PerfStats.addValue((double)sw.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
// mostro update lettura
|
||||
@@ -362,8 +391,19 @@ namespace Siemens_S7_Test
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
}
|
||||
protected void animateProgBar()
|
||||
{
|
||||
uiTimer.Interval = 20;
|
||||
}
|
||||
|
||||
|
||||
protected void advProgBar()
|
||||
{
|
||||
toolStripProgressBar1.ProgressBar.Value++;
|
||||
if (toolStripProgressBar1.ProgressBar.Value >= toolStripProgressBar1.ProgressBar.Maximum)
|
||||
{
|
||||
toolStripProgressBar1.ProgressBar.Value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione lettura Real!
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace Siemens_S7_Test
|
||||
currStat.min = valori.Min();
|
||||
currStat.max = valori.Max();
|
||||
currStat.avg = valori.Average();
|
||||
currStat.num = valori.Count;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -46,6 +47,7 @@ namespace Siemens_S7_Test
|
||||
public double min;
|
||||
public double max;
|
||||
public double avg;
|
||||
public int num;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user