diff options
Diffstat (limited to 'src/Main/Forms/BenchmarkDialog.cpp')
-rw-r--r-- | src/Main/Forms/BenchmarkDialog.cpp | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp index 9d744ed8..faf85046 100644 --- a/src/Main/Forms/BenchmarkDialog.cpp +++ b/src/Main/Forms/BenchmarkDialog.cpp @@ -60,13 +60,35 @@ namespace VeraCrypt void BenchmarkDialog::OnBenchmarkButtonClick (wxCommandEvent& event) { - try - { - list <BenchmarkResult> results; + list <BenchmarkResult> results; + + wxBusyCursor busy; + Buffer buffer ((size_t) Gui->GetSelectedData <size_t> (BufferSizeChoice)); + + BenchmarkThreadRoutine routine(this, results, buffer); + Gui->ExecuteWaitThreadRoutine (this, &routine); + + BenchmarkListCtrl->DeleteAllItems(); - wxBusyCursor busy; - Buffer buffer ((size_t) Gui->GetSelectedData <size_t> (BufferSizeChoice)); + foreach (const BenchmarkResult &result, results) + { + vector <wstring> fields (BenchmarkListCtrl->GetColumnCount()); + + fields[ColumnAlgorithm] = result.AlgorithmName; + fields[ColumnEncryption] = Gui->SpeedToString (result.EncryptionSpeed); + fields[ColumnDecryption] = Gui->SpeedToString (result.DecryptionSpeed); + fields[ColumnMean] = Gui->SpeedToString (result.MeanSpeed); + Gui->AppendToListCtrl (BenchmarkListCtrl, fields); + } + + BenchmarkListCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE); + } + + void BenchmarkDialog::DoBenchmark (list<BenchmarkResult>& results, Buffer& buffer) + { + try + { EncryptionAlgorithmList encryptionAlgorithms = EncryptionAlgorithm::GetAvailableAlgorithms(); foreach (shared_ptr <EncryptionAlgorithm> ea, encryptionAlgorithms) { @@ -135,19 +157,6 @@ namespace VeraCrypt } } - BenchmarkListCtrl->DeleteAllItems(); - - foreach (const BenchmarkResult &result, results) - { - vector <wstring> fields (BenchmarkListCtrl->GetColumnCount()); - - fields[ColumnAlgorithm] = result.AlgorithmName; - fields[ColumnEncryption] = Gui->SpeedToString (result.EncryptionSpeed); - fields[ColumnDecryption] = Gui->SpeedToString (result.DecryptionSpeed); - fields[ColumnMean] = Gui->SpeedToString (result.MeanSpeed); - - Gui->AppendToListCtrl (BenchmarkListCtrl, fields); - } } catch (exception &e) { |