From 5e59a2546f9dbbf58adb3a2169c3fffb58606d7e Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 22 Nov 2010 16:52:18 +0100 Subject: demo browser: Verbose output about Zerocopy usage --- demos/browser/networkaccessmanager.cpp | 9 +++++++-- demos/browser/networkaccessmanager.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'demos') diff --git a/demos/browser/networkaccessmanager.cpp b/demos/browser/networkaccessmanager.cpp index 9e717bb684..c63c0eb6da 100644 --- a/demos/browser/networkaccessmanager.cpp +++ b/demos/browser/networkaccessmanager.cpp @@ -64,7 +64,7 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) : QNetworkAccessManager(parent), requestFinishedCount(0), requestFinishedFromCacheCount(0), requestFinishedPipelinedCount(0), - requestFinishedSecureCount(0) + requestFinishedSecureCount(0), requestFinishedDownloadBufferCount(0) { connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); @@ -106,14 +106,19 @@ void NetworkAccessManager::requestFinished(QNetworkReply *reply) if (reply->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool() == true) requestFinishedSecureCount++; + if (reply->attribute(QNetworkRequest::DownloadBufferAttribute).isValid() == true) + requestFinishedDownloadBufferCount++; + if (requestFinishedCount % 10) return; double pctCached = (double(requestFinishedFromCacheCount) * 100.0/ double(requestFinishedCount)); double pctPipelined = (double(requestFinishedPipelinedCount) * 100.0/ double(requestFinishedCount)); double pctSecure = (double(requestFinishedSecureCount) * 100.0/ double(requestFinishedCount)); + double pctDownloadBuffer = (double(requestFinishedDownloadBufferCount) * 100.0/ double(requestFinishedCount)); + #ifdef QT_DEBUG - qDebug("STATS [%lli requests total] [%3.2f%% from cache] [%3.2f%% pipelined] [%3.2f%% SSL/TLS]", requestFinishedCount, pctCached, pctPipelined, pctSecure); + qDebug("STATS [%lli requests total] [%3.2f%% from cache] [%3.2f%% pipelined] [%3.2f%% SSL/TLS] [%3.2f%% Zerocopy]", requestFinishedCount, pctCached, pctPipelined, pctSecure, pctDownloadBuffer); #endif } diff --git a/demos/browser/networkaccessmanager.h b/demos/browser/networkaccessmanager.h index 76fc1980b7..d6e6ede819 100644 --- a/demos/browser/networkaccessmanager.h +++ b/demos/browser/networkaccessmanager.h @@ -60,6 +60,7 @@ private: qint64 requestFinishedFromCacheCount; qint64 requestFinishedPipelinedCount; qint64 requestFinishedSecureCount; + qint64 requestFinishedDownloadBufferCount; public slots: void loadSettings(); -- cgit v1.2.1