Add tuning options related to performance warnings

Related: #16462.
PR #16538.
This commit is contained in:
Chocobo1
2022-03-01 12:44:48 +08:00
committed by GitHub
parent 36c14ca587
commit ac97ed685f
7 changed files with 95 additions and 6 deletions

View File

@@ -306,6 +306,8 @@ void AppController::preferencesAction()
// Disk write cache
data["disk_cache"] = session->diskCacheSize();
data["disk_cache_ttl"] = session->diskCacheTTL();
// Disk queue size
data["disk_queue_size"] = session->diskQueueSize();
// Enable OS cache
data["enable_os_cache"] = session->useOSCache();
// Coalesce reads & writes
@@ -358,6 +360,8 @@ void AppController::preferencesAction()
data["peer_turnover"] = session->peerTurnover();
data["peer_turnover_cutoff"] = session->peerTurnoverCutoff();
data["peer_turnover_interval"] = session->peerTurnoverInterval();
// Maximum outstanding requests to a single peer
data["request_queue_size"] = session->requestQueueSize();
setResult(data);
}
@@ -777,6 +781,9 @@ void AppController::setPreferencesAction()
session->setDiskCacheSize(it.value().toInt());
if (hasKey("disk_cache_ttl"))
session->setDiskCacheTTL(it.value().toInt());
// Disk queue size
if (hasKey("disk_queue_size"))
session->setDiskQueueSize(it.value().toLongLong());
// Enable OS cache
if (hasKey("enable_os_cache"))
session->setUseOSCache(it.value().toBool());
@@ -863,6 +870,9 @@ void AppController::setPreferencesAction()
session->setPeerTurnoverCutoff(it.value().toInt());
if (hasKey("peer_turnover_interval"))
session->setPeerTurnoverInterval(it.value().toInt());
// Maximum outstanding requests to a single peer
if (hasKey("request_queue_size"))
session->setRequestQueueSize(it.value().toInt());
// Save preferences
pref->apply();

View File

@@ -44,7 +44,7 @@
#include "base/utils/net.h"
#include "base/utils/version.h"
inline const Utils::Version<int, 3, 2> API_VERSION {2, 8, 6};
inline const Utils::Version<int, 3, 2> API_VERSION {2, 8, 7};
class APIController;
class WebApplication;

View File

@@ -1012,6 +1012,14 @@
<input type="text" id="diskCacheExpiryInterval" style="width: 15em;">&nbsp;&nbsp;QBT_TR(s)QBT_TR[CONTEXT=OptionsDialog]
</td>
</tr>
<tr>
<td>
<label for="diskQueueSize">QBT_TR(Disk queue size:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#max_queued_disk_bytes" target="_blank">(?)</a></label>
</td>
<td>
<input type="text" id="diskQueueSize" style="width: 15em;">&nbsp;&nbsp;QBT_TR(KiB)QBT_TR[CONTEXT=OptionsDialog]
</td>
</tr>
<tr>
<td>
<label for="enableOSCache">QBT_TR(Enable OS cache:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#disk_io_write_mode" target="_blank">(?)</a></label>
@@ -1254,6 +1262,14 @@
<input type="text" id="peerTurnoverInterval" style="width: 15em;" />&nbsp;&nbsp;s
</td>
</tr>
<tr>
<td>
<label for="requestQueueSize">QBT_TR(Maximum outstanding requests to a single peer:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#max_out_request_queue" target="_blank">(?)</a></label>
</td>
<td>
<input type="text" id="requestQueueSize" style="width: 15em;" />
</td>
</tr>
</table>
</fieldset>
</div>
@@ -1931,6 +1947,7 @@
$('outstandMemoryWhenCheckingTorrents').setProperty('value', pref.checking_memory_use);
$('diskCache').setProperty('value', pref.disk_cache);
$('diskCacheExpiryInterval').setProperty('value', pref.disk_cache_ttl);
$('diskQueueSize').setProperty('value', (pref.disk_queue_size / 1024));
$('enableOSCache').setProperty('checked', pref.enable_os_cache);
$('coalesceReadsAndWrites').setProperty('checked', pref.enable_coalesce_read_write);
$('pieceExtentAffinity').setProperty('checked', pref.enable_piece_extent_affinity);
@@ -1962,6 +1979,7 @@
$('peerTurnover').setProperty('value', pref.peer_turnover);
$('peerTurnoverCutoff').setProperty('value', pref.peer_turnover_cutoff);
$('peerTurnoverInterval').setProperty('value', pref.peer_turnover_interval);
$('requestQueueSize').setProperty('value', pref.request_queue_size);
}
}
}).send();
@@ -2326,6 +2344,7 @@
settings.set('checking_memory_use', $('outstandMemoryWhenCheckingTorrents').getProperty('value'));
settings.set('disk_cache', $('diskCache').getProperty('value'));
settings.set('disk_cache_ttl', $('diskCacheExpiryInterval').getProperty('value'));
settings.set('disk_queue_size', ($('diskQueueSize').getProperty('value') * 1024));
settings.set('enable_os_cache', $('enableOSCache').getProperty('checked'));
settings.set('enable_coalesce_read_write', $('coalesceReadsAndWrites').getProperty('checked'));
settings.set('enable_piece_extent_affinity', $('pieceExtentAffinity').getProperty('checked'));
@@ -2357,6 +2376,7 @@
settings.set('peer_turnover', $('peerTurnover').getProperty('value'));
settings.set('peer_turnover_cutoff', $('peerTurnoverCutoff').getProperty('value'));
settings.set('peer_turnover_interval', $('peerTurnoverInterval').getProperty('value'));
settings.set('request_queue_size', $('requestQueueSize').getProperty('value'));
// Send it to qBT
const json_str = JSON.encode(settings);