官术网_书友最值得收藏!

Observing the Dart VM internals

If you have been watching the output window keenly as you have launched Dart projects, you will have noticed references to the Observatory. This tool (which is part of the Dart SDK) allows developers to look inside a running Dart virtual machine, and profile the ongoing activities. This is useful to find out exactly what an application is doing and where bottlenecks exist.

Observing the Dart VM internals

The Observatory supports command line applications and web applications (Dart versions and not the compiled to JavaScript output) running in Dartium. To enable it, simply pass one of the many Observatory command line parameters—see the SDK documents (https://www.dartlang.org/tools/dart-vm/) for a full listing:

dart --enable-vm-service bin/main.dart

Launch the main.dart program with the Observatory attached, and browse to the address localhost:8181 (note that this port number can change though it can be specified in the launch command parameter --enable-vm-service=<port>/<IP address>):

chromium.exe index.html

Launch index.html with the Observatory attached. The address to put into the web browser will be shown:

Observatory listening on http://127.0.0.1:34935

The URLs can be opened in any web browser, the most important feature is the Refresh button, that appears and re-samples the data that is being displayed.

While you are waiting for the data monitor to collect data, take some time to explore the inner workings of the Dart VM as it runs the code.

主站蜘蛛池模板: 逊克县| 镇坪县| 高清| 襄城县| 平江县| 和平县| 慈溪市| 马公市| 茂名市| 繁昌县| 时尚| 旺苍县| 石门县| 板桥市| 延津县| 襄汾县| 南木林县| 乐平市| 本溪| 阜南县| 云龙县| 乐山市| 濉溪县| 上蔡县| 马龙县| 广平县| 平度市| 弥渡县| 延安市| 江津市| 犍为县| 富宁县| 都昌县| 云南省| 墨竹工卡县| 麻栗坡县| 台江县| 贵定县| 洪雅县| 汾西县| 辽宁省|