Commit Graph

34 Commits (dd6e3dd111fda5b9727c57276b9533e0156bf7e3)

Author SHA1 Message Date
MarcLeclair 24bce64e0b
16373 Count the # of inflations done on startup (#16778)
* For #16373: Added performance Inflater to counter # of inflations

This class is quite straight forward. The only thing that I have to point out is the onCreateView method. It usually
calls its super if you don't override it. The problem with that is that the super.onCreateView actually uses
android.view. as a prefix for the XML element it tries to inflate. So if we have an element that isn't part
of that package, it'll crash. As I said in the code, a good example is ImageButton. Calling android.view.ImageButton
will make the app crash. The method is implemented the same way that PhoneLayoutInflater does (Another example
is the AsyncLayoutInflater)

* For #16373: Added test for PerformanceInflater

This test got quite awkward / complicated fast.  I wanted to test the  to make sure we don't break *any* of our layouts
and to do so, I decided to just retrieve all our XML in our /res/layout folder. However, this gets quite a bit outside of a unit test scope.
The point was to get every layouts and get their LayoutID through the resources using the testContext we have. It gets even weirder, since some
of the XML tags have special implementation in android. One of them is the <fragment> tag. That tag actually is inflated by the OS using the Factory2
that the Activity.java implements. In order to get around the fragment issue, we just return a basic FrameLayout since the system LayoutInflater doesn't deal
won't ever get a <fragment> tag to inflate. Another issue was the <merge> tag. In order to inflate those, you need 1) a root view and 2) attach your view to it.
In order to be able to test those layouts file, I had to create an empty FrameLayout and use it as the root view for testing. Again, I know this is beyond the spirit of a unit test but if we use this inflater, I think it should make sure that no layouts are broken by it.

* For #16373: Overrode getSystemService to return PerformanceInflater

This allows PerformanceInflater to be called in every inflation to keep track of the number of inflations we do.

* For #16373: Added UI test for # of inflations

* For #16373: Lint fix

* For #167373: Changed the LayoutInflater cloneInContext to take this instead of inflater

The inflater parameter is set on the first call from the OS from  the Window object. However, the activity itself sets multiple factories on the inflater
during its creation (usually through AppCompatDelegateImpl.java). This means that, once we initially set the inflater with a null check, we pass an inflater
that has no factory initially. However, since we keep a reference to it, when cloneInContext was called, it cloned the inflater with the original inflater
which didn't have any factories set up. This meant that the app would crash on either browserFragment creation or any thing that required appCompat (such as
ImageView and ImageButton). Now, passing itself with a cloneInContext means we keep all the factories initially set by the activity or the fragment.

* For #16373: Fixed code issues for PR. No behavior change

