Bug 200391 - Implement memory monitoring functions for Linux OS
Summary: Implement memory monitoring functions for Linux OS
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-02 08:13 PDT by Paulo Matos
Modified: 2019-09-20 08:08 PDT (History)
20 users (show)

See Also:


Attachments
Patch (2.35 KB, patch)
2019-08-02 08:13 PDT, Paulo Matos
no flags Details | Formatted Diff | Diff
Patch (5.90 KB, patch)
2019-09-04 01:49 PDT, Paulo Matos
no flags Details | Formatted Diff | Diff
Patch (5.97 KB, patch)
2019-09-20 06:42 PDT, Paulo Matos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo Matos 2019-08-02 08:13:04 PDT
Implement memory monitoring functions for Linux OS
Comment 1 Paulo Matos 2019-08-02 08:13:46 PDT
Created attachment 375409 [details]
Patch
Comment 2 Paulo Matos 2019-08-02 08:17:26 PDT
I wanted to post this for review/discussion. Initially I discussed this with my colleague Caio and he suggested to get this in WTF, except WTF already contains memory management functions for Linux under ./Source/WTF/wtf/linux/MemoryFootprintLinux.cpp but for a completely different purpose.

Initially my reason for implementing this was to get results out of JetStream2 benchmark with memory information when ran with runMode='RAMification'.

I would like to know if this is something that upstream would like to keep in jsc.cpp or move somewhere else (maybe WTF), possibly even merging it with current functionality? Suggestions welcome.
Comment 3 Carlos Alberto Lopez Perez 2019-08-12 17:49:59 PDT
(In reply to Paulo Matos from comment #2)
> I wanted to post this for review/discussion. Initially I discussed this with
> my colleague Caio and he suggested to get this in WTF, except WTF already
> contains memory management functions for Linux under
> ./Source/WTF/wtf/linux/MemoryFootprintLinux.cpp but for a completely
> different purpose.
> 
> Initially my reason for implementing this was to get results out of
> JetStream2 benchmark with memory information when ran with
> runMode='RAMification'.
> 
> I would like to know if this is something that upstream would like to keep
> in jsc.cpp or move somewhere else (maybe WTF), possibly even merging it with
> current functionality? Suggestions welcome.

I think its reasonable to merge this with WTF/wtf/linux/MemoryFootprintLinux.cpp
and share the code.

For example, getCurrentMemoryUsage() can be implemented as returning ProcessMemoryStatus.resident after calling currentProcessMemoryStatus(ProcessMemoryStatus)


Adding resetPeak() to MemoryFootprintLinux.cpp is also reasonable.
Comment 4 Paulo Matos 2019-09-03 04:52:59 PDT
Thanks Carlos for the comments. Sorry for the delay but I have been on holidays.

I will submit a new patch later on with the changes you suggest.
Comment 5 Paulo Matos 2019-09-04 01:49:25 PDT
Created attachment 377965 [details]
Patch
Comment 6 Zan Dobersek 2019-09-20 04:19:07 PDT
Comment on attachment 377965 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=377965&action=review

Besides MemoryFootprintLinux.cpp, similar functionality also exists in bmalloc. At some point it would be nice to bring all this into a single place.

> Source/WTF/wtf/linux/ProcessMemoryFootprint.h:30
> +#if OS(LINUX)
> +#include <sys/resource.h>

Nit: this would deserve an empty line in between.

> Source/WTF/wtf/linux/ProcessMemoryFootprint.h:37
> +
> +    

Nit: and this can do with a single empty line.

> Source/WTF/wtf/linux/ProcessMemoryFootprint.h:46
> +        return { ps.resident, static_cast<uint64_t>(ru.ru_maxrss)*1024 };

Nit: spaces around the multiplication operand.
Comment 7 Paulo Matos 2019-09-20 06:42:59 PDT
Created attachment 379236 [details]
Patch
Comment 8 EWS 2019-09-20 06:48:57 PDT
Comment on attachment 379236 [details]
Patch

Rejecting attachment 379236 [details] from commit-queue.

pmatos@igalia.com does not have committer permissions according to https://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json.

- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.
Comment 9 WebKit Commit Bot 2019-09-20 07:51:15 PDT
The commit-queue encountered the following flaky tests while processing attachment 379236 [details]:

imported/w3c/web-platform-tests/websockets/bufferedAmount-unchanged-by-sync-xhr.any.worker.html bug 202003 (author: youennf@gmail.com)
The commit-queue is continuing to process your patch.
Comment 10 WebKit Commit Bot 2019-09-20 07:51:25 PDT
The commit-queue encountered the following flaky tests while processing attachment 379236 [details]:

fetch/fetch-worker-crash.html bug 187257 (author: youennf@gmail.com)
The commit-queue is continuing to process your patch.
Comment 11 WebKit Commit Bot 2019-09-20 08:07:25 PDT
Comment on attachment 379236 [details]
Patch

Clearing flags on attachment: 379236

Committed r250129: <https://trac.webkit.org/changeset/250129>
Comment 12 WebKit Commit Bot 2019-09-20 08:07:27 PDT
All reviewed patches have been landed.  Closing bug.
Comment 13 Radar WebKit Bug Importer 2019-09-20 08:08:16 PDT
<rdar://problem/55559829>