Commit Graph

106 Commits

Author SHA1 Message Date
Ben Konyi b1f9f2182d [ VM / Service ] Remove root frame from traceEvents in _getCpuProfileTimeline response
This frame is already filtered from the trie, so this will make behavior
consistent.

Change-Id: I9283a6ef170b725f739d91795fbb81cf7d902470
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102103
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-05-17 18:41:51 +00:00
Ben Konyi 1ef3818f79 [ VM / Service ] Added resolved_url field to frames in _CpuProfileTimeline response
The resolved_url field for Dart frames will contain the resolved url for
the script associated with the frame's function. This field is NULL for
native methods.

Fixes #36718

Change-Id: I8f15c9d02eb6d3628706338a8a1dd0e76e51eb9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100725
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
2019-05-03 22:27:08 +00:00
Alexander Markov 3b22a7ae46 [vm/profiler] Fix native stack walker to properly skip PC = 0xFF..FF
Fixes flaky service/get_cpu_profile_timeline_rpc_test test failure on debug/simdbc64
(Error "../../runtime/vm/profiler_service.cc: 290: error: expected: start_ < end_".)

Fixes https://github.com/dart-lang/sdk/issues/31794
Possible fix for https://github.com/dart-lang/sdk/issues/28736

Change-Id: I0119830d966aa24713c8572e28e4fc67e6d0de49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-30 22:27:12 +00:00
Ryan Macnak b7a5e478bb [vm, service] Allow choice of tags and code-verus-function when getting profile samples as timeline events.
Change-Id: Ie0cf3d43d5ccc748216ba2b45a9466ce60dcf239
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97176
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-03-26 22:52:40 +00:00
Zach Anderson 8332fb0631 [vm] Adds an API call to dump the CPU profile to the timeline
Used in https://fuchsia-review.googlesource.com/c/topaz/+/258655

Change-Id: I79b102e0d318d7be3bae44fb88f81bb8086a10d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94400
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-03-07 21:28:26 +00:00
Ryan Macnak e92c7678a7 [vm, observatory] Respect requested tag order even when --profile-vm=false.
Blame time waiting for service or kernel isolate startup against LoadWait instead of VM.

In the table profile view, include VM tags. Because of the flattening nature of this view, it is less intrusive than in the tree view.

Bug: https://github.com/dart-lang/sdk/issues/35394
Change-Id: If13c57daa96cb69c5e5a009dfd973b491b694d04
Reviewed-on: https://dart-review.googlesource.com/c/87380
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-12-17 23:35:24 +00:00
Ryan Macnak 488d1f375c [vm] Make profiler bailout counters available over the VM service.
Change-Id: I4c0d30b21371e33f66ab142636aa669a46f8a799
Reviewed-on: https://dart-review.googlesource.com/c/85547
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-29 21:53:24 +00:00
Ryan Macnak 2535b1e021 [vm] Account for bytecode in profile processing and Observatory.
Change-Id: I220eca1f4a3aadaa271ead4de698c28e4a7b653a
Reviewed-on: https://dart-review.googlesource.com/c/84447
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-15 17:42:13 +00:00
Ryan Macnak e0fd050861 [vm, profiler] When we cannot find a symbol for a native function, report the dso and offset instead of the absolute address.
Change-Id: I722e9ccfa78c002b143926d688a20ae951f38d67
Reviewed-on: https://dart-review.googlesource.com/c/81337
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-10-25 19:24:43 +00:00
Ryan Macnak 662ff7f112 [vm] Remove TokenStream, TokenValue, CompilerStats.
(CompilerStats timers have been replaced with the timeline events.)

Change-Id: Iddcb752c085de9762eb802371b6d2905fa608a76
Reviewed-on: https://dart-review.googlesource.com/c/79086
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-10-10 21:39:45 +00:00
Ryan Macnak 9b5a931b06 [vm] Replace most runtime/vm uses of OS::Print with OS::PrintErr.
Leave --print-snapshot-sizes on stdout because it is parsed by Flutter benchmarks.

Replace all runtime/bin uses of OS::Print with Log::Print.

Bug: https://github.com/dart-lang/sdk/issues/32134
Change-Id: I74aacfb410cdfa9270d06e7f6ab0534520c7c7ba
Reviewed-on: https://dart-review.googlesource.com/60021
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-06-13 19:51:40 +00:00
Ryan Macnak 558a931409 [vm] Move some string utils from runtime/vm to runtime/platform.
Change-Id: I552086445a7e07792f9da85afa5edf23b6c450d5
Reviewed-on: https://dart-review.googlesource.com/44402
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-01 02:07:46 +00:00
Ryan Macnak 2108fb25f8 [observatory] Omit VM and User tags and the trie root from profile data added to the timeline.
I.e., no "Dart", "Native", "Default", "Root", etc.

