mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
(trunk libT) #1715: More stats information in rpc session-stats command
This commit is contained in:
parent
daaa450f8e
commit
cfe1358626
2 changed files with 40 additions and 0 deletions
|
@ -362,6 +362,22 @@
|
||||||
"pausedTorrentCount" | number
|
"pausedTorrentCount" | number
|
||||||
"torrentCount" | number
|
"torrentCount" | number
|
||||||
"uploadSpeed" | number
|
"uploadSpeed" | number
|
||||||
|
---------------------------+-------------------------------+
|
||||||
|
"cumulative-stats" | object, containing: |
|
||||||
|
+------------------+------------+
|
||||||
|
| uploadedBytes | number | tr_session_stats
|
||||||
|
| downloadedBytes | number | tr_session_stats
|
||||||
|
| filesAdded | number | tr_session_stats
|
||||||
|
| sessionCount | number | tr_session_stats
|
||||||
|
| secondsActive | number | tr_session_stats
|
||||||
|
---------------------------+-------------------------------+
|
||||||
|
"current-stats" | object, containing: |
|
||||||
|
+------------------+------------+
|
||||||
|
| uploadedBytes | number | tr_session_stats
|
||||||
|
| downloadedBytes | number | tr_session_stats
|
||||||
|
| filesAdded | number | tr_session_stats
|
||||||
|
| sessionCount | number | tr_session_stats
|
||||||
|
| secondsActive | number | tr_session_stats
|
||||||
|
|
||||||
|
|
||||||
5.0. Protocol Versions
|
5.0. Protocol Versions
|
||||||
|
@ -382,6 +398,8 @@
|
||||||
------+---------+-----------+----------------+-------------------------------
|
------+---------+-----------+----------------+-------------------------------
|
||||||
4 | 1.50 | yes | session-get | new arg "rpc-version"
|
4 | 1.50 | yes | session-get | new arg "rpc-version"
|
||||||
| | | session-get | new arg "rpc-version-minimum"
|
| | | session-get | new arg "rpc-version-minimum"
|
||||||
|
| | | session-stats | added "cumulative-stats"
|
||||||
|
| | | session-stats | added "current-stats"
|
||||||
| | | torrent-get | new arg "downloadDir"
|
| | | torrent-get | new arg "downloadDir"
|
||||||
------+---------+-----------+----------------+-------------------------------
|
------+---------+-----------+----------------+-------------------------------
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "rpcimpl.h"
|
#include "rpcimpl.h"
|
||||||
#include "json.h"
|
#include "json.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
#include "stats.h"
|
||||||
#include "torrent.h"
|
#include "torrent.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "web.h"
|
#include "web.h"
|
||||||
|
@ -822,6 +823,9 @@ sessionStats( tr_session * session,
|
||||||
{
|
{
|
||||||
int running = 0;
|
int running = 0;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
|
tr_benc * d;
|
||||||
|
tr_session_stats currentStats = { 0.0f, 0, 0, 0, 0, 0 };
|
||||||
|
tr_session_stats cumulativeStats = { 0.0f, 0, 0, 0, 0, 0 };
|
||||||
tr_torrent * tor = NULL;
|
tr_torrent * tor = NULL;
|
||||||
|
|
||||||
assert( idle_data == NULL );
|
assert( idle_data == NULL );
|
||||||
|
@ -832,11 +836,29 @@ sessionStats( tr_session * session,
|
||||||
++running;
|
++running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr_sessionGetStats( session, ¤tStats );
|
||||||
|
tr_sessionGetCumulativeStats( session, &cumulativeStats );
|
||||||
|
|
||||||
tr_bencDictAddInt( args_out, "activeTorrentCount", running );
|
tr_bencDictAddInt( args_out, "activeTorrentCount", running );
|
||||||
tr_bencDictAddInt( args_out, "downloadSpeed", (int)( tr_sessionGetPieceSpeed( session, TR_DOWN ) * 1024 ) );
|
tr_bencDictAddInt( args_out, "downloadSpeed", (int)( tr_sessionGetPieceSpeed( session, TR_DOWN ) * 1024 ) );
|
||||||
tr_bencDictAddInt( args_out, "pausedTorrentCount", total - running );
|
tr_bencDictAddInt( args_out, "pausedTorrentCount", total - running );
|
||||||
tr_bencDictAddInt( args_out, "torrentCount", total );
|
tr_bencDictAddInt( args_out, "torrentCount", total );
|
||||||
tr_bencDictAddInt( args_out, "uploadSpeed", (int)( tr_sessionGetPieceSpeed( session, TR_UP ) * 1024 ) );
|
tr_bencDictAddInt( args_out, "uploadSpeed", (int)( tr_sessionGetPieceSpeed( session, TR_UP ) * 1024 ) );
|
||||||
|
|
||||||
|
d = tr_bencDictAddDict( args_out, "cumulative-stats", 5 );
|
||||||
|
tr_bencDictAddInt( d, "downloadedBytes", cumulativeStats.downloadedBytes );
|
||||||
|
tr_bencDictAddInt( d, "filesAdded", cumulativeStats.filesAdded );
|
||||||
|
tr_bencDictAddInt( d, "secondsActive", cumulativeStats.secondsActive );
|
||||||
|
tr_bencDictAddInt( d, "sessionCount", cumulativeStats.sessionCount );
|
||||||
|
tr_bencDictAddInt( d, "uploadedBytes", cumulativeStats.uploadedBytes );
|
||||||
|
|
||||||
|
d = tr_bencDictAddDict( args_out, "current-stats", 5 );
|
||||||
|
tr_bencDictAddInt( d, "downloadedBytes", currentStats.downloadedBytes );
|
||||||
|
tr_bencDictAddInt( d, "filesAdded", currentStats.filesAdded );
|
||||||
|
tr_bencDictAddInt( d, "secondsActive", currentStats.secondsActive );
|
||||||
|
tr_bencDictAddInt( d, "sessionCount", currentStats.sessionCount );
|
||||||
|
tr_bencDictAddInt( d, "uploadedBytes", currentStats.uploadedBytes );
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue