diff --git a/bindings/python/src/alert.cpp b/bindings/python/src/alert.cpp index 31b7d433a..368cee31d 100644 --- a/bindings/python/src/alert.cpp +++ b/bindings/python/src/alert.cpp @@ -208,6 +208,11 @@ void bind_alert() .def(self == self) ; + class_, noncopyable>( + "torrent_error_alert", no_init) + .def_readonly("error", &torrent_error_alert::error) + ; + class_, noncopyable>( "torrent_finished_alert", no_init); @@ -464,6 +469,12 @@ void bind_alert() .value("outstanding_request_limit_reached", performance_alert::outstanding_request_limit_reached) .value("upload_limit_too_low", performance_alert::upload_limit_too_low) .value("download_limit_too_low", performance_alert::download_limit_too_low) + .value("send_buffer_watermark_too_low", performance_alert::send_buffer_watermark_too_low) + .value("too_many_optimistic_unchoke_slots", performance_alert::too_many_optimistic_unchoke_slots) + .value("bittyrant_with_no_uplimit", performance_alert::bittyrant_with_no_uplimit) + .value("too_high_disk_queue_limit", performance_alert::too_high_disk_queue_limit) + .value("too_few_outgoing_ports", performance_alert::too_few_outgoing_ports) + .value("too_few_file_descriptors", performance_alert::too_few_file_descriptors) ; class_, noncopyable>( diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 99c6e5536..f23e51982 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -429,6 +429,30 @@ namespace return ret; } + list get_cache_info(session& ses, sha1_hash ih) + { + std::vector ret; + + { + allow_threading_guard guard; + ses.get_cache_info(ih, ret); + } + + list pieces; + ptime now = time_now(); + for (std::vector::iterator i = ret.begin() + , end(ret.end()); i != end; ++i) + { + dict d; + d["piece"] = i->piece; + d["last_use"] = total_milliseconds(now - i->last_use) / 1000.f; + d["next_to_hash"] = i->next_to_hash; + d["kind"] = i->kind; + pieces.append(d); + } + return pieces; + } + #ifndef TORRENT_DISABLE_GEO_IP void load_asnum_db(session& s, std::string file) { @@ -587,9 +611,24 @@ void bind_session() .def_readonly("blocks_read", &cache_status::blocks_read) .def_readonly("blocks_read_hit", &cache_status::blocks_read_hit) .def_readonly("reads", &cache_status::reads) + .def_readonly("queued_bytes", &cache_status::queued_bytes) .def_readonly("cache_size", &cache_status::cache_size) .def_readonly("read_cache_size", &cache_status::read_cache_size) .def_readonly("total_used_buffers", &cache_status::total_used_buffers) + .def_readonly("average_queue_time", &cache_status::average_queue_time) + .def_readonly("average_read_time", &cache_status::average_read_time) + .def_readonly("average_write_time", &cache_status::average_write_time) + .def_readonly("average_hash_time", &cache_status::average_hash_time) + .def_readonly("average_job_time", &cache_status::average_job_time) + .def_readonly("average_sort_time", &cache_status::average_sort_time) + .def_readonly("job_queue_length", &cache_status::job_queue_length) + .def_readonly("cumulative_job_time", &cache_status::cumulative_job_time) + .def_readonly("cumulative_read_time", &cache_status::cumulative_read_time) + .def_readonly("cumulative_write_time", &cache_status::cumulative_write_time) + .def_readonly("cumulative_hash_time", &cache_status::cumulative_hash_time) + .def_readonly("cumulative_sort_time", &cache_status::cumulative_sort_time) + .def_readonly("total_read_back", &cache_status::total_read_back) + .def_readonly("read_queue_size", &cache_status::read_queue_size) ; class_("session", no_init) @@ -716,6 +755,7 @@ void bind_session() .def("is_paused", allow_threads(&session::is_paused)) .def("id", allow_threads(&session::id)) .def("get_cache_status", allow_threads(&session::get_cache_status)) + .def("get_cache_info", get_cache_info) .def("set_peer_id", allow_threads(&session::set_peer_id)) ; diff --git a/docs/manual.rst b/docs/manual.rst index 055e9653e..0bafadcbe 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -4566,7 +4566,7 @@ session_settings int write_cache_line_size; int optimistic_disk_retry; - bool disable_hash_check; + bool disable_hash_checks; int max_suggest_pieces; @@ -4579,7 +4579,7 @@ session_settings int udp_tracker_token_expiry; bool volatile_read_cache; bool guided_read_cache; - bool default_min_cache_age; + bool default_cache_min_age; int num_optimistic_unchoke_slots; bool no_atime_storage; @@ -5208,7 +5208,7 @@ libtorrent will only do this automatically for auto managed torrents. You can explicitly take a torrent out of upload only mode using `set_upload_mode()`_. -``disable_hash_check`` controls if downloaded pieces are verified against +``disable_hash_checks`` controls if downloaded pieces are verified against the piece hashes in the torrent file or not. The default is false, i.e. to verify all downloaded data. It may be useful to turn this off for performance profiling and simulation scenarios. Do not disable the hash check for regular @@ -5266,7 +5266,7 @@ you are sending to that peer. The intention is to optimize the RAM usage of the cache, to read ahead further for peers that you're sending faster to. -``default_min_cache_age`` is the minimum number of seconds any read +``default_cache_min_age`` is the minimum number of seconds any read cache line is kept in the cache. This defaults to one second but may be greater if ``guided_read_cache`` is enabled. Having a lower bound on the time a cache line stays in the cache is an attempt