This change adds two new RPCs and various new properties:
- getAllocationTraces
- setTraceClassAllocation
- classId and identityHashCode properties in CpuSample
- traceAllocations property in Class
TEST=get_allocation_traces_test.dart
package:vm_service has been regenerated for 3.43 of the service protocol
and is ready for a 6.1.0 release.
Change-Id: Ia8ed055423798d7d17fe9f5fd74efb4239b875fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182666
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Currently we have things called XPtr which are not what you get from ptr().
Old world:
handle->raw() returns RawObject* (tagged)
raw_obj->ptr() returns RawObject* (untagged)
After 6fe15f6df9:
handle->raw() returns ObjectPtr
obj_ptr->ptr() returns ObjectLayout*
New world:
handle->ptr() returns ObjectPtr
obj_ptr->untag() returns UntaggedObject*
TEST=ci
Change-Id: I6c7f34014cf20737607caaf84979838300d12df2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149367
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Previously the output used scrubbed qualified names which hides some
of the information and causes names of various synthetic functions
collide. We change it to use internal qualified names instead and add
additional information for disambiguation:
- For functions this means adding a prefix for various synthetic
methods;
- For anonymous closures we add their token position;
- For types we prefix type parameters with their owner's name.
We also add a unit test covering parsing of
--print-instructions-sizes-to output.
As part of adding a test dart2native was changed to support passing
extra arguments to gen_snapshot binary.
Fixes https://github.com/dart-lang/sdk/issues/41137
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-win-release-try,pkg-mac-release-try
Change-Id: I299ab0fb5993c8af9b51246483608d1e65970d67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146581
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Disabling the profiler will **not** release the sample buffer on Linux,
MacOS, and other platforms which utilize signals for profiling as
there's no way to ensure all signals have been receieved after the
thread interrupter has been shutdown.
Change-Id: Ifb3230fdb95e9bc9147cbd4b85d1a84e976ce119
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123554
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This flag consumes a time in seconds and calculates the correct capacity
for the sample buffer so it can contain at least that many seconds worth
of samples based on the maximum number of samples that can be chained to
represent a stack and the sampling rate.
Providing a value to this flag will likely greatly increase memory
consumption, so a warning message is printed which contains the
information used to calculate the buffer capacity as well as the size of
the resulting buffer in bytes. Example output:
** WARNING ** Custom sample buffer size provided via --sample-buffer-duration
The sample buffer can hold at least 120s worth of samples with stacks depths of up to 128, collected at a sample rate of 20000Hz.
The resulting sample buffer size is 3532800000 bytes.
Fixes https://github.com/dart-lang/sdk/issues/37924
Change-Id: I58aff6da268b9a6b02258021d2be8bf4f80ae999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117208
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
In many cases, the Mutexes and Monitors have to be marked "mutable"
because they're used to synchronize const accessor methods.
Small text segment improvement for Product builds:
$ size dart.{arm,x64}.{before,after}
text data bss dec hex filename
19726069 409960 392332 20528361 1393ce9 dart.arm.before
19725525 409960 392332 20527817 1393ac9 dart.arm.after
22576021 600376 1782824 24959221 17cd8f5 dart.x64.before
22574821 600376 1782824 24958021 17cd445 dart.x64.after
Change-Id: I68f5cd5ad452044df8bfebd160910496036a3e6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101745
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
`profile_period` has been added to the list of flags which can be
changed at runtime via the `setFlag` RPC. Changing this flag at runtime will
cause the ThreadInterrupter to be shutdown, reinitialized, and started with the
new profiling period.
Fixes#35654.
Change-Id: I2f365fdf8e404270f2eed1e172c8d21b48e0aff9
Reviewed-on: https://dart-review.googlesource.com/c/89445
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
In Flutter, the timeline buffer overflows much more quickly than the profile buffer, but usually timeline events are more helpful than profile ticks for understanding performance. This commit trades profile buffer space for timeline event space.
32-bit:
profile buffer: 12MB -> 6MB
timeline buffer: 0.5MB -> 2MB
Also increase the default sample depth to better handle Flutter's deep tree walks.
Change-Id: If092047fa89b2b3e57e57370bc435a591497b566
Reviewed-on: https://dart-review.googlesource.com/5903
Reviewed-by: Todd Turnidge <turnidge@google.com>
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 .
Install a signal handler in the standalone VM that dumps a backtrace
similar to what we already do on assertion failures.
For now only Linux and MacOS are supported.
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org/2514113002 .
We have a racy read of the object header in the stack frame walker
called from the profiler (in this case the gc marker is running at
the same time).
It is appropriate to avoid this even though we think the access is
safe as the objects are in old space and never forwarded and only
the mark bits are manipulated while marking
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/2517473002 .
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER
This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.
R=asiva@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/2450713004 .
For code objects, don't allocate symbol strings when printing the disassembly.
Don't try to make disassembling work with background compilation -- instead make sure that we don't allocate on the Dart heap while disassembling.
Add NoSafepointScope around disassemble functions to assert that no allocation happens.
Also, remove some dead code from object.cc.
BUG=#27430
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/2363413004 .
The call sequence is very similar to a classic IC call, except the guarded class and the target are loaded indirectly from the constant pool instead of as immediates. In the monomorphic case, we call directly to the expected target with a class check in the callee. In the unlinked, polymorphic and megamorphic cases, we call a stub; these case are now call-through instead of call-and-return.
Every code, except stubs involved in switchable calls, includes the class check sequence at the beginning. So we now distinguish between a checked and an unchecked entry point. Generated code except the switchable call continues to use the unchecked entry point.
PC offsets are calculated relative to the beginning of the instruction stream, rather than either entry point.
BUG=
R=fschneider@google.com
Review URL: https://codereview.chromium.org/2226893002 .
- [x] Count the reasons why we don't walk the stack.
- [x] Count the reasons why we only sample a single frame.
- [x] Count the stack walkers used.
These counters are returned as part of the profile over the vm-service and can be used to debug profiler failures in the future.
R=fschneider@google.com
Review URL: https://codereview.chromium.org/2183993007 .