Backout of changeset 701b76c4e716

This commit is contained in:
Honza Bambas 2011-06-09 16:07:07 +02:00
Родитель 6128e602b0
Коммит 6a8e4a1ddc
4 изменённых файлов: 0 добавлений и 260 удалений

Просмотреть файл

@ -114,8 +114,6 @@ CPPSRCS = \
# static lib. # static lib.
FORCE_STATIC_LIB = 1 FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \ LOCAL_INCLUDES += \

Просмотреть файл

@ -46,9 +46,6 @@
#define FORCE_PR_LOG 1 #define FORCE_PR_LOG 1
#endif #endif
#include "base/histogram.h"
#include "base/logging.h"
#include "nsIBrowserDOMWindow.h" #include "nsIBrowserDOMWindow.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsIContent.h" #include "nsIContent.h"
@ -111,7 +108,6 @@
#include "nsIViewManager.h" #include "nsIViewManager.h"
#include "nsIScriptChannel.h" #include "nsIScriptChannel.h"
#include "nsIOfflineCacheUpdate.h" #include "nsIOfflineCacheUpdate.h"
#include "nsITimedChannel.h"
#include "nsCPrefetchService.h" #include "nsCPrefetchService.h"
#include "nsJSON.h" #include "nsJSON.h"
#include "IHistory.h" #include "IHistory.h"
@ -6050,20 +6046,6 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
nsresult rv = aChannel->GetURI(getter_AddRefs(url)); nsresult rv = aChannel->GetURI(getter_AddRefs(url));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsITimedChannel> timingChannel =
do_QueryInterface(aChannel);
if (timingChannel) {
mozilla::TimeStamp channelCreationTime;
rv = timingChannel->GetChannelCreation(&channelCreationTime);
if (NS_SUCCEEDED(rv) && !channelCreationTime.IsNull()) {
PRUint32 interval = (PRUint32)
(mozilla::TimeStamp::Now() - channelCreationTime)
.ToMilliseconds();
UMA_HISTOGRAM_TIMES("HTTP: Total page load time (ms)",
base::TimeDelta::FromMilliseconds(interval));
}
}
// clean up reload state for meta charset // clean up reload state for meta charset
if (eCharsetReloadRequested == mCharsetReloadState) if (eCharsetReloadRequested == mCharsetReloadState)
mCharsetReloadState = eCharsetReloadStopOrigional; mCharsetReloadState = eCharsetReloadStopOrigional;

Просмотреть файл

