Search in sources :

Example 1 with IntListParameterImpl

use of com.biglybt.pifimpl.local.ui.config.IntListParameterImpl in project BiglyBT by BiglySoftware.

the class ConfigSectionFilePerformance method build.

@Override
public void build() {
    add(new LabelParameterImpl("ConfigView.section.file.perf.explain"));
    // diskmanager.hashchecking.strategy
    String[] strategyLabels = new String[3];
    for (int i = 0; i < strategyLabels.length; i++) {
        strategyLabels[i] = MessageText.getString("ConfigView.section.file.hashchecking.strategy." + i);
    }
    add(new IntListParameterImpl(ICFG_DISKMANAGER_HASHCHECKING_STRATEGY, "ConfigView.section.file.hashchecking.strategy", new int[] { 0, 1, 2 }, strategyLabels));
    /* replaced by strategy
		add(new BooleanParameterImpl(BCFG_DISKMANAGER_FRIENDLY_HASHCHECKING,
				"ConfigView.section.file.friendly.hashchecking"));
		*/
    // diskmanager.hashchecking.smallestfirst
    add(new BooleanParameterImpl(BCFG_DISKMANAGER_HASHCHECKING_SMALLESTFIRST, "ConfigView.section.file.hashchecking.smallestfirst"));
    // diskmanager.hashchecking.maxactive
    IntParameterImpl recheck_max_active = new IntParameterImpl(BCFG_DISKMANAGER_HASHCHECKING_MAX_ACTIVE, "ConfigView.section.file.hashchecking.maxactive");
    add(recheck_max_active, Parameter.MODE_INTERMEDIATE);
    recheck_max_active.setMinValue(0);
    add(new BooleanParameterImpl(BCFG_DISKMANAGER_ONE_OP_PER_FS, "ConfigView.section.file.one.op.per.fs"));
    // diskmanager.perf.cache.enable
    BooleanParameterImpl disk_cache = new BooleanParameterImpl(BCFG_DISKMANAGER_PERF_CACHE_ENABLE, "ConfigView.section.file.perf.cache.enable");
    add(disk_cache);
    // diskmanager.perf.cache.size
    long kinb = DisplayFormatters.getKinB();
    long max_mem_bytes = Runtime.getRuntime().maxMemory();
    long mb_1 = 1 * kinb * kinb;
    long mb_32 = 32 * mb_1;
    IntParameterImpl cache_size = new IntParameterImpl(ICFG_DISKMANAGER_PERF_CACHE_SIZE, "", 1, COConfigurationManager.CONFIG_CACHE_SIZE_MAX_MB);
    add(cache_size);
    // XXX Changed "DisplayFormatters.getUnit(DisplayFormatters.UNIT_MB)"
    // to getUnitBase10 for the release, since the # is  in MB.
    cache_size.setLabelText(MessageText.getString("ConfigView.section.file.perf.cache.size", new String[] { DisplayFormatters.getUnitBase10(DisplayFormatters.UNIT_MB) }));
    cache_size.setSuffixLabelText(MessageText.getString("ConfigView.section.file.perf.cache.size.explain", new String[] { DisplayFormatters.formatByteCountToKiBEtc(mb_32), DisplayFormatters.formatByteCountToKiBEtc(max_mem_bytes), Constants.URL_WIKI }));
    // don't cache smaller than
    IntParameterImpl cache_not_smaller_than = new IntParameterImpl(ICFG_DISKMANAGER_PERF_CACHE_NOTSMALLERTHAN, "");
    add(cache_not_smaller_than, Parameter.MODE_INTERMEDIATE);
    cache_not_smaller_than.setMinValue(0);
    // XXX Changed "DisplayFormatters.getUnit(DisplayFormatters.UNIT_KB)" to
    // getUnitBase10 for the release, since the # is stored in KB.
    cache_not_smaller_than.setLabelText(MessageText.getString("ConfigView.section.file.perf.cache.notsmallerthan", new String[] { DisplayFormatters.getUnitBase10(DisplayFormatters.UNIT_KB) }));
    // diskmanager.perf.cache.enable.read
    BooleanParameterImpl disk_cache_read = new BooleanParameterImpl(BCFG_DISKMANAGER_PERF_CACHE_ENABLE_READ, "ConfigView.section.file.perf.cache.enable.read");
    add(disk_cache_read, Parameter.MODE_INTERMEDIATE);
    // diskmanager.perf.cache.enable.write
    BooleanParameterImpl disk_cache_write = new BooleanParameterImpl(BCFG_DISKMANAGER_PERF_CACHE_ENABLE_WRITE, "ConfigView.section.file.perf.cache.enable.write");
    add(disk_cache_write, Parameter.MODE_INTERMEDIATE);
    // diskmanager.perf.cache.flushpieces
    BooleanParameterImpl disk_cache_flush = new BooleanParameterImpl(BCFG_DISKMANAGER_PERF_CACHE_FLUSHPIECES, "ConfigView.section.file.perf.cache.flushpieces");
    add(disk_cache_flush, Parameter.MODE_INTERMEDIATE);
    // diskmanager.perf.cache.trace
    BooleanParameterImpl disk_cache_trace = new BooleanParameterImpl(BCFG_DISKMANAGER_PERF_CACHE_TRACE, "ConfigView.section.file.perf.cache.trace");
    add(disk_cache_trace, Parameter.MODE_INTERMEDIATE);
    disk_cache.addEnabledOnSelection(cache_not_smaller_than, disk_cache_trace, disk_cache_read, disk_cache_write, disk_cache_flush, disk_cache_trace);
    // Max Open Files
    IntParameterImpl paramMaxOpenFiles = new IntParameterImpl(ICFG_FILE_MAX_OPEN, "ConfigView.section.file.max_open_files");
    add(paramMaxOpenFiles, Parameter.MODE_ADVANCED);
    paramMaxOpenFiles.setSuffixLabelKey("ConfigView.section.file.max_open_files.explain");
    // write mb limit
    IntParameterImpl write_block_limit = new IntParameterImpl(ICFG_DISKMANAGER_PERF_WRITE_MAXMB, "");
    add(write_block_limit, Parameter.MODE_ADVANCED);
    write_block_limit.setLabelText(MessageText.getString("ConfigView.section.file.writemblimit", new String[] { DisplayFormatters.getUnitBase10(DisplayFormatters.UNIT_MB) }));
    write_block_limit.setSuffixLabelKey("ConfigView.section.file.writemblimit.explain");
    // read mb limit
    IntParameterImpl check_piece_limit = new IntParameterImpl(ICFG_DISKMANAGER_PERF_READ_MAXMB, "");
    add(check_piece_limit, Parameter.MODE_ADVANCED);
    check_piece_limit.setLabelText(MessageText.getString("ConfigView.section.file.readmblimit", new String[] { DisplayFormatters.getUnitBase10(DisplayFormatters.UNIT_MB) }));
    check_piece_limit.setSuffixLabelKey("ConfigView.section.file.readmblimit.explain");
    disk_cache.addEnabledOnSelection(cache_size);
}
Also used : LabelParameterImpl(com.biglybt.pifimpl.local.ui.config.LabelParameterImpl) IntParameterImpl(com.biglybt.pifimpl.local.ui.config.IntParameterImpl) IntListParameterImpl(com.biglybt.pifimpl.local.ui.config.IntListParameterImpl) BooleanParameterImpl(com.biglybt.pifimpl.local.ui.config.BooleanParameterImpl)

Aggregations

BooleanParameterImpl (com.biglybt.pifimpl.local.ui.config.BooleanParameterImpl)1 IntListParameterImpl (com.biglybt.pifimpl.local.ui.config.IntListParameterImpl)1 IntParameterImpl (com.biglybt.pifimpl.local.ui.config.IntParameterImpl)1 LabelParameterImpl (com.biglybt.pifimpl.local.ui.config.LabelParameterImpl)1