Commit graph

31 commits

Author SHA1 Message Date
Ben Konyi
68dede011e [ VM / Service ] Add getCpuProfileSamples RPC which returns a minimally processed sample buffer.
Change-Id: Ic0a47d5eea692b235327622508d904f7396babe3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112265
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-09-07 01:04:08 +00:00
Ben Konyi
07852532e3 [ VM ] Additional cleanup in Dart_Initialize and Dart_Cleanup
Change-Id: I6dc02b3d9de16cc176eb97613bc0c7f0bb9b16eb
Reviewed-on: https://dart-review.googlesource.com/77013
Commit-Queue: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2018-09-28 23:18:59 +00:00
Ryan Macnak
c7cfe1fc86 [vm] Defeat ICF for some profiler test cases.
Change-Id: I00ac8fd191677ec798a14a8f2d46568bab64f48d
Reviewed-on: https://dart-review.googlesource.com/62882
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-06-28 20:03:19 +00:00
Ryan Macnak
b85a7fecd0 Reapply "[vm] Prefer stack bounds from the system thread library for overflow checks."
Mark some profiler tests on Windows as failing.

Bug: https://github.com/dart-lang/sdk/issues/31137
Change-Id: I46a5d4838443e5cfdac6043ea8dcfeb3d05d4823
Reviewed-on: https://dart-review.googlesource.com/14920
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-18 21:15:49 +00:00
Dmitry Stefantsov
a227b168da Revert "Reapply "[vm] Prefer stack bounds from the system thread library for overflow checks.""
This reverts commit 5a022b9db6.

The reverted CL caused some redness on some vm and vm-precomp bots.

TBR=rmacnak@google.com
Change-Id: I9be670f3c3e341ec6d95082f288bc569834e38c7
Reviewed-on: https://dart-review.googlesource.com/13460
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2017-10-12 07:32:30 +00:00
Ryan Macnak
5a022b9db6 Reapply "[vm] Prefer stack bounds from the system thread library for overflow checks."
Fix accounting of guard pages to move the stack limit up instead of down.

Change-Id: I2f6577a12cf95707c186884f0bd3def03eac12ed
Reviewed-on: https://dart-review.googlesource.com/13381
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-10-12 02:17:11 +00:00
Ryan Macnak
6ecf6dd0a3 Revert "[vm] Prefer stack bounds from the system thread library for overflow checks."
This reverts commit af251ddfec.

Reason for revert: Crashes on Windows.

Original change's description:
> [vm] Prefer stack bounds from the system thread library for overflow checks.
> 
> Before this change, we would assume all stacks have the size the VM specifies for threads it creates, but this won't be accurate for the initial thread or threads created by the embedder.
> 
> Change-Id: I6605a88d6666a6f9d47fbe047d3fdd02aa22c80a
> Reviewed-on: https://dart-review.googlesource.com/10209
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=rmacnak@google.com,zra@google.com

Change-Id: I96eaccdc8edf6e3d319827a63d168534bad0518e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/13106
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-11 21:17:28 +00:00
Ryan Macnak
af251ddfec [vm] Prefer stack bounds from the system thread library for overflow checks.
Before this change, we would assume all stacks have the size the VM specifies for threads it creates, but this won't be accurate for the initial thread or threads created by the embedder.

Change-Id: I6605a88d6666a6f9d47fbe047d3fdd02aa22c80a
Reviewed-on: https://dart-review.googlesource.com/10209
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-11 19:35:44 +00:00
Ryan Macnak
1398ee11af [vm] Fix flaky crash in StackTraceMallocHookLengthTest.
Remove double initialization of the allocation sample buffer, the second of which triggers the malloc hook.

R=zra@google.com

Review-Url: https://codereview.chromium.org/3001473002 .
2017-08-10 09:52:27 -07:00
Ryan Macnak
f8e47a9e26 Reapply "[vm] Don't enable the profiler by default. Enable the profiler at startup with --observe, or later through Observatory."
Ensure we still start NativeSymbolResolver even if the profiler is off, since it is also used name weak handler finalizer functions and to produce stack traces for crashes.

R=bkonyi@google.com

Review-Url: https://codereview.chromium.org/2992893002 .
2017-08-09 11:20:58 -07:00
Dmitry Stefantsov
eddc456f29 Revert "[vm] Don't enable the profiler by default. Enable the profiler at startup with --observe, or later through Observatory."
This reverts commit cc08f2ddd8.

R=whesse@google.com

Review-Url: https://codereview.chromium.org/2990173002 .
2017-08-02 11:30:16 +02:00
Ryan Macnak
cc08f2ddd8 [vm] Don't enable the profiler by default. Enable the profiler at startup with --observe, or later through Observatory.
Note there is no option to disable the profiler. The profiler on Mac, Linux, and Android is based on SIGPROF, and there is no way to wait for all the outstanding signals as required to be able to safely free the sample buffer.

Saves ~20MB on 64-bit VMs.

R=cbernaschina@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2989093002 .
2017-08-01 17:57:08 -07:00
Zachary Anderson
6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Ben Konyi
cc68a66f28 Updated native memory allocation profiling to use its own sample buffer instead of sharing a sample buffer with the CPU profiler, which did lead to samples being quickly overwritten even if the memory hadn't yet been freed. This will ensure allocations are accurately displayed in Observatory as the CPU profiler will no longer overwrite samples associated with native memory allocations.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2966593002 .
2017-07-10 10:31:45 -07:00
Zachary Anderson
135b1907ee [Fuchsia] Grab the number of malloc'd bytes from jemalloc
This allows us to report the "native heap memory" value in
the Observatory for VMs running on Fuchsia.

