mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-15 05:36:17 +00:00
Added runtime::MemoryManager to split out unrelated features from ChunkManager.
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include <torrent/data/file_manager.h>
|
#include <torrent/data/file_manager.h>
|
||||||
#include <torrent/data/chunk_utils.h>
|
#include <torrent/data/chunk_utils.h>
|
||||||
#include <torrent/runtime/runtime.h>
|
#include <torrent/runtime/runtime.h>
|
||||||
|
#include <torrent/runtime/memory_manager.h>
|
||||||
#include <torrent/runtime/socket_manager.h>
|
#include <torrent/runtime/socket_manager.h>
|
||||||
#include <torrent/utils/chrono.h>
|
#include <torrent/utils/chrono.h>
|
||||||
#include <torrent/utils/option_strings.h>
|
#include <torrent/utils/option_strings.h>
|
||||||
@@ -281,11 +282,11 @@ initialize_command_local() {
|
|||||||
CMD_ANY ("pieces.preload.min_rate", std::bind(&CM_t::preload_required_rate, chunkManager));
|
CMD_ANY ("pieces.preload.min_rate", std::bind(&CM_t::preload_required_rate, chunkManager));
|
||||||
CMD_ANY_VALUE_V ("pieces.preload.min_rate.set", std::bind(&CM_t::set_preload_required_rate, chunkManager, std::placeholders::_2));
|
CMD_ANY_VALUE_V ("pieces.preload.min_rate.set", std::bind(&CM_t::set_preload_required_rate, chunkManager, std::placeholders::_2));
|
||||||
|
|
||||||
CMD_ANY ("pieces.memory.current", std::bind(&CM_t::memory_usage, chunkManager));
|
CMD_ANY ("pieces.memory.current", [](auto, auto) { return torrent::runtime::memory_manager()->memory_usage(); });
|
||||||
CMD_ANY ("pieces.memory.sync_queue", std::bind(&CM_t::sync_queue_memory_usage, chunkManager));
|
CMD_ANY ("pieces.memory.sync_queue", std::bind(&CM_t::sync_queue_memory_usage, chunkManager));
|
||||||
CMD_ANY ("pieces.memory.block_count", std::bind(&CM_t::memory_block_count, chunkManager));
|
CMD_ANY ("pieces.memory.block_count", [](auto, auto) { return torrent::runtime::memory_manager()->memory_block_count(); });
|
||||||
CMD_ANY ("pieces.memory.max", std::bind(&CM_t::max_memory_usage, chunkManager));
|
CMD_ANY ("pieces.memory.max", [](auto, auto) { return torrent::runtime::memory_manager()->max_memory_usage(); });
|
||||||
CMD_ANY_VALUE_V ("pieces.memory.max.set", std::bind(&CM_t::set_max_memory_usage, chunkManager, std::placeholders::_2));
|
CMD_ANY_VALUE_V ("pieces.memory.max.set", [](auto, auto& value) { return torrent::runtime::memory_manager()->set_max_memory_usage(value); });
|
||||||
CMD_ANY ("pieces.stats_preloaded", std::bind(&CM_t::stats_preloaded, chunkManager));
|
CMD_ANY ("pieces.stats_preloaded", std::bind(&CM_t::stats_preloaded, chunkManager));
|
||||||
CMD_ANY ("pieces.stats_not_preloaded", std::bind(&CM_t::stats_not_preloaded, chunkManager));
|
CMD_ANY ("pieces.stats_not_preloaded", std::bind(&CM_t::stats_not_preloaded, chunkManager));
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -11,6 +11,7 @@
|
|||||||
#include <torrent/exceptions.h>
|
#include <torrent/exceptions.h>
|
||||||
#include <torrent/data/chunk_utils.h>
|
#include <torrent/data/chunk_utils.h>
|
||||||
#include <torrent/net/fd.h>
|
#include <torrent/net/fd.h>
|
||||||
|
#include <torrent/runtime/memory_manager.h>
|
||||||
#include <torrent/utils/chrono.h>
|
#include <torrent/utils/chrono.h>
|
||||||
#include <torrent/utils/log.h>
|
#include <torrent/utils/log.h>
|
||||||
|
|
||||||
@@ -149,8 +150,8 @@ main(int argc, char** argv) {
|
|||||||
|
|
||||||
SignalHandler::set_sigaction_handler(SIGBUS, &handle_sigbus);
|
SignalHandler::set_sigaction_handler(SIGBUS, &handle_sigbus);
|
||||||
|
|
||||||
torrent::log_add_group_output(torrent::LOG_NOTICE, "important");
|
torrent::log_add_group_output(torrent::LOG_NOTICE, "important");
|
||||||
torrent::log_add_group_output(torrent::LOG_DHT_ERROR, "important");
|
torrent::log_add_group_output(torrent::LOG_DHT_ERROR, "important");
|
||||||
|
|
||||||
torrent::log_add_group_output(torrent::LOG_INFO, "complete");
|
torrent::log_add_group_output(torrent::LOG_INFO, "complete");
|
||||||
torrent::log_add_group_output(torrent::LOG_DHT_ERROR, "complete");
|
torrent::log_add_group_output(torrent::LOG_DHT_ERROR, "complete");
|
||||||
@@ -443,6 +444,7 @@ main(int argc, char** argv) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
LT_LOG("seeded srandom and srand48 (seed:%u)", random_seed);
|
LT_LOG("seeded srandom and srand48 (seed:%u)", random_seed);
|
||||||
|
LT_LOG("max memory usage: %" PRIu64, torrent::runtime::memory_manager()->max_memory_usage());
|
||||||
|
|
||||||
control->initialize();
|
control->initialize();
|
||||||
control->ui()->load_input_history();
|
control->ui()->load_input_history();
|
||||||
|
|||||||
Reference in New Issue
Block a user