forked from mirrors/gecko-dev
		
	Bug 1883391 - add telemetry to collect delta between OnDataFinished and OnStopRequest in CSSLoader. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D203945
This commit is contained in:
		
							parent
							
								
									1c941a3509
								
							
						
					
					
						commit
						1a9a659014
					
				
					 3 changed files with 28 additions and 0 deletions
				
			
		|  | @ -7,6 +7,7 @@ | ||||||
| #include "mozilla/css/StreamLoader.h" | #include "mozilla/css/StreamLoader.h" | ||||||
| #include "mozilla/StaticPrefs_network.h" | #include "mozilla/StaticPrefs_network.h" | ||||||
| #include "mozilla/Encoding.h" | #include "mozilla/Encoding.h" | ||||||
|  | #include "mozilla/glean/GleanMetrics.h" | ||||||
| #include "mozilla/TaskQueue.h" | #include "mozilla/TaskQueue.h" | ||||||
| #include "nsContentUtils.h" | #include "nsContentUtils.h" | ||||||
| #include "nsIChannel.h" | #include "nsIChannel.h" | ||||||
|  | @ -116,6 +117,13 @@ StreamLoader::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) { | ||||||
|   // Resolution of parse promise fires onLoadEvent and this should not happen
 |   // Resolution of parse promise fires onLoadEvent and this should not happen
 | ||||||
|   // before main thread OnStopRequest is dispatched.
 |   // before main thread OnStopRequest is dispatched.
 | ||||||
|   if (NS_IsMainThread()) { |   if (NS_IsMainThread()) { | ||||||
|  |     if (mOnDataFinishedTime) { | ||||||
|  |       // collect telemetry for the delta between OnDataFinished and
 | ||||||
|  |       // OnStopRequest
 | ||||||
|  |       TimeDuration delta = (TimeStamp::Now() - mOnDataFinishedTime); | ||||||
|  |       glean::networking::http_content_cssloader_ondatafinished_to_onstop_delay | ||||||
|  |           .AccumulateRawDuration(delta); | ||||||
|  |     } | ||||||
|     mSheetLoadData->mSheet->BlockOrUnblockParsePromise(false); |     mSheetLoadData->mSheet->BlockOrUnblockParsePromise(false); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | @ -230,6 +238,9 @@ void StreamLoader::HandleBOM() { | ||||||
| NS_IMETHODIMP | NS_IMETHODIMP | ||||||
| StreamLoader::OnDataFinished(nsresult aResult) { | StreamLoader::OnDataFinished(nsresult aResult) { | ||||||
|   if (StaticPrefs::network_send_OnDataFinished_cssLoader()) { |   if (StaticPrefs::network_send_OnDataFinished_cssLoader()) { | ||||||
|  |     MOZ_ASSERT(mOnDataFinishedTime.IsNull(), | ||||||
|  |                "OnDataFinished should only be called once"); | ||||||
|  |     mOnDataFinishedTime = TimeStamp::Now(); | ||||||
|     return OnStopRequest(mRequest, aResult); |     return OnStopRequest(mRequest, aResult); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -60,6 +60,8 @@ class StreamLoader : public nsIThreadRetargetableStreamListener { | ||||||
|   bool mOnStopProcessingDone{false}; |   bool mOnStopProcessingDone{false}; | ||||||
|   RefPtr<SheetLoadDataHolder> mMainThreadSheetLoadData; |   RefPtr<SheetLoadDataHolder> mMainThreadSheetLoadData; | ||||||
| 
 | 
 | ||||||
|  |   mozilla::TimeStamp mOnDataFinishedTime; | ||||||
|  | 
 | ||||||
| #ifdef NIGHTLY_BUILD | #ifdef NIGHTLY_BUILD | ||||||
|   bool mChannelOpenFailed = false; |   bool mChannelOpenFailed = false; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -500,6 +500,21 @@ networking: | ||||||
|       - rjesup@mozilla.com |       - rjesup@mozilla.com | ||||||
|     expires: 130 |     expires: 130 | ||||||
| 
 | 
 | ||||||
|  |   http_content_cssloader_ondatafinished_to_onstop_delay: | ||||||
|  |     type: timing_distribution | ||||||
|  |     time_unit: millisecond | ||||||
|  |     description: > | ||||||
|  |       The time between processing OnDataFinished and processing OnStopRequest for CSSLoader in the content process | ||||||
|  |     bugs: | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1883391 | ||||||
|  |     data_reviews: | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1883391 | ||||||
|  |     data_sensitivity: | ||||||
|  |       - technical | ||||||
|  |     notification_emails: | ||||||
|  |       - necko@mozilla.com | ||||||
|  |     expires: 130 | ||||||
|  | 
 | ||||||
|   http_1_download_throughput: |   http_1_download_throughput: | ||||||
|     type: custom_distribution |     type: custom_distribution | ||||||
|     unit: mbps |     unit: mbps | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 sunil mayya
						sunil mayya