From 0c3a7c0a0a1f9839e6f0d06e544edf9bbe0292fb Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Fri, 18 Jul 2014 16:12:04 -0400 Subject: [PATCH] Change file ingest thread options to better match avaialble processors --- .../corecomponents/AutopsyOptionsPanel.java | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java index 4a11deab0c..11e390dbbb 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/AutopsyOptionsPanel.java @@ -29,9 +29,45 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel { AutopsyOptionsPanel(AutopsyOptionsPanelController controller) { initComponents(); - numberOfFileIngestThreadsComboBox.setModel(new DefaultComboBoxModel<>(new Integer[]{1, 2, 4, 6, 8, 12, 16})); int availableProcessors = Runtime.getRuntime().availableProcessors(); - restartRequiredLabel.setText(NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.restartRequiredLabel.text", availableProcessors > 2 ? availableProcessors - 2 : 1)); + Integer fileIngestThreadCountChoices[] = null; + int recommendedFileIngestThreadCount; + if (availableProcessors >= 16) { + fileIngestThreadCountChoices = new Integer[]{1, 2, 4, 6, 8, 12, 16}; + if (availableProcessors >= 18) { + recommendedFileIngestThreadCount = 16; + } else { + recommendedFileIngestThreadCount = 12; + } + } else if (availableProcessors >= 12 && availableProcessors <= 15) { + fileIngestThreadCountChoices = new Integer[]{1, 2, 4, 6, 8, 12}; + if (availableProcessors >= 14) { + recommendedFileIngestThreadCount = 12; + } else { + recommendedFileIngestThreadCount = 8; + } + } else if (availableProcessors >= 8 && availableProcessors <= 11) { + fileIngestThreadCountChoices = new Integer[]{1, 2, 4, 6, 8}; + if (availableProcessors >= 10) { + recommendedFileIngestThreadCount = 8; + } else { + recommendedFileIngestThreadCount = 6; + } + } else if (availableProcessors >= 6 && availableProcessors <= 7) { + fileIngestThreadCountChoices = new Integer[]{1, 2, 4, 6}; + recommendedFileIngestThreadCount = 4; + } else if (availableProcessors >= 4 && availableProcessors <= 5) { + fileIngestThreadCountChoices = new Integer[]{1, 2, 4}; + recommendedFileIngestThreadCount = 2; + } else if (availableProcessors >= 2 && availableProcessors <= 3) { + fileIngestThreadCountChoices = new Integer[]{1, 2}; + recommendedFileIngestThreadCount = 1; + } else { + fileIngestThreadCountChoices = new Integer[]{1}; + recommendedFileIngestThreadCount = 1; + } + numberOfFileIngestThreadsComboBox.setModel(new DefaultComboBoxModel<>(fileIngestThreadCountChoices)); + restartRequiredLabel.setText(NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.restartRequiredLabel.text", recommendedFileIngestThreadCount)); // TODO listen to changes in form fields and call controller.changed() }