| ApplicationExitInfoMetrics.kt |
Contains logic for recording the processes that exited in the previous sessions, i.e historical
[ApplicationExitInfo].
|
10174 |
- |
| ApplicationInitTimeContainer.kt |
A class to store the application initialization time. Time is stores in elapsed real time nano seconds |
1058 |
- |
| AppLinkIntentLaunchTypeProvider.kt |
Tracks and provides the type of the [Application] instance's launch. See [EngineSession.LoadUrlFlags] for more
details about the types.
[registerInAppOnCreate] must be called for this object to work correctly.
This class relies on specific lifecycle method call orders for the app process and the activities.
|
4124 |
- |
| AppStartReasonProvider.kt |
Provides the reason this [Application] instance was started: see [StartReason] for options and [reason] for details.
[registerInAppOnCreate] must be called for this class to work correctly.
This class relies on specific lifecycle method call orders and main thread Runnable scheduling that could potentially
change between OEMs and OS versions: **be careful when using it.** This implementation was tested on the Moto G5
Android 8.1.0 and the Pixel 2 Android 11.
@param processInfoProvider [ProcessInfoProvider] that we use to determine if the process start is of foreground
importance.
|
5371 |
- |
| ColdStartupDurationTelemetry.kt |
A class to record COLD start up telemetry. This class is intended to improve upon our mistakes from the
AppStartupTelemetry class by being simple-to-implement and simple-to-analyze (i.e. works in GLAM) rather than being a
"perfect" and comprehensive measurement.
This class relies on external state providers like [StartupStateProvider] that are tricky to implement correctly so
take the results with a grain of salt.
|
3674 |
- |
| HomeActivityRootLinearLayout.kt |
A [LinearLayout] that adds profiler markers for various methods. This is intended to be used on the root view of
[HomeActivity]'s view hierarchy to understand global measure/layout events.
|
2006 |
- |
| LazyMonitored.kt |
A function which wraps [lazy].
This functionality was previously used to add performance monitoring. This wrapper could be useful in the future to
add more monitoring. Even though this method is unused, we keep the code because re-adding this wrapper to every
component is non-trivial.
|
620 |
- |
| MarkersActivityLifecycleCallbacks.kt |
Adds a profiler marker for each activity lifecycle callbacks. The callbacks are called by the super method (e.g.
[Activity.onCreate] so the markers occur sometime during the execution of our implementation (e.g.
[org.mozilla.fenix.HomeActivity.onCreate]) rather than at the beginning or end of that method.
|
3105 |
- |
| MarkersFragmentLifecycleCallbacks.kt |
Adds a profiler marker for each fragment lifecycle callbacks. The callbacks are called by the super method (e.g.
[Fragment.onCreate] so the markers occur sometime during the execution of our implementation (e.g.
[org.mozilla.fenix.home.HomeFragment.onCreate]) rather than at the beginning or end of that method.
|
4380 |
- |
| Performance.kt |
A collection of objects related to app performance. |
4371 |
- |
| PerformanceInflater.kt |
Counts the number of inflations fenix does. This class behaves only as an inflation counter since it takes the
`inflater` that is given by the base system. This is done in order not to change the behavior of the app since all we
want to do is count the inflations done.
|
3630 |
- |
| ProcessExitRecord.kt |
Represents a single historical process exit event for display purposes.
@property date The date of the exit, formatted as "yyyy-MM-dd HH:mm:ss".
@property reason The reason for the exit, e.g. "crash_native", "low_memory".
@property processType The type of process, e.g. "content", "parent".
@property importance The process importance level at time of exit, e.g. "cached", "foreground".
@property pssInMb Proportional Set Size memory usage in megabytes.
@property rssInMb Resident Set Size memory usage in megabytes.
|
966 |
- |
| ProfilerMarkerFactProcessor.kt |
A fact processor that adds Gecko profiler markers for [Fact]s matching a specific format. We look for the following
format:
```
Fact(
action = Action.IMPLEMENTATION_DETAIL
item = <marker name>
)
```
This allows us to add profiler markers from android-components code. Using the Fact API for this purpose, rather than
calling [Profiler.addMarker] directly inside components, has trade-offs. Its downsides are that it is less explicit
and tooling does not work as well on it. However, we felt it was worthwhile because:
1. we don't know what profiler markers are useful so we want to be able to iterate quickly. Adding dependencies on
the Profiler and landing these changes across two repos hinders that
2. we want to instrument the code as close to specific method calls as possible (e.g. GeckoSession.loadUrl) but it's
not always easy to do so (e.g. in the previous example, passing a Profiler reference to GeckoEngineSession is
difficult because GES is not a global dependency)
3. we can only add Profiler markers from the main thread so adding markers will become more difficult if we have to
understand the threading needs of each Profiler call site
An additional benefit with having this infrastructure is that it's easy to add Profiler markers for local debugging.
That being said, if we find a location where it would be valuable to have a long term Profiler marker, we should
consider instrumenting it via the [Profiler] API.
|
4006 |
- |
| ProfilerMarkers.kt |
A container for functions for when adding a profiler marker is less readable (e.g. multiple lines, more advanced
logic).
|
2407 |
- |
| ProfilerProvider.kt |
Content Provider that enables stopping the Firefox Profiler and retrieving profile data via ADB. The caller will
receive the profiler data as a streams as a raw gzip-compressed profile data.
Usage: adb shell content read --uri content://<applicationId>.profiler/stop-and-upload > profile.gz
Note: Access is restricted to the ADB process (shell UID) through DUMP permission in the Manifest.
|
5892 |
- |
| ProfilerReusableComposable.kt |
Top-level card container for profiler dialogs
@param content The composable content to be displayed inside the card
|
7029 |
- |
| ProfilerService.kt |
A foreground service that manages profiling notifications in the Firefox Android app. Now uses NotificationsDelegate
to handle permission requests and notification display.
This service displays a persistent notification when profiling is active and provides a way for users to stop
profiling through the notification. The service handles starting and stopping profiling operations based on intents,
with the NotificationsDelegate managing all permission-related logic.
|
8467 |
- |
| ProfilerStartDialogFragment.kt |
Dialog fragment for starting profiling sessions. Simplified with all permission handling now delegated to the
ProfilerService and NotificationsDelegate.
|
8015 |
- |
| ProfilerStopDialogFragment.kt |
Dialog fragment for stopping profiling sessions. The dialog uses the [ProfilerViewModel] to manage the state of the
profiler.
|
4837 |
- |
| ProfilerUtils.kt |
Profiler settings enum for grouping features and settings together |
8606 |
- |
| ProfilerViewModel.kt |
Represents the various states of the profiler UI. |
10184 |
- |
| RunBlockingCounter.kt |
Counts the number of runBlocking calls made |
1757 |
- |
| StartupActivityLog.kt |
A record of the [Activity] created, started, and stopped events as well as [Application] foreground and background
events. See [log] for the log. This class is expected to be registered in [Application.onCreate] by calling
[registerInAppOnCreate].
To prevent this list from growing infinitely, we clear the list when the application is stopped. This is acceptable
from the current requirements: we never need to inspect more than the current start up.
|
4291 |
- |
| StartupPathProvider.kt |
The "path" that this activity started in. See the
[Fenix perf glossary](https://wiki.mozilla.org/index.php?title=Performance/Fenix/Glossary) for specific definitions.
|
5464 |
- |
| StartupReportFullyDrawn.kt |
Instruments the Android framework method [Activity.reportFullyDrawn], which prints time to visual completeness to
logcat.
At the time of writing (2020-02-26), this functionality is tightly coupled to FNPRMS, our internal startup
measurement system. However, these values may also appear in the Google Play Vitals dashboards.
|
3138 |
- |
| StartupStateProvider.kt |
Identifies the "state" of start up where state can be COLD/WARM/HOT and possibly others. See the
[Fenix perf glossary](https://wiki.mozilla.org/index.php?title=Performance/Fenix/Glossary) for specific definitions.
This class is nuanced: **please read the kdoc carefully before using it.** Consider contacting the perf team with
your use case.
For this class, we use the terminology from the [StartupActivityLog] such as STARTED and STOPPED. However, we're
assuming STARTED means foregrounded and STOPPED means backgrounded. If this assumption is false, the logic in this
class may be incorrect.
|
7338 |
- |
| StartupTimeline.kt |
A collection of functionality to instrument, measure, and understand startup performance. The responsibilities of
this class are to update the internal [StartupState] based on the methods called and to delegate calls to its
dependencies, which handle other functionality related to understanding startup.
This class, and its dependencies, may need to be modified for any changes in startup.
This class is not thread safe and should only be called from the main thread.
[onApplicationInit] is called from multiple processes. To minimize overhead, the class dependencies are lazily
initialized.
|
2740 |
- |
| StartupTimelineStateMachine.kt |
A state machine representing application startup for use with [StartupTimeline]. Android application startup is
complex so it's helpful to make all of our expected states explicit, e.g. with a state machine, which helps check our
assumptions. Unfortunately, because this state machine is not used by the framework to determine possible startup
scenarios, this is duplicating the startup logic and is thus extremely fragile (especially because most devs won't
know about this class when they change the startup flow!). We may be able to mitigate this with assertions.
To devs changing this class: by design as a state machine, this class should never hold any state and should be 100%
unit tested to validate assumptions.
|
2947 |
- |
| StartupTypeTelemetry.kt |
Records telemetry for the number of start ups. See the
[Fenix perf glossary](https://wiki.mozilla.org/index.php?title=Performance/Fenix/Glossary) for specific definitions.
This should be a member variable of [HomeActivity] because its data is tied to the lifecycle of an Activity. Call
[attachOnHomeActivityOnCreate] for this class to work correctly.
N.B.: this class is lightly hardcoded to HomeActivity.
|
4362 |
- |
| StopProfilerActivity.kt |
Tag used to identify the stop dialog fragment and prevent duplicates |
1673 |
- |
| StorageStatsMetrics.kt |
A collection of functions related to measuring the [StorageStats] of the application such as data dir size.
Unfortunately, this API is only available on API 26+ so the data will only be reported for those platforms.
|
3888 |
- |
| StrictModeManager.kt |
Manages strict mode settings for the application.
This class provides mechanisms to enable and configure Android's StrictMode, a developer tool that detects things you
might be doing by accident and brings them to your attention so you can fix them.
It allows for defining custom thread and VM policies, applying them, and managing suppressions of StrictMode
violations with logging and tracking.
@param isEnabledByBuildConfig A boolean indicating if StrictMode should be enabled based on the application's build
configuration.
@param components An instance of [Components] used to access core application features like the profiler. Ideally, a
more specific dependency would be injected, but this is used to work around a circular dependency where StrictMode
is part of Core, and Core would need to be passed in here.
@param buildManufacturerChecker An instance of [ManufacturerChecker] used to apply manufacturer-specific StrictMode
workarounds.
|
11998 |
- |
| ThreadPenaltyDeathWithIgnoresListener.kt |
A [StrictMode.OnThreadViolationListener] that recreates [StrictMode.ThreadPolicy.Builder.penaltyDeath] but will
ignore some violations. For example, sometimes OEMs will add code that violates StrictMode so we can ignore them here
instead of cluttering up our code with resetAfter.
This class can only be used with Android P+ so we'd have to implement workarounds if the violations we want to ignore
affect older devices.
|
7274 |
- |