mirror of
https://git.deluge-torrent.org/deluge
synced 2025-10-04 16:18:39 +00:00
sync lt and asio 1615 and upload version # of plugin
This commit is contained in:
parent
c0d8bf2d7f
commit
3de1cb9938
45 changed files with 1048 additions and 579 deletions
|
@ -37,18 +37,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifdef TORRENT_DISK_STATS
|
||||
|
||||
#include "libtorrent/time.hpp"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string log_time()
|
||||
{
|
||||
using namespace libtorrent;
|
||||
static ptime start = time_now();
|
||||
return boost::lexical_cast<std::string>(
|
||||
total_milliseconds(time_now() - start));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -64,7 +52,9 @@ namespace libtorrent
|
|||
#endif
|
||||
, m_disk_io_thread(boost::ref(*this))
|
||||
{
|
||||
|
||||
#ifdef TORRENT_STATS
|
||||
m_allocations = 0;
|
||||
#endif
|
||||
#ifdef TORRENT_DISK_STATS
|
||||
m_log.open("disk_io_thread.log", std::ios::trunc);
|
||||
#endif
|
||||
|
@ -188,9 +178,21 @@ namespace libtorrent
|
|||
char* disk_io_thread::allocate_buffer()
|
||||
{
|
||||
boost::mutex::scoped_lock l(m_mutex);
|
||||
#ifdef TORRENT_STATS
|
||||
++m_allocations;
|
||||
#endif
|
||||
return (char*)m_pool.ordered_malloc();
|
||||
}
|
||||
|
||||
void disk_io_thread::free_buffer(char* buf)
|
||||
{
|
||||
boost::mutex::scoped_lock l(m_mutex);
|
||||
#ifdef TORRENT_STATS
|
||||
--m_allocations;
|
||||
#endif
|
||||
m_pool.ordered_free(buf);
|
||||
}
|
||||
|
||||
void disk_io_thread::operator()()
|
||||
{
|
||||
for (;;)
|
||||
|
@ -225,10 +227,14 @@ namespace libtorrent
|
|||
#ifdef TORRENT_DISK_STATS
|
||||
m_log << log_time() << " read " << j.buffer_size << std::endl;
|
||||
#endif
|
||||
free_buffer = false;
|
||||
if (j.buffer == 0)
|
||||
{
|
||||
l.lock();
|
||||
j.buffer = (char*)m_pool.ordered_malloc();
|
||||
#ifdef TORRENT_STATS
|
||||
++m_allocations;
|
||||
#endif
|
||||
l.unlock();
|
||||
assert(j.buffer_size <= m_block_size);
|
||||
if (j.buffer == 0)
|
||||
|
@ -238,10 +244,6 @@ namespace libtorrent
|
|||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
free_buffer = false;
|
||||
}
|
||||
ret = j.storage->read_impl(j.buffer, j.piece, j.offset
|
||||
, j.buffer_size);
|
||||
|
||||
|
@ -301,6 +303,9 @@ namespace libtorrent
|
|||
{
|
||||
l.lock();
|
||||
m_pool.ordered_free(j.buffer);
|
||||
#ifdef TORRENT_STATS
|
||||
--m_allocations;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue