diff --git a/docs/hacking.rst b/docs/hacking.rst index b96ce86dc..a3e414189 100644 --- a/docs/hacking.rst +++ b/docs/hacking.rst @@ -119,7 +119,7 @@ libtorrent starts 3 to 5 threads. * The third thread is the SHA-1 hash thread. By default there's only one hash thread, but on multi-core machines downloading at very high rates, libtorrent can be configured to start any number of hashing threads, to take full use of multi core systems. - (see ``settings_pack::hashing_threads``). + (see ``settings_pack::aio_threads``). * The fourth and fifth threads are spawned by asio on systems that don't support asynchronous host name resolution, in order to simulate non-blocking ``getaddrinfo()``. diff --git a/docs/tuning.rst b/docs/tuning.rst index b921cfec4..96c8cd164 100644 --- a/docs/tuning.rst +++ b/docs/tuning.rst @@ -332,12 +332,12 @@ and ``settings_pack::active_seeds``. SHA-1 hashing ------------- -When downloading at very high rates, it is possible to have the CPU be the bottleneck -for passing every downloaded byte through SHA-1. In order to enable calculating SHA-1 -hashes in parallel, on multi-core systems, set ``settings_pack::hashing_threads`` -to the number of threads libtorrent should start to do SHA-1 hashing. This defaults -to 1, and only if that thread is close to saturating one core does it make sense to -increase the number of threads. +When downloading at very high rates, it is possible to have the CPU be the +bottleneck for passing every downloaded byte through SHA-1. In order to enable +calculating SHA-1 hashes in parallel, on multi-core systems, set +``settings_pack::aio_threads`` to the number of threads libtorrent should +perform I/O and do SHA-1 hashing in. Only if that thread is close to saturating +one core does it make sense to increase the number of threads. scalability =========== diff --git a/examples/client_test.cpp b/examples/client_test.cpp index 62e76ab7c..911737f2d 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -1243,7 +1243,7 @@ int main(int argc, char* argv[]) " previous command line options, so be sure to specify this first\n" " -G Add torrents in seed-mode (i.e. assume all pieces\n" " are present and check hashes on-demand)\n" - " -E specify how many hashing threads to use\n" + " -E specify how many disk I/O threads to use\n" "\n BITTORRENT OPTIONS\n" " -c sets the max number of connections\n" " -T sets the max number of connections per torrent\n" @@ -1401,7 +1401,7 @@ int main(int argc, char* argv[]) case 'B': settings.set_int(settings_pack::peer_timeout, atoi(arg)); break; case 'n': settings.set_bool(settings_pack::announce_to_all_tiers, true); --i; break; case 'G': seed_mode = true; --i; break; - case 'E': settings.set_int(settings_pack::hashing_threads, atoi(arg)); break; + case 'E': settings.set_int(settings_pack::aio_threads, atoi(arg)); break; case 'd': settings.set_int(settings_pack::download_rate_limit, atoi(arg) * 1000); break; case 'u': settings.set_int(settings_pack::upload_rate_limit, atoi(arg) * 1000); break; case 'S': diff --git a/include/libtorrent/settings_pack.hpp b/include/libtorrent/settings_pack.hpp index 884240a40..2a7f6af7d 100644 --- a/include/libtorrent/settings_pack.hpp +++ b/include/libtorrent/settings_pack.hpp @@ -1387,6 +1387,9 @@ namespace libtorrent // received by the metadata extension, i.e. magnet links. max_metadata_size, +#ifndef TORRENT_NO_DEPRECATE + // DEPRECTED: use aio_threads instead + // ``hashing_threads`` is the number of threads to use for piece hash // verification. It defaults to 1. For very high download rates, on // machines with multiple cores, this could be incremented. Setting it @@ -1394,6 +1397,9 @@ namespace libtorrent // any benefit of setting it to the number of cores. If it's set to 0, // hashing is done in the disk thread. hashing_threads, +#else + deprecated9, +#endif // the number of blocks to keep outstanding at any given time when // checking torrents. Higher numbers give faster re-checks but uses diff --git a/src/create_torrent.cpp b/src/create_torrent.cpp index 5ae63f89c..3992166f9 100644 --- a/src/create_torrent.cpp +++ b/src/create_torrent.cpp @@ -282,7 +282,7 @@ namespace libtorrent settings_pack sett; sett.set_int(settings_pack::cache_size, 0); - sett.set_int(settings_pack::hashing_threads, 2); + sett.set_int(settings_pack::aio_threads, 2); // TODO: this should probably be optional alert_manager dummy2(0, 0); diff --git a/src/session.cpp b/src/session.cpp index 6231deb3f..2278afd16 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -97,7 +97,6 @@ namespace libtorrent set.set_int(settings_pack::checking_mem_usage, 2); // don't use any extra threads to do SHA-1 hashing - set.set_int(settings_pack::hashing_threads, 0); set.set_int(settings_pack::network_threads, 0); set.set_int(settings_pack::aio_threads, 1); @@ -274,11 +273,6 @@ namespace libtorrent // connect to us if they want to set.set_int(settings_pack::max_failcount, 1); - // we're likely to have more than 4 cores on a high - // performance machine. One core is needed for the - // network thread - set.set_int(settings_pack::hashing_threads, 4); - // the number of threads to use to call async_write_some // and read_some on peer sockets // this doesn't work. See comment in settings_pack.cpp diff --git a/src/settings_pack.cpp b/src/settings_pack.cpp index 0dace4240..4a563a52c 100644 --- a/src/settings_pack.cpp +++ b/src/settings_pack.cpp @@ -316,7 +316,7 @@ namespace libtorrent SET(torrent_connect_boost, 10, 0), SET(alert_queue_size, 1000, &session_impl::update_alert_queue_size), SET(max_metadata_size, 3 * 1024 * 10240, 0), - SET(hashing_threads, 1, 0), + DEPRECATED_SET(hashing_threads, 1, 0), SET(checking_mem_usage, 256, 0), SET(predictive_piece_announce, 0, 0), SET(aio_threads, 4, &session_impl::update_disk_threads),