Change-Id: Id1a1b70934daca7f43c9657bd9fa4d3f779067a9
Reviewed-on: https://dart-review.googlesource.com/35800
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-01-19 21:39:36 +00:00
Todd Turnidge 06785a4748 Discard profiler samples if their address is too large.
These samples are invalid and will cause an overflow later on when
generating the profiler report.  Better to drop them early.

Closes #30788

Change-Id: I207251dde9de21a9c1e41fe763f878eb75352648
Reviewed-on: https://dart-review.googlesource.com/7781
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Todd Turnidge <turnidge@google.com>
2017-09-22 20:47:47 +00:00
Carlo Bernaschina 0e32851cfd Add Timeline Dashboard hidden page in Observatory
- Refactoring of the TimelinePage in order to remove the
  dependencies from the Service objects.
- Implemented TimelineRepository to abstract the communication layer
- Structured new TimelineDashboardPage with simplified UI and event
  filtering

The VM returns lists of events which are forwarded to Catapult.
Some events are white-listed for the common user.
Due to limitations in the way the events are generated the only way to
attach the white-list flag to the events is by adding an extra argument.
By setting the hash of timeline.html to #basic we inform JavaScript that
we require the activation of the filter which forwards just the events
white-listed to Captapult, while preserving all the others during
dumping operations.

See https://docs.google.com/document/d/1sDKI3ROYM1ORaKhelt063ayfveF_6WC8aq9MiqHjYBs/edit#

Change-Id: I38435d8d32f37305ce3c366daf55f82e8287959d
Reviewed-on: https://dart-review.googlesource.com/3346
Commit-Queue: Carlo Bernaschina <cbernaschina@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-07 20:38:19 +00: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
Ryan Macnak bcb4fcfa11 [vm-service] Encode ticks directly as integers, since they are expect to stay in JS integer range.
Fixes #29957

R=cbernaschina@google.com

Review-Url: https://codereview.chromium.org/2951803004 .
2017-06-22 09:50:36 -07:00
Jens Johansen 4b9f8eb460 [kernel] Add TokenPosition to AllocateObject, fix some cc tests
- Add TokenPosition to AllocateObject
  meaning that kernel more often has a TokenPosition available.
  This might influence profiling, especially it influences some
  of the vm/cc/Profiler* tests.

- Update profiler_service to also be able to find the current token
  via kernel (as opposed to either returning NULL or crashing).
  This makes use of the source code included in the kernel file.

BUG=
R=kmillikin@google.com, vegorov@google.com

Review-Url: https://codereview.chromium.org/2944433003 .
2017-06-21 09:41:16 +02:00
Ryan Macnak 08b7b1d060 [fuchsia] Make profile processing resilient to bogus overlaps from dladdr.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2939853002 .
2017-06-14 11:14:24 -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
John McCutchan f7d570dab2 Fix an assertion failure in the profiler
- [x] Always reset the inlined functions cache before reusing an entry.

Fixes #29173

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2779613004 .
2017-03-27 12:29:34 -07:00
John McCutchan 85a154fe84 Dump information when we hit the weird assertion failure in profiler
BUG=

Review-Url: https://codereview.chromium.org/2774403002 .
2017-03-27 10:55:58 -07:00
Ben Konyi 9ea672efc0 Revert "Added page to Observatory to display native memory allocation information."
This reverts commit f30f312b48.

Revert "Fixed missing method referenced when MallocHooks is unsupported."

This reverts commit a0b9c5a178.

TBR=johnmccutchan@google.com

BUG=

Review-Url: https://codereview.chromium.org/2773073003 .
2017-03-24 09:47:29 -07:00
Ben Konyi f30f312b48 Added page to Observatory to display native memory allocation information.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2748403002 .
2017-03-24 09:20:25 -07:00
Matthias Hausner 408a64756e Fix setting breakpoint setting in await statements
CL https://codereview.chromium.org/2626753002 introduced a “real” token
position for the synthetic code that re-throws an exception returned
by an await’ed expression. This interferes with setting a breakpoint
in a line that contains an await, since the synthetic code happens to
be at the lowest compiled code address and will thus be picked as the
breakpoint location.

This CL makes the re-throw a synthetic token position again, but
includes synthetic token positions in stack traces. This is an alternative
fix for bug #28325.

BUG=#28770
R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2727803002 .
2017-03-02 12:21:42 -08: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
Ryan Macnak b15b98bcc3 Reapply "Use CodeSourceMap for stack traces (still JIT only)."
- Fix missing null termination in initialization of ZoneTextBuffer.
 - Merge with John's async stack trace changes.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2686813006 .
2017-02-09 18:03:41 -08:00
Ryan Macnak 15a9eafb77 Revert "Reapply "Use CodeSourceMap for stack traces (still JIT only).""
This reverts commit bee82fef8b.

Revert "Use zone memory for StackTrace::ToCString."

This reverts commit 4e8b265ea0.

The later CL somehow caused hangs in some service tests.

