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

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.

主站蜘蛛池模板: 乌拉特前旗| 鲁甸县| 刚察县| 土默特左旗| 延津县| 长沙县| 丰顺县| 商水县| 天等县| 桐城市| 秦安县| 尉犁县| 阳东县| 大足县| 万全县| 石屏县| 大余县| 盐城市| 鄂温| 吴川市| 翁牛特旗| 临潭县| 唐河县| 龙井市| 邓州市| 富源县| 清水河县| 个旧市| 普兰店市| 罗平县| 深州市| 马龙县| 玛纳斯县| 溧水县| 宣威市| 通渭县| 连南| 淮南市| 江都市| 景泰县| 武邑县|