This change also renames the flag --enable-malloc-hooks to
--profiler-native-memory to better reflect what the flag
does. (In the future we may also want to rename
--profiler to --profiler-cpu.)

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2829833003 .
2017-04-19 15:51:02 -07:00
Ben Konyi
7c820f4363 Resubmission of native memory allocation info surfacing in Observatory. Fixed crashing tests and stack trace collection skip counts for different configurations.
Fixed missing method referenced when MallocHooks is unsupported.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2771293003 .
2017-03-27 13:25:26 -07:00
Ryan Macnak
877284947b Rename TARGET_OS_* to HOST_OS_*.
Like HOST_ARCH_*, HOST_OS_* describes the OS the VM is running on, which may be different from the OS the VM is generating code for during AOT compilation.

Currently we conflate the two when emitting AOT as assembly, and we get away with it because Flutter only uses assembly for targeting iOS and one can only target iOS from a Mac, but we expect to use assembly for Android as well so native tools can unwind Dart frames.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2750843003 .
2017-03-15 13:11:05 -07:00
Ben Konyi
68a102cab2 Fixed tests not having MallocHooks initialized for tests in release mode.
Revert "Revert "Fixed issue in MallocHooks where a MallocHookScope was accidentally removed during a merge, causing a deadlock in the hooks. Also turned off stack trace collection in a test that was timing out as a result of the stack trace collection.""

This reverts commit 1a5b555aa9.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2711353003 .
2017-02-24 13:56:06 -08:00
Ben Konyi
1a5b555aa9 Revert "Fixed issue in MallocHooks where a MallocHookScope was accidentally removed during a merge, causing a deadlock in the hooks. Also turned off stack trace collection in a test that was timing out as a result of the stack trace collection."
This reverts commit 44a9a4ede3.

BUG=

Review-Url: https://codereview.chromium.org/2714083002 .
2017-02-23 19:21:00 -08:00
Ben Konyi
44a9a4ede3 Fixed issue in MallocHooks where a MallocHookScope was accidentally removed during a merge, causing a deadlock in the hooks. Also turned off stack trace collection in a test that was timing out as a result of the stack trace collection.
Updated MallocHooks to collect stack traces when memory is allocated.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2718523003 .
2017-02-23 18:58:50 -08:00
Ben Konyi
d4f026c2e0 Revert "Updated MallocHooks to collect stack traces when memory is allocated."
This reverts commit a486a8a26b51dce728373183ab02aeda70e6f2d0.

R=johnmccutchan@google.com
TBR=johnmccutchan@google.com
BUG=

Review-Url: https://codereview.chromium.org/2713803003 .
2017-02-23 13:13:44 -08:00
Ben Konyi
47f0da9cd7 Updated MallocHooks to collect stack traces when memory is allocated.
BUG=
R=johnmccutchan@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2680213002 .
2017-02-23 12:42:18 -08:00
Ben Konyi
bb72892e33 Disabled MallocHooks code in Release due to performance concerns. Added enable_malloc_hooks flag to allow users to enable the hooks in Release mode if they so desire.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2700033003 .
2017-02-17 16:07:40 -08:00
Ben Konyi
f2fd150ea0 Added new type of unit test, RAW_UNIT_TEST_CASE, which is used for tests that can be flaky if run while the VM is alive. Tests created using the RAW_UNIT_TEST_CASE macro will run after the VM has shutdown to avoid having any worker threads contaminating the test results.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2666133002 .
2017-01-31 15:16:38 -08:00
Ben Konyi
f679b3c3e5 Reintroducing MallocHooks changes with fix for hooks being called when in execvpe after a fork while the MallocHooks lock is held by a thread that may no longer exist.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2647283004 .
2017-01-30 09:55:20 -08:00
Zach Anderson
7730809f36 Revert "Reintroducing MallocHooks changes with fix for infinite loop in MallocHooks on Platform::Exit."
This reverts commit 7bf5d87017.

The lock introduced by this change in MallocHooksState is held across
a fork(), which causes deadlock in the child when execvpe() fails and
tries to acquire the lock when freeing memory.

Review-Url: https://codereview.chromium.org/2647793005 .
2017-01-20 23:52:31 -08:00
Ben Konyi
7bf5d87017 Reintroducing MallocHooks changes with fix for infinite loop in MallocHooks on Platform::Exit.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2643303003 .
2017-01-20 15:26:58 -08:00
Ben Konyi
c9a4374ed9 Revert "Implemented basic heap memory allocation tracking in MallocHooks using hooks registered with tcmalloc. Also updated BUILD.gn files to account for include paths within the tcmalloc project."
This reverts commit 5290052550.

Revert "Fixed segfault in Remove method."

This reverts commit 203f1ba222.

BUG=
TBR=zra@google.com

Review-Url: https://codereview.chromium.org/2647763003 .
2017-01-19 15:17:29 -08:00
Ben Konyi
5290052550 Implemented basic heap memory allocation tracking in MallocHooks using hooks registered with tcmalloc. Also updated BUILD.gn files to account for include paths within the tcmalloc project.
Fixed build issues from original submission.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2623613003 .
Review-Url: https://codereview.chromium.org/2644903003 .
2017-01-19 13:15:56 -08:00
Ben Konyi
10686766cd Revert "Implemented basic heap memory allocation tracking in MallocHooks using hooks registered with tcmalloc. Also updated BUILD.gn files to account for include paths within the tcmalloc project."
This reverts commit bcd7ba1056.

TBR=zra@google.com

BUG=

Review-Url: https://codereview.chromium.org/2645973002 .
2017-01-19 12:14:19 -08:00
Ben Konyi
bcd7ba1056 Implemented basic heap memory allocation tracking in MallocHooks using hooks registered with tcmalloc. Also updated BUILD.gn files to account for include paths within the tcmalloc project.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2623613003 .
2017-01-19 12:09:07 -08:00