* For #16373: fixed some code nits
3 years ago
Michael Comella e8bf955893 No issue: move StrictModeManager to perf package.
While StrictMode is not exclusively used for performance purposes, it's
primarily used for perf purposes so let's move it to the perf package
and code owner it.
4 years ago
Michael Comella afa080c956 For #15279 - review: set LazyMonitored to private. 4 years ago
Michael Comella 89541a17f7 For #15279: LazyMonitored implement Lazy + update built-in API use.
By having LazyMonitored implement Lazy, we can continue to pass these
values directly into the ac APIs that require Lazy references. For some
reason, implementing `Lazy.value` can replace `operator fun getValue`
required for delegates.
4 years ago
Michael Comella f37ace0630 For #15279: add LazyMonitored and tests. 4 years ago
MarcLeclair 7b1af41b40
15278 detekt rule runblocking (#15942)
* For #15278: added CoroutineManager to count runBlocking calls

* For #15278: Added actual detekt rule for runblocking and its config to the yaml

* For #15278: Added unit test for RunblockingCounter

* For #15278: renamed StrictModeStartupSuppressionCountTest.kt to PerformanceStartupTest.kt and added runBlockingCount test

* Lint fix

* For #15278: made runblocking a Long to prevent overflow

* For #15278: fixed MozRunblocking name, description and moved RunBlockingCounter to perf package

* For #15278:Renamed MozillaRunblockingCheck to MozillaRunBlockingCheck

* For #15278: Added setup for unit test, since it failed without restting counter

* For #15278: Fixed naming for RunBlocking lint check

* For #15278: removed changes made to test to use runBlockingIncrement

* For #15728: added test exclusion for runBlocking check

* For #15278: changed null check and added Synchronized to count setter

* For #15278: fix for nits

* For #15278: added StartupExcessiveResourceUseTest to CODEOWNERS

* For #15278: fixed for nits

* For #15278: Moved increment function to extension function and fixed indentation

* For #15278: Added tests for Atomic Integer extension and nit fix
4 years ago
sraturi 8f16f9cb37 for #10069 added AppLaunchTimeMeasurement.kt to handle logic of startup time for cold, warm, and hot startup types. 4 years ago
sraturi 5ccbca25c0 for #13479, added a VisualCompletenessQueue.kt class to handle all the functionality related to visual completeness 4 years ago
Michael Comella 5d8c900391 For #12802: add StorageStats glean metrics. 4 years ago
Michael Comella 923d841403 For #12345: replace Activity.reportFullyDrawnSafe with a-c impl. 4 years ago
Tiger Oakes c08d375c18
Move settings in components (#12675) 4 years ago
ekager e358f95eed For #12364 - Only show PWA prompt the third time a user visits installable site 4 years ago
Tiger Oakes 6be39aebde
Add tests for StartupReportFullyDrawn (#12560) 4 years ago
Michael Comella 3e617245b5 For #12345: catch SecurityException when calling reportFullyDrawn.
That's amazing! I've got the same combination on my luggage.
4 years ago
Tiger Oakes 9a8b800a76 For #8621 - fix intermittent test failures 4 years ago
mcarare 2090b11c97 For #10434: Handle cases when proc/$pid/stat is not accessible. 4 years ago
mcarare 9ec6ebc92a For #10969: Fix and clarify logic for checking showing PWA dialog. 4 years ago
Simon Chae 5ba9cc6ec9
For #10253: Add disableFirstTimePWAPopup for performance testing (#10442) 4 years ago
Michael Comella f3ed207bdb For #8803 - review: Add clarifying comments to onAppInit capture methods. 4 years ago
Michael Comella f49fc6dad2 For #8803: hook up frameworkStart metric. 4 years ago
Michael Comella dbf733d70a For #8803: add StartupFrameworkStartMeasurement.
This class controls the central logic around the metrics we want to
record.
4 years ago
Michael Comella 7f618a6a7c For #8803: add Stat and test.
We need to access the data in stat to get the process start time, so we
can calculate the time from process start until application.init for the
frameworkStart probe.
4 years ago
Grisha Kruglov be1fa8df7d Pre: introduce a RunWhenReadyQueue
This replaces the StartupTaskManager we had with a more general class.
New implementation is a thread-safe "gated task executor", which either
runs the task right away if it's marked as 'ready', or queries it to be
executed later on.

This ability to either execute or queue a task will be useful later on in the
commit series.
4 years ago
Michael Comella 5bd0369aed No issue: remove unused HotStartPerformanceMonitor.
This monitor for hot start was intended to be used by FNPRMS to measure
hot start. However, hot start was deprioritized so it's now essentially
unused.
4 years ago
Harshal Lele e318cd7d15 fix #8135 - remove getColorFromAttr 4 years ago
Michael Comella 9ed43b60b6 For #7781: instrument visual completeness for top sites.
Eyeballing my output in *Debug builds on my P2, this adds approximately 115ms
or slightly less from first frame drawn to visually complete time.
4 years ago
Michael Comella 4605ba9124 No issue: make Performance methods private that can be. 4 years ago
Will Hawkins f9b716286a For #8034: Create a post-visual completeness executor
Create an object that will execute its enqued tasks
when Fenix is visually complete.
4 years ago
MarcLeclair 834d7e13cd
Remove Tracking protection popup for visual testing (#8226)
* For #6903: allow override TP popup for performanceTest

* For #6903: refactored the code
4 years ago
Michael Comella e25ee98d7d No issue: fix typo in Performance.instrumentColdStartup... (#7848) 4 years ago
Michael Comella ffc441f12a For perf-frontend-issues#50: instrument imperfect reportFullyDrawn.
We don't capture the second RV draw yet. Unfortunately, I don't know if
it's the best use of my time to capture that as well.
4 years ago
Michael Comella 2a4aa24195 For perf-frontend-issues#33: Clarify VERBOSE logging motivation. 5 years ago
Michael Comella eef080a46c For perf-frontend-issues#33: Add HotStartPerformanceMonitorTest.
We really don't want our startup tests to subtlely change so I thought
it was worth writing some quick tests.
5 years ago
Michael Comella e60141e98d For perf-frontend-issues#33: Add HotStartPerformanceMonitor.
As mentioned in the class comment, we could use an alternative
implementation to measure perf from outside the application however
it's more complicated to set up and less consistent with our cold
startup methodology so we'll start with this.
5 years ago