protected void Page_Load(object sender, EventArgs e) { if (sm.IsInAsyncPostBack) return; #if UseServiceReference PerformanceTestingDataServiceClient svc = new PerformanceTestingDataServiceClient(); #else PerformanceTestingDataService svc = new PerformanceTestingDataService(); #endif List<DeviceInfo> deviceList = svc.GetDeviceList(); List<PerformanceCubeResult> glResultsArray = svc.GetPerformanceCubeResults(); List<MatrixTestResult> flopResultsArray = svc.GetPerformanceMatrixResults (); if (glResultsArray.Count != 0) { DeviceTable deviceTable = new DeviceTable (glResultsArray, deviceList); PopulateTable (deviceTable, GLDeviceList, false); } if (flopResultsArray.Count != 0) { DeviceTable deviceTable = new DeviceTable (flopResultsArray, deviceList); PopulateTable (deviceTable, FLOPDeviceList, true); } drawAllCharts (); }
internal DeviceTable CreateCheckedList() { DeviceTable newTable = new DeviceTable(); foreach (DeviceForTable dft in _deviceList) { if (dft.Checked) newTable._deviceList.Add(dft); } return newTable; }
internal GLResultsTable(List<PerformanceCubeResult> resultsArray, DeviceTable deviceTable) { foreach (PerformanceCubeResult result in resultsArray) { int indexOfDevice = deviceTable.Find(result.DeviceDatabaseId, result.IsMonoTouch); if (indexOfDevice > -1) { DeviceTable.DeviceForTable dft = deviceTable[indexOfDevice]; if (dft != null && dft.Checked) { bool insert = true; int insertIndex = 0; for (int i=0; i<this._resultRows.Count;i++) { if (_resultRows[i].NumTrangles == result.NumberOfTriangles) { insert = false; insertIndex = i; break; } else if (_resultRows[i].NumTrangles > result.NumberOfTriangles) { insertIndex = i; break; } else if (i+1==_resultRows.Count) { insertIndex = _resultRows.Count; } } ResultRow row; if (insert) { row = new ResultRow (result.NumberOfTriangles, deviceTable.NuberOfDevices); if (insertIndex < _resultRows.Count) _resultRows.Insert (insertIndex, row); else _resultRows.Add (row); } else row = _resultRows[insertIndex]; row[indexOfDevice] = result.FramesPerSecond; } } } }
internal FLOPResultsTable(List<MatrixTestResult> resultsArray, DeviceTable deviceTable) { foreach (MatrixTestResult result in resultsArray) { int indexOfDevice = deviceTable.Find (result.DeviceDatabaseId); if (indexOfDevice > -1) { ResultRow resultRow = _resultRows.Find ((e)=>{return e.DeviceId == result.DeviceDatabaseId;}); if (resultRow == null) { resultRow = new ResultRow (result.DeviceDatabaseId); _resultRows.Add (resultRow); } resultRow.AddResultInfo (result); } } }
private string GetFLOPDrawScriptString() { #if UseServiceReference PerformanceTestingDataServiceClient svc = new PerformanceTestingDataServiceClient(); #else PerformanceTestingDataService svc = new PerformanceTestingDataService(); #endif List<MatrixTestResult> flopResultsArray = svc.GetPerformanceMatrixResults (); DeviceTable deviceTable = new DeviceTable (flopResultsArray, svc.GetDeviceList ()); SyncDeviceTableCheckState(deviceTable, FLOPDeviceList); if (flopResultsArray.Count == 0) { return string.Empty; } DeviceTable trimmedDeviceTable = deviceTable.CreateCheckedList(); FLOPResultsTable resultTable = new FLOPResultsTable(flopResultsArray, trimmedDeviceTable); if (resultTable.IsEmpty) { return string.Empty; } StringBuilder bob = new StringBuilder(); resultTable.WriteData(bob, BLASCheckbox.Checked); StringBuilder sb = new StringBuilder(); sb.Append("drawFLOPChartWithData("); sb.Append(bob.ToString()); sb.AppendFormat(", '{0}');", _flopChartName); return sb.ToString (); }
private void SyncDeviceTableCheckState(DeviceTable deviceTable, GridView gridView) { for (int i = 0; i < deviceTable.NuberOfDevices; i++) { CheckBox chkBx = gridView.Rows[i].Cells[0].FindControl("CheckBox1") as CheckBox; deviceTable[i].Checked = chkBx.Checked; } }
void PopulateTable(DeviceTable deviceTable, GridView gridView, bool ignoreMonoField) { DataSet ds = new DataSet ("MyTables"); ds.Tables.Add ("DeviceList"); DataTable dt = ds.Tables ["DeviceList"]; dt.Columns.Add ("Device"); if (!ignoreMonoField) dt.Columns.Add ("Is Mono"); dt.Columns.Add ("Hardware Key"); for (int i = 0; i < deviceTable.NuberOfDevices; i++) { if (!ignoreMonoField) dt.Rows.Add (string.Format ("Device {0}", deviceTable [i].DatabaseId), deviceTable [i].IsMono, deviceTable [i].HardwareKey); else dt.Rows.Add (string.Format ("Device {0}", deviceTable [i].DatabaseId), deviceTable [i].HardwareKey); } gridView.DataSource = dt.DefaultView; gridView.DataBind (); for (int i = 0; i < deviceTable.NuberOfDevices; i++) { CheckBox chkBx = gridView.Rows[i].Cells[0].FindControl("CheckBox1") as CheckBox; chkBx.Checked = true; } }
private string GetGLDrawScriptString() { #if UseServiceReference PerformanceTestingDataServiceClient svc = new PerformanceTestingDataServiceClient(); #else PerformanceTestingDataService svc = new PerformanceTestingDataService(); #endif List<PerformanceCubeResult> resultsArray = svc.GetPerformanceCubeResults(); DeviceTable deviceTable = new DeviceTable (resultsArray, svc.GetDeviceList ()); SyncDeviceTableCheckState(deviceTable, GLDeviceList); if (resultsArray.Count == 0) { return string.Empty; } DeviceTable trimmedDeviceTable = deviceTable.CreateCheckedList(); GLResultsTable resultTable = new GLResultsTable(resultsArray, trimmedDeviceTable); if (resultTable.IsEmpty) { return string.Empty; } StringBuilder bob = new StringBuilder(); bob.AppendFormat("[\n['Triangles'"); for (int i = 0; i < trimmedDeviceTable.NuberOfDevices; i++) { bob.AppendFormat(", 'Device {0} - {1}'", trimmedDeviceTable[i].DatabaseId, trimmedDeviceTable[i].IsMono ? "With Mono" : "W/O Mono"); } bob.AppendFormat("],\n"); resultTable.WriteData(bob); bob.AppendFormat("]"); StringBuilder sb = new StringBuilder(); sb.Append("drawGLWithData("); sb.Append(bob.ToString()); sb.AppendFormat(", '{0}');", _glChartName); return sb.ToString (); }