void RefreshTimer_Tick(object sender, EventArgs e) { /* just init the first time */ if (ListItems == null || ListItems.Length == 0) { ListItems = new ListViewItem[10]; for (int pos = 0; pos < ListItems.Length; pos++) { ListItems[pos] = new ListViewItem(new string[4]); } listCounters.Items.Clear(); listCounters.Items.AddRange(ListItems); } int entry = 0; double processTime = Envelope.CounterProcessing.TotalTime + Envelope.CounterVisualization.TotalTime; HighPerformanceCounter tmpCtr = new HighPerformanceCounter("Processing"); tmpCtr.TotalTime = processTime; UpdateCounter(ListItems[entry++], Envelope.CounterRuntime, 0, 0); UpdateCounter(ListItems[entry++], Envelope.CounterReading, 0, Envelope.CounterRuntime.TotalTime); UpdateCounter(ListItems[entry++], tmpCtr, 0, Envelope.CounterRuntime.TotalTime); UpdateCounter(ListItems[entry++], Envelope.CounterXlat, processTime, Envelope.CounterRuntime.TotalTime); UpdateCounter(ListItems[entry++], Envelope.CounterXlatLowpass, processTime, Envelope.CounterRuntime.TotalTime); UpdateCounter(ListItems[entry++], Envelope.CounterXlatDecimate, processTime, Envelope.CounterRuntime.TotalTime); UpdateCounter(ListItems[entry++], Envelope.CounterDemod, processTime, Envelope.CounterRuntime.TotalTime); UpdateCounter(ListItems[entry++], Envelope.CounterDemodLowpass, processTime, Envelope.CounterRuntime.TotalTime); UpdateCounter(ListItems[entry++], Envelope.CounterDemodDecimate, processTime, Envelope.CounterRuntime.TotalTime); UpdateCounter(ListItems[entry++], Envelope.CounterVisualization, processTime, Envelope.CounterRuntime.TotalTime); }
private void AddAccess(eDirection dir, int device, int length, byte[] data) { if (Counter == null) { Counter = new HighPerformanceCounter("I²C Debug"); Counter.Start(); } if (I2CAccesses == null) { I2CAccesses = new LinkedList <I2CDataEntry>(); } lock (I2CAccesses) { I2CDataEntry entry = new I2CDataEntry(); entry.Direction = dir; entry.Device = device; entry.Length = length; entry.Data = data; Counter.Stop(); entry.Timestamp = Counter.Duration; Counter.Start(); I2CAccesses.AddLast(entry); } }
void UpdateCounter(ListViewItem item, HighPerformanceCounter counter, double refTime, double refCPUTime) { if (item.SubItems[0].Text != counter.Name) { item.SubItems[0].Text = counter.Name; } item.SubItems[1].Text = String.Format("{0:0.00} s", counter.TotalTime); if (refTime > 0) { item.SubItems[2].Text = String.Format("{0:0.00} %", ((100 * counter.TotalTime) / refTime)); } else { item.SubItems[2].Text = "-"; } if (refCPUTime > 0) { item.SubItems[3].Text = String.Format("{0:0.00} %", ((100 * counter.TotalTime) / refCPUTime)); } else { item.SubItems[3].Text = "-"; } }
public FFTTransformer(int FFTSize) { this.FFTSize = FFTSize; BuildWindowFuncTable(WindowingFunction); Counter = new HighPerformanceCounter("FFTW/KISS Performance Measurement"); VarsFFTW = new FFTServerVars <double>(FFTSize); VarsKISS = new FFTServerVars <float>(FFTSize); /* try to use FFTW, fallback to KISS */ try { VarsFFTW.fplan = fftw.dft_1d(FFTSize, VarsFFTW.hinAddr, VarsFFTW.houtAddr, fftw_direction.Forward, fftw_flags.Estimate); Available = true; } catch (DllNotFoundException ex) { UseFFTW = false; } catch (BadImageFormatException ex) { UseFFTW = false; } try { VarsKISS.fplan = FFTInit(FFTSize, VarsKISS.hinAddr, VarsKISS.houtAddr); Available = true; } catch (DllNotFoundException ex) { } catch (BadImageFormatException ex) { } }