Cambio modalità misura in stopwarch...

This commit is contained in:
Samuele E. Locatelli
2018-04-09 15:21:47 +02:00
parent 5265c6f1e4
commit 40f5ac93bd
2 changed files with 28 additions and 9 deletions
+20 -6
View File
@@ -21,7 +21,7 @@ namespace IOB_WIN
/// </summary>
protected Int32 lastCount;
protected byte[] MemBlockF = new byte[2];
protected byte[] MemBlockG = new byte[64]; // provo ad allungare vediamo che recupera...
protected byte[] MemBlockG = new byte[48]; // provo ad allungare vediamo che recupera...
protected byte[] MemBlockF_pre = new byte[2];
/// <summary>
/// wrapper chiamata lettura/scrittura SINGOLO BYTE...
@@ -502,31 +502,44 @@ namespace IOB_WIN
try
{
inizio = DateTime.Now;
stopwatch.Restart();
// leggo tutto da 0 a 43...
int memIndex = 0;
// controllo modalità lettura memoria
if (utils.CRB("MemAreaReadAll"))
{
FanucMemRW(R, FANUC.MemType.G, memIndex, ref MemBlockG);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-G-AREA", MemBlockG.Length), (long)stopwatch.Elapsed.TotalMilliseconds);
//if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-G-AREA", MemBlockG.Length), DateTime.Now.Subtract(inizio).Ticks);
}
else
{
// loggo solo i blocchi che mi interessano poi copio...
byte[] MemBlock = new byte[1];
memIndex = 12;
byte[] MemBlock = new byte[8];
memIndex = 8;
inizio = DateTime.Now;
FanucMemRW(R, FANUC.MemType.G, memIndex, ref MemBlock);
// riporto!
Buffer.BlockCopy(MemBlock, memIndex, MemBlockG, memIndex, 1);
memIndex = 30;
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-G-AREA", MemBlock.Length), (long)stopwatch.Elapsed.TotalMilliseconds);
memIndex = 24;
stopwatch.Restart();
FanucMemRW(R, FANUC.MemType.G, memIndex, ref MemBlock);
// riporto!
Buffer.BlockCopy(MemBlock, memIndex, MemBlockG, memIndex, 1);
memIndex = 43;
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-G-AREA", MemBlock.Length), (long)stopwatch.Elapsed.TotalMilliseconds);
memIndex = 40;
stopwatch.Restart();
FanucMemRW(R, FANUC.MemType.G, memIndex, ref MemBlock);
// riporto!
Buffer.BlockCopy(MemBlock, memIndex, MemBlockG, memIndex, 1);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-G-AREA", MemBlock.Length), (long)stopwatch.Elapsed.TotalMilliseconds);
//if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-G-AREA", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks);
}
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-G-AREA", MemBlockG.Length), DateTime.Now.Subtract(inizio).Ticks);
stopwatch.Stop();
// verifico modo con valore corrente, se cambia aggiorno...
CNC_MODE newMode = decodeG43(MemBlockG[43]);
if (newMode != currMode)
@@ -545,6 +558,7 @@ namespace IOB_WIN
{
lg.Error(exc, "Errore in process Mode G43");
connectionOk = false;
stopwatch.Stop();
}
}
}
+8 -3
View File
@@ -3,6 +3,7 @@ using NLog;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
@@ -254,10 +255,16 @@ namespace IOB_WIN
/// Data/ora ultimo spegnimento adapter
/// </summary>
public DateTime dtStopAdp = DateTime.Now;
#if true
/// <summary>
/// vettore gestione cronometraggi
/// </summary>
public DateTime inizio;
public DateTime inizio;
#endif
/// <summary>
/// Oggetto cronometro x campionamento durate chiamate
/// </summary>
public Stopwatch stopwatch = new Stopwatch();
/// <summary>
/// Conteggio ATTUALE ore macchina ON
/// </summary>
@@ -285,8 +292,6 @@ namespace IOB_WIN
/// Conf adapter corrente
/// </summary>
public IobConfiguration currIobConf;
/// <summary>
/// inizializzo l'oggetto sulla form SULLA BASE DEL FILE DI CONFIGURAZIONE letto
/// </summary>