aboutsummaryrefslogtreecommitdiffstats
path: root/components/profile/mem.rs
Commit message (Collapse)AuthorAgeFilesLines
* Make the memory reporting multi-process aware (#35863)webbeef2025-04-051-340/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | So far the memory reporter aggregates reports from all processes, and runs the system reporter only in the main process. Instead it is desirable to have per-process reports. We do so by: - creating a ProcessReports struct that holds includes the pid in addition to the reports themselves. - running the system memory reporter also in content processes. - updating the about:memory page to create one report per process, and add useful information like the pid and the urls loaded in a given process. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors ![image](https://github.com/user-attachments/assets/0bafe140-539d-4d6a-8316-639309a22d4a) Signed-off-by: webbeef <me@webbeef.org>
* Migrate to the 2024 edition (#35755)Simon Wülker2025-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | * Migrate to 2024 edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Allow unsafe_op_in_unsafe_fn lint This lint warns by default in the 2024 edition, but is *way* too noisy for servo. We might enable it in the future, but not now. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Compile using the 2024 edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Remove obsolete memory profiler console output (#35861)webbeef2025-03-081-316/+4
| | | Signed-off-by: webbeef <me@webbeef.org>
* Add an about:memory page (#35728)webbeef2025-03-071-1/+27
| | | | | | | | | | | | | | | | | This patch exposes a servo internal DOM API that is only made available to about: pages on the navigator object to request memory reports. The about:memory page itself is loaded like other html resources (eg. bad cert, net error) and makes use of this new API. On the implementation side, notable changes: - components/script/routed_promise.rs abstracts the setup used to fulfill a promise when the work needs to be routed through the constellation. The goal is to migrate other similar promise APIs in followup (eg. dom/webgpu/gpu.rs, bluetooth.rs). - a new message is added to request a report from the memory reporter, and the memory reporter creates a json representation of the set of memory reports. - the post-processing of memory reports is done in Javascript in the about-memory.html page, providing the same results as the current Rust code that outputs to stdout. We can decide later if we want to remove the current output. Signed-off-by: webbeef <me@webbeef.org>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-11/+13
| | | | | | | | | | | | | * Use 2024 style edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reformat all code Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Improve scheduling of the memory profiler. (#35618)webbeef2025-02-231-2/+23
| | | | | | | Switch the delay to be used between the end of a previous run and the next, instead of the start of consecutive runs. That ensure that we don't enqueue messages when processing is slower than the delay. Signed-off-by: webbeef <me@webbeef.org>
* Use `ROUTER::add_typed_route` instead of `ROUTER::add_route` everywhere (#33866)Simon Wülker2024-10-181-3/+3
| | | | | | | | | | | | | * Use ROUTER::add_typed_route where possible Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update webxr, media and ipc-channel Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* script: Create a `CrossProcessInstant` to enable serializable monotonic time ↵Martin Robinson2024-09-051-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#33282) Up until now, Servo was using a very old version of time to get a cross-process monotonic timestamp (using `time::precise_time_ns()`). This change replaces the usage of old time with a new serializable monotonic time called `CrossProcessInstant` and uses it where `u64` timestamps were stored before. The standard library doesn't provide this functionality because it isn't something you can do reliably on all platforms. The idea is that we do our best and then fall back gracefully. This is a big change, because Servo was using `u64` timestamps all over the place some as raw values taken from `time::precise_time_ns()` and some as relative offsets from the "navigation start," which is a concept similar to DOM's `timeOrigin` (but not exactly the same). It's very difficult to fix this situation without fixing it everywhere as the `Instant` concept is supposed to be opaque. The good thing is that this change clears up all ambiguity when passing times as a `time::Duration` is unit agnostic and a `CrossProcessInstant` represents an absolute moment in time. The `time` version of `Duration` is used because it can both be negative and is also serializable. Good things: - No need too pass around `time` and `time_precise` any longer. `CrossProcessInstant` is also precise and monotonic. - The distinction between a time that is unset or at `0` (at some kind of timer epoch) is now gone. There still a lot of work to do to clean up timing, but this is the first step. In general, I've tried to preserve existing behavior, even when not spec compliant, as much as possible. I plan to submit followup PRs fixing some of the issues I've noticed. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* deps: switch to `tikv-jemallocator` crates in Cargo.toml (#32828)Mukilan Thiyagarajan2024-07-221-1/+1
| | | | | | | | | | | | | | | | `jemallocator` and `jemallocator-sys` crates are same as the `tikv-*` versions and these aliases were maintained for historical reasons, based on crates.io documentation. For newer projects, it is recommended to use the `tikv-` versions of the crate. Even though Servo is not a new project, it makes sense to switch to the newer version for the sake of clarity. Also, more importantly, `tikv-jemallocator` has new release (0.6.0) which includes a fix for #32720. There doesn't seem to be a corresponding version publised for the `jemallocator` crate. Fixes #32720 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Use mallinfo only on target_env=gnu (#32772)Patrycja2024-07-141-5/+5
| | | | | | mallinfo isn't available on musl, causing linking issues on build; make sure related functions are built only for GNU Libc Signed-off-by: Patrycja Rosa <git@ptrcnull.me>
* android: use `jemalloc` on Android (#32273)Mukilan Thiyagarajan2024-05-131-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a fix for the crash issue in 64-bit ARM [#32175][1]. When targeting Android 11 and above, 64-bit ARM platforms have the 'Tagged Pointer' feature enabled by default which causes memory allocated using the system allocator to have a non-zero 'tag' set in the highest byte of heap addresses. This is incompatible with SpiderMonkey which assumes that only the bottom 48 bits are set and asserts this at various points. Both Servo and Gecko have a similar architecture where the pointer to a heap allocated DOM struct is encoded as a JS::Value and stored in the DOM_OBJECT_SLOT (reserved slot) of the JSObject which reflects the native DOM struct. As observed in #32175, even Gecko crashes with `jemalloc` disabled which suggests that support for using the native system allocator with tagged pointers enabled by default is not present at the moment. [1]: https://github.com/servo/servo/issues/32175 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Add font-fallback on OpenHarmony and fix several compilation issues (#32141)Jonathan Schwender2024-05-021-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add OpenHarmony support for allocator / profile Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * gfx: Build harfbuzz from source on OHOS Updates `freetype-sys` to v0.20.1, which includes a build fix for OpenHarmony. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * gfx: Don't depend on fontconfig on OpenHarmony Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * gfx: Add ohos font fallback Hardcode HarmonyOS_Sans_SC_Regular for Chinese Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * libservo: OHOS useragent, and explicitly opt out of sandboxing Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * libservo: Disable get_native_media_display_and_gl_context on ohos Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> --------- Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
* clippy: fix warnings in various modules in components (#31568)eri2024-03-081-12/+12
| | | | | | | | | * clippy: fix warnings in various modules in components * fix: unit tests * fix: build on android * fix: all samplers use new_boxed
* Preliminary Android build support (#31086)Mukilan Thiyagarajan2024-01-221-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Android build * Fixes * More fixes - Still failing in the linking step * More work on getting linking working Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * android: use mozjs with ndk r25c. loads servo.org more android build fixes. * fix ./mach run for android and make it follow logs Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * add experimental logic for compositor pause/resume Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * pass DPI from android to simpleservo Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * ci: add android workflow Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * switch to ANDROID_SDK_ROOT and ANDROID_NDK_ROOT vars Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * upgrade gradle to 4.10.1 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * upgrade to gradle 5.1.1 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * upgrade to gradle 8 and agp 8 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * make compositing work again with external present Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * android: improve mach support for non-NixOS and CI Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * fix sampler compilation bug introduced in #30490 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * ci: add android build to main workflow Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * gradle: set MinSdk = targetSdk = 30 NDK requires we compile against the minSdk API level which is 30 in our case. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * add instructions for android in README.md Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * apk: move servosurface to servoview Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * apk: uncomment the mediasession callbacks on MainActivity Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * apk: fix crash on MainAtivity.onDestroy Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * apk: drop VR, arm 5 and unused code This commit drops: * support for google, oculusvr * support for arm5 architecture and also removes * fakeld scripts * unused java code Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * cleanup shell.nix Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * android: add FIXMEs for gstreamer code Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * apk: remove commented code and debug logs Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * cleanup ServoView.java Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * mach: comment call to download gstreamer deps for android Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * disable bluetooth for jniapi as blurdroid is broken Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * fixup! README.md * fixup! remove change in Cargo.toml * fixup! move shell variables together * fixup! cleanup jniapi/Cargo.toml comments * delete commented gstreamer related android code Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * remove unused config variable in servbuild Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * android: more cleanup Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * force no_static_freetype only for android * use actions to manage sdk, ndk and java Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * rename embedder event names to be more clear. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * link to startup crash issue Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * fix lint issues Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * upgrade env_logger to 0.10 with duplicate exception libservo and android_logger can use env_logger 0.10 but quickcheck is still stuck on 0.8 and has not seen any activity in the last 2 years. This commit adds a duplicate exception until the quickcheck dependency can be upgraded (or replaced) Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * android: fix comments Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * disable jemalloc on android Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * fixup! replace linux with android in cfg --------- Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Unfork and upgrade jemallocator (#30963)Martin Robinson2024-01-011-1/+1
| | | | | | | | | | This dependency was forked in ##20641 in order to fix the Android build. Years have gone by and it's quite likely that many things have changed in the Android toolchain and these dependencies. We can sort out this issue when getting the Android build working -- or if all else fails, disable jemalloc for Android. In the meantime, unfork the dependency and upgrade it. Fixes #20645.
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-14/+20
| | | | | * strict imports formatting * Reformat all imports
* remove `extern crate` (#30311)Samson2023-09-081-0/+2
| | | | | | | | | | | * remove extern crate * Update components/script_plugins/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* feat: shorten thread namesyvt2021-07-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux kernel imposes a 15-byte limit on thread names[1]. This means information that does not fit in this limit, e.g., the pipeline ID of layout and script threads, is lost in a debugger and profiler (see the first column of the table below). This commit shortens the thread names used in Servo to maximize the amount of information conveyed. It also rectifies some inconsistencies in the names. | Before | After | |-------------------|-------------------| | `BluetoothThread` | `Bluetooth` | | `CanvasThread` | `Canvas` | | `display alert d` | `AlertDialog` | | `FontCacheThread` | `FontCache` | | `GLPlayerThread` | `GLPlayer` | | `HTML Parser` | `Parse:www.examp` | | `LayoutThread Pi` | `Layout(1,1)` | | `Memory profiler` | `MemoryProfiler` | | `Memory profiler` | `MemoryProfTimer` | | `OfflineAudioCon` | `OfflineACResolv` | | `PullTimelineMar` | `PullTimelineDat` | | `ScriptThread Pi` | `Script(1,1)` | | `WebWorker for h` | `WW:www.example.` | | `ServiceWorker f` | `SW:www.example.` | | `ServiceWorkerMa` | `SvcWorkerManage` | | `Time profiler t` | `TimeProfTimer` | | `Time profiler` | `TimeProfiler` | | `WebGL thread` | `WebGL` | | `Choose a device` | `DevicePicker` | | `Pick a file` | `FilePicker` | | `Pick files` | `FilePicker` | [1]: https://stackoverflow.com/questions/5026531/thread-name-longer-than-15-chars
* Fix warnings introduced in newer Rust NightlySimon Sapin2021-02-251-5/+2
| | | | | | | | | | | | This does not (yet) upgrade ./rust-toolchain The warnings: * dead_code "field is never read" * redundant_semicolons "unnecessary trailing semicolon" * non_fmt_panic "panic message is not a string literal, this is no longer accepted in Rust 2021" * unstable_name_collisions "a method with this name may be added to the standard library in the future" * legacy_derive_helpers "derive helper attribute is used before it is introduced" https://github.com/rust-lang/rust/issues/79202
* `#[global_allocator]` is stableSimon Sapin2019-07-011-7/+7
|
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* `cargo fix --edition-idioms`Simon Sapin2018-11-081-1/+1
|
* Reorder importsPyfisch2018-11-061-7/+7
|
* Format remaining filesPyfisch2018-11-061-3/+6
|
* Sort `use` statementsSimon Sapin2018-11-061-1/+1
|
* `cargo fix --edition`Simon Sapin2018-11-061-1/+1
|
* format components/profile - #21373Anshul Malik2018-09-091-56/+99
|
* Add tool to chart memory usage from reports.Josh Matthews2018-03-081-1/+7
|
* Use try syntax for Option where appropriateMatt Brubeck2017-10-201-9/+4
|
* Stop relying on linking details of std’s default allocatorSimon Sapin2017-10-191-6/+2
| | | | | | | | | | | | We’ve been bitten before by symbol names changing: https://github.com/servo/heapsize/pull/46 and upstream is planning to stop using jemalloc by default: https://github.com/rust-lang/rust/issues/33082#issuecomment-309781465 So use the (relatively) new `#[global_allocator]` attribute to explicitly select the system allocator on Windows and jemalloc (now in an external crate) on other platforms. This choice matches current defaults.
* Make use of unstable alloc_jemalloc crate optionalSimon Sapin2017-10-131-9/+11
|
* Remove usage of unstable box syntax, except in the script crateSimon Sapin2017-10-121-2/+2
| | | | | … because there’s a lot of it, and script still uses any other unstable features anyway.
* Conditionally define macro that's only used in Linux builds.Josh Matthews2017-05-291-5/+5
|
* Update regex.Ms2ger2017-01-161-3/+3
|
* Removed util.Alan Jeffrey2016-12-141-5/+4
|
* Reorder `use` statementsUK9922016-09-091-1/+1
|
* Move util::time::duration_from_seconds to profile::timeAnthony Ramine2016-06-291-1/+1
|
* Remove empty lines following braces.Josh Matthews2016-05-271-2/+0
|
* Fix all Windows warningsAnthony Ramine2016-05-161-1/+6
|
* Removed unused importsPer Lundberg2016-05-151-1/+0
| | | | This fixes #11185.
* Fix build on WindowsUK9922016-03-031-0/+6
|
* Bump to Rust 2016-02-22Anthony Ramine2016-02-231-4/+5
|
* task -> threadrohan.prinja2016-01-101-1/+1
|
* Fix a bunch of clippy lintsJohannes Linke2016-01-021-2/+1
|
* Use thread::sleep instead of deprecated sleep_msJames Sanders2015-11-291-3/+3
| | | | | | Similarly, change one instance of `thread::park_timeout_ms`. Fixes #8694
* adding tidy rule to warn against use of &String and refactoring instances of ↵jmr02015-11-251-1/+1
| | | | &String in codebase
* Fix issues found by rust-clippyCorey Farwell2015-10-121-9/+4
|
* sorted the extern crate, mod & use declarationsRavi Shankar2015-09-241-2/+2
|
* Remove 'get_*' on getters as per RFC 0344 on various componentsMathieu Rheaume2015-09-121-22/+22
|
* make test-tidy check that = have space after themerneyja2015-09-011-15/+15
|