Review-Url: https://codereview.chromium.org/2683033007 .
2017-02-09 13:14:01 -08:00
Ryan Macnak bee82fef8b Reapply "Use CodeSourceMap for stack traces (still JIT only)."
Include CodeSourceMaps in app-jit snapshots.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2686623006 .
2017-02-08 16:43:47 -08:00
Ryan Macnak 9e3bd0ef0a Revert "Use CodeSourceMap for stack traces (still JIT only)."
Failed with app-jit snapshots.

This reverts commit 7d2e6b1615.

Review-Url: https://codereview.chromium.org/2685723004 .
2017-02-08 13:33:23 -08:00
Ryan Macnak 7d2e6b1615 Use CodeSourceMap for stack traces (still JIT only).
R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2684763002 .
2017-02-08 11:31:46 -08:00
Ryan Macnak 909ce02b12 Encode inlining information in CodeSourceMap and remove inlining interval arrays.
CodeSourceMap now contains a small bytecode that describes changes to the token position and inlining stack as one moves through a function. This information is used by the disassembler to display inlining comments and by the profiler to properly blame ticks against source code.

Slightly shrinks the total size of code metadata; on dart2js compiling hello world, the final heap is

 before 59.6MB total, 12.8MB List, 1.1MB CodeSourceMap
  after 59.4MB total, 12.1MB List, 1.5MB CodeSourceMap

To be filtered and included in AOT code to expand inline frames in stack traces.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2670843006 .
2017-02-07 12:52:21 -08:00
John McCutchan 5142fa58ce Fix Observatory timeline export to be compatible with about:tracing
Fixes #28628

Recent versions of about:tracing now assume the presence of a 'name'
property in a Sample (ph='P') event. Add a blank one to avoid an exception.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2681463003 .
2017-02-07 08:43:51 -08:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Florian Schneider 4bd534191a VM: Avoid allocating strings when disassembling code.
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 .
2016-09-27 12:43:05 -07:00
Ryan Macnak 326af5e9d7 Move Zone's destructor out of a header file.
This unburdens users of StackZone from needing to include handles_impl.h. A new use of StackZone was recently added to heap.cc without a include of handles_impl.h, and this caused link-time errors on some versions of gcc.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2362573002 .
2016-09-22 13:16:36 -07:00
Zachary Anderson 50d321085c Fix -O0 compilation errors
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2289993002 .
2016-08-29 14:57:51 -07:00
Zachary Anderson c726e62565 Add missing includes
I am trying to get heap profiles from tcmalloc on MIPS. This appears to
require compiling without -fno-exceptions. Removing that flag causes
linker errors. This CL fixes the linker errors.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2284433002 .
2016-08-25 14:50:50 -07:00
Ryan Macnak 7ff2dd4117 Optimize AOT's switchable calls for the monomorphic case.
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 .
2016-08-12 11:18:35 -07:00
John McCutchan a6e2a7f0cd Add debug only counters to profiler
- [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 .
2016-07-28 09:56:15 -07:00
Zachary Anderson e933f28a18 Remove some uses of STL map.
This CL removes the use of STL map from freelist.cc by adding
MallocDirectChainedHashMap in hash_map.h and adding an iterator for
BaseDirectChainedHashMap there.

It also removes a use of STL map from hash_table.h that was dead code.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2083103002 .
2016-06-22 08:32:37 -07:00
Zachary Anderson a89ee91480 Fixes observatory crash for DBC
Review URL: https://codereview.chromium.org/2024223002 .
2016-05-31 11:18:44 -07:00
John McCutchan b895aa5154 Improve CPU Profile View
Service:

- [x] Add "_profilerMode" to VM response. "VM" or "Dart" depending on --profile-vm flag.
- [x] Output a tree where VM tag are treated as executing "exit frame" functions when profiling Dart.
- [x] tick "exit frame" tag functions when profiling Dart.

Observatory:

- [x] don't include option for VM tags when profiling Dart.
- [x] default to no tags when profiling Dart.

- [x] indent the colored bar closer to the down arrow.
- [x] don't show percentages for user tag rows.

- [x] Update cpu profile table view to use virtual tree.
- [x] Update class allocation view to use virtual tree.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1851293005 .
2016-05-13 10:07:19 -07:00
John McCutchan 234cb9cc03 Report 'timeOriginMicros' and 'timeExtentMicros' in Timeline and Profile service responses
These values will be used in the UI soon.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1964163002 .
2016-05-11 14:23:22 -07:00
Siva Annamalai 95904322e7 Minor cleanup based on profiler output of CompileParseFunction.
- Add a zone parameter to TokenStream::Iterator
- Add IsXXXX() functions in raw_object.h using GetClassId()
- Modify
    - Function::owner
    - Function::origin
    - Type::IsMalformed
    - Type::IsMalbounded
    - Type::error
  to not create a Handle in the common path

R=regis@google.com

Review URL: https://codereview.chromium.org/1952023002 .
2016-05-04 15:30:56 -07:00