@ -37,7 +37,6 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "base/basictypes.h"
#include "nsLoadGroup.h" #include "nsLoadGroup.h"
#include "nsISupportsArray.h" #include "nsISupportsArray.h"
#include "nsEnumeratorUtils.h" #include "nsEnumeratorUtils.h"
@ -51,8 +50,6 @@
#include "nsReadableUtils.h" #include "nsReadableUtils.h"
#include "nsString.h" #include "nsString.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "base/histogram.h"
#include "base/logging.h"
#if defined(PR_LOGGING) #if defined(PR_LOGGING)
// //
@ -69,15 +66,8 @@
static PRLogModuleInfo* gLoadGroupLog = nsnull; static PRLogModuleInfo* gLoadGroupLog = nsnull;
#endif #endif
#ifdef LOG
#undef LOG
#endif
#define LOG(args) PR_LOG(gLoadGroupLog, PR_LOG_DEBUG, args) #define LOG(args) PR_LOG(gLoadGroupLog, PR_LOG_DEBUG, args)
#define HISTOGRAM_TIME_DELTA(start, end) \
base::TimeDelta::FromMilliseconds( \
(PRUint32)((end - start).ToMilliseconds()))
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class RequestMapEntry : public PLDHashEntryHdr class RequestMapEntry : public PLDHashEntryHdr
@ -150,9 +140,6 @@ nsLoadGroup::nsLoadGroup(nsISupports* outer)
, mStatus(NS_OK) , mStatus(NS_OK)
, mPriority(PRIORITY_NORMAL) , mPriority(PRIORITY_NORMAL)
, mIsCanceling(PR_FALSE) , mIsCanceling(PR_FALSE)
, mDefaultLoadIsTimed(false)
, mTimedRequests(0)
, mCachedRequests(0)
{ {
NS_INIT_AGGREGATED(outer); NS_INIT_AGGREGATED(outer);
@ -353,8 +340,6 @@ nsLoadGroup::Cancel(nsresult status)
NS_RELEASE(request); NS_RELEASE(request);
} }
TelemetryReport();
#if defined(DEBUG) #if defined(DEBUG)
NS_ASSERTION(mRequests.entryCount == 0, "Request list is not empty."); NS_ASSERTION(mRequests.entryCount == 0, "Request list is not empty.");
NS_ASSERTION(mForegroundCount == 0, "Foreground URLs are active."); NS_ASSERTION(mForegroundCount == 0, "Foreground URLs are active.");
@ -522,14 +507,6 @@ nsLoadGroup::SetDefaultLoadRequest(nsIRequest *aRequest)
// in particular, nsIChannel::LOAD_DOCUMENT_URI... // in particular, nsIChannel::LOAD_DOCUMENT_URI...
// //
mLoadFlags &= 0xFFFF; mLoadFlags &= 0xFFFF;
nsCOMPtr<nsITimedChannel> timedChannel =
do_QueryInterface(aRequest);
mDefaultLoadIsTimed = timedChannel != nsnull;
if (mDefaultLoadIsTimed) {
timedChannel->GetChannelCreation(&mDefaultRequestCreationTime);
timedChannel->SetTimingEnabled(PR_TRUE);
}
} }
// Else, do not change the group's load flags (see bug 95981) // Else, do not change the group's load flags (see bug 95981)
return NS_OK; return NS_OK;
@ -600,10 +577,6 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt)
if (mPriority != 0) if (mPriority != 0)
RescheduleRequest(request, mPriority); RescheduleRequest(request, mPriority);
nsCOMPtr<nsITimedChannel> timedChannel = do_QueryInterface(request);
if (timedChannel)
timedChannel->SetTimingEnabled(PR_TRUE);
if (!(flags & nsIRequest::LOAD_BACKGROUND)) { if (!(flags & nsIRequest::LOAD_BACKGROUND)) {
// Update the count of foreground URIs.. // Update the count of foreground URIs..
mForegroundCount += 1; mForegroundCount += 1;
@ -686,41 +659,6 @@ nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt,
PL_DHashTableRawRemove(&mRequests, entry); PL_DHashTableRawRemove(&mRequests, entry);
// Collect telemetry stats only when default request is a timed channel.
// Don't include failed requests in the timing statistics.
if (mDefaultLoadIsTimed && NS_SUCCEEDED(aStatus)) {
nsCOMPtr<nsITimedChannel> timedChannel =
do_QueryInterface(request);
if (timedChannel) {
// Figure out if this request was served from the cache
++mTimedRequests;
mozilla::TimeStamp timeStamp;
rv = timedChannel->GetCacheReadStart(&timeStamp);
if (NS_SUCCEEDED(rv) && !timeStamp.IsNull())
++mCachedRequests;
rv = timedChannel->GetAsyncOpen(&timeStamp);
if (NS_SUCCEEDED(rv) && !timeStamp.IsNull()) {
UMA_HISTOGRAM_MEDIUM_TIMES(
"HTTP subitem: Page start -> subitem open() (ms)",
HISTOGRAM_TIME_DELTA(mDefaultRequestCreationTime, timeStamp));
}
rv = timedChannel->GetResponseStart(&timeStamp);
if (NS_SUCCEEDED(rv) && !timeStamp.IsNull()) {
UMA_HISTOGRAM_MEDIUM_TIMES(
"HTTP subitem: Page start -> first byte received for subitem reply (ms)",
HISTOGRAM_TIME_DELTA(mDefaultRequestCreationTime, timeStamp));
}
TelemetryReportChannel(timedChannel, false);
}
}
if (mRequests.entryCount == 0) {
TelemetryReport();
}
// Undo any group priority delta... // Undo any group priority delta...
if (mPriority != 0) if (mPriority != 0)
RescheduleRequest(request, -mPriority); RescheduleRequest(request, -mPriority);
@ -864,170 +802,6 @@ nsLoadGroup::AdjustPriority(PRInt32 aDelta)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void
nsLoadGroup::TelemetryReport()
{
if (mDefaultLoadIsTimed) {
UMA_HISTOGRAM_COUNTS("HTTP: Requests per page (count)",
mTimedRequests);
if (mTimedRequests) {
UMA_HISTOGRAM_ENUMERATION(
"HTTP: Requests serviced from cache (%)",
mCachedRequests * 100 / mTimedRequests,
101);
}
nsCOMPtr<nsITimedChannel> timedChannel =
do_QueryInterface(mDefaultLoadRequest);
if (timedChannel)
TelemetryReportChannel(timedChannel, true);
}
mTimedRequests = 0;
mCachedRequests = 0;
mDefaultLoadIsTimed = false;
}
void
nsLoadGroup::TelemetryReportChannel(nsITimedChannel *aTimedChannel,
bool aDefaultRequest)
{
nsresult rv;
PRBool timingEnabled;
rv = aTimedChannel->GetTimingEnabled(&timingEnabled);
if (NS_FAILED(rv) || !timingEnabled)
return;
mozilla::TimeStamp channelCreation;
rv = aTimedChannel->GetChannelCreation(&channelCreation);
if (NS_FAILED(rv))
return;
mozilla::TimeStamp asyncOpen;
rv = aTimedChannel->GetAsyncOpen(&asyncOpen);
if (NS_FAILED(rv))
return;
mozilla::TimeStamp cacheReadStart;
rv = aTimedChannel->GetCacheReadStart(&cacheReadStart);
if (NS_FAILED(rv))
return;
mozilla::TimeStamp cacheReadEnd;
rv = aTimedChannel->GetCacheReadEnd(&cacheReadEnd);
if (NS_FAILED(rv))
return;
mozilla::TimeStamp domainLookupStart;
rv = aTimedChannel->GetDomainLookupStart(&domainLookupStart);
if (NS_FAILED(rv))
return;
mozilla::TimeStamp domainLookupEnd;
rv = aTimedChannel->GetDomainLookupEnd(&domainLookupEnd);
if (NS_FAILED(rv))
return;
mozilla::TimeStamp connectStart;
rv = aTimedChannel->GetConnectStart(&connectStart);
if (NS_FAILED(rv))
return;
mozilla::TimeStamp connectEnd;
rv = aTimedChannel->GetConnectEnd(&connectEnd);
if (NS_FAILED(rv))
return;
mozilla::TimeStamp requestStart;
rv = aTimedChannel->GetRequestStart(&requestStart);
if (NS_FAILED(rv))
return;
mozilla::TimeStamp responseStart;
rv = aTimedChannel->GetResponseStart(&responseStart);
if (NS_FAILED(rv))
return;
mozilla::TimeStamp responseEnd;
rv = aTimedChannel->GetResponseEnd(&responseEnd);
if (NS_FAILED(rv))
return;
#define _UMA_HTTP_REQUEST_HISTOGRAMS_(prefix) \
if (!domainLookupStart.IsNull()) { \
UMA_HISTOGRAM_TIMES( \
prefix "open() -> DNS request issued (ms)", \
HISTOGRAM_TIME_DELTA(asyncOpen, domainLookupStart)); \
\
UMA_HISTOGRAM_TIMES( \
prefix "DNS lookup time (ms)", \
HISTOGRAM_TIME_DELTA(domainLookupStart, domainLookupEnd)); \
} \
\
if (!connectStart.IsNull()) { \
UMA_HISTOGRAM_TIMES( \
prefix "TCP connection setup (ms)", \
HISTOGRAM_TIME_DELTA(connectStart, connectEnd)); \
} \
\
\
if (!requestStart.IsNull()) { \
UMA_HISTOGRAM_TIMES( \
prefix "Open -> first byte of request sent (ms)", \
HISTOGRAM_TIME_DELTA(asyncOpen, requestStart)); \
\
UMA_HISTOGRAM_TIMES( \
prefix "First byte of request sent -> " \
"last byte of response received (ms)", \
HISTOGRAM_TIME_DELTA(requestStart, responseEnd)); \
\
if (cacheReadStart.IsNull()) { \
UMA_HISTOGRAM_TIMES( \
prefix "Open -> first byte of reply received (ms)", \
HISTOGRAM_TIME_DELTA(asyncOpen, responseStart)); \
} \
} \
\
if (!cacheReadStart.IsNull()) { \
UMA_HISTOGRAM_TIMES( \
prefix "Open -> cache read start (ms)", \
HISTOGRAM_TIME_DELTA(asyncOpen, cacheReadStart)); \
\
UMA_HISTOGRAM_TIMES( \
prefix "Cache read time (ms)", \
HISTOGRAM_TIME_DELTA(cacheReadStart, cacheReadEnd)); \
\
if (!requestStart.IsNull()) { \
UMA_HISTOGRAM_TIMES( \
prefix "Positive cache validation time (ms)", \
HISTOGRAM_TIME_DELTA(requestStart, responseEnd)); \
} \
} \
if (!cacheReadEnd.IsNull()) { \
UMA_HISTOGRAM_TIMES( \
prefix "Overall load time - all (ms)", \
HISTOGRAM_TIME_DELTA(asyncOpen, cacheReadEnd)); \
UMA_HISTOGRAM_TIMES( \
prefix "Overall load time - cache hits (ms)", \
HISTOGRAM_TIME_DELTA(asyncOpen, cacheReadEnd)); \
} \
else if (!responseEnd.IsNull()) { \
UMA_HISTOGRAM_TIMES( \
prefix "Overall load time - all (ms)", \
HISTOGRAM_TIME_DELTA(asyncOpen, responseEnd)); \
UMA_HISTOGRAM_TIMES( \
prefix "Overall load time: network (ms)", \
HISTOGRAM_TIME_DELTA(asyncOpen, responseEnd)); \
}
if (aDefaultRequest) {
_UMA_HTTP_REQUEST_HISTOGRAMS_("HTTP page: ")
} else {
_UMA_HTTP_REQUEST_HISTOGRAMS_("HTTP subitem: ")
}
#undef _UMA_HTTP_REQUEST_HISTOGRAMS_
}
nsresult nsLoadGroup::MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& outFlags) nsresult nsLoadGroup::MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& outFlags)
{ {
nsresult rv; nsresult rv;

Просмотреть файл

@ -48,9 +48,7 @@
#include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsISupportsPriority.h" #include "nsISupportsPriority.h"
#include "nsITimedChannel.h"
#include "pldhash.h" #include "pldhash.h"
#include "mozilla/TimeStamp.h"
class nsISupportsArray; class nsISupportsArray;
@ -85,11 +83,6 @@ protected:
nsresult MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags); nsresult MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags);
private:
void TelemetryReport();
void TelemetryReportChannel(nsITimedChannel *timedChannel,
bool defaultRequest);
protected: protected:
PRUint32 mForegroundCount; PRUint32 mForegroundCount;
PRUint32 mLoadFlags; PRUint32 mLoadFlags;
@ -105,13 +98,6 @@ protected:
nsresult mStatus; nsresult mStatus;
PRInt32 mPriority; PRInt32 mPriority;
PRBool mIsCanceling; PRBool mIsCanceling;
/* Telemetry */
mozilla::TimeStamp mPageLoadStartTime;
mozilla::TimeStamp mDefaultRequestCreationTime;
bool mDefaultLoadIsTimed;
PRUint32 mTimedRequests;
PRUint32 mCachedRequests;
}; };
#endif // nsLoadGroup_h__ #endif // nsLoadGroup_h__