Skip to content

Commit

Permalink
updating docs to add summarize (#527)
Browse files Browse the repository at this point in the history
* updating docs to add summarize

* add table
  • Loading branch information
jasonwilliams authored Jun 25, 2020
1 parent c4a652a commit 8b40e9e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ when the feature flag is not enabled, you have an empty dummy implementation tha
## Prerequesites

- [Crox](https://github.com/rust-lang/measureme/blob/master/crox/Readme.md)
- [summarize (Optional)](https://github.com/rust-lang/measureme/blob/master/summarize/Readme.md)

## How To Use

Expand All @@ -23,6 +24,40 @@ You can run boa using the "profiler" feature flag to enable profiling. Seeing as
Once finished you should see some trace files left in the directory (boa_cli in this case).
In the same directory as the `.events, string_data, string_index` files run `crox my_trace` or whatever the name of the files are. This will generate a chrome_profiler.json file, you can load this into Chrome Dev tools.

### Summarize

If you just want a summary of what functions were ran the most or where the most time was spent you can run `summarize`.
This is the same as above except instead of calling `$ crox my_trace` you call `$ summarize summzarize my_trace`. This will generate something like below:

```
+---------------------------------------+-----------+-----------------+----------+------------+
| Item | Self time | % of total time | Time | Item count |
+---------------------------------------+-----------+-----------------+----------+------------+
| From<Object> | 1.04ms | 14.776 | 1.04ms | 146 |
+---------------------------------------+-----------+-----------------+----------+------------+
| new_object | 356.50µs | 5.082 | 533.50µs | 18 |
+---------------------------------------+-----------+-----------------+----------+------------+
| create_instrinsics | 263.50µs | 3.756 | 6.38ms | 1 |
+---------------------------------------+-----------+-----------------+----------+------------+
| make_builtin_fn: toString | 218.50µs | 3.114 | 290.50µs | 12 |
+---------------------------------------+-----------+-----------------+----------+------------+
| Value::get_field | 178.60µs | 2.546 | 340.20µs | 60 |
+---------------------------------------+-----------+-----------------+----------+------------+
| Value::get_property | 161.60µs | 2.303 | 161.60µs | 60 |
+---------------------------------------+-----------+-----------------+----------+------------+
| lex | 135.60µs | 1.933 | 135.60µs | 1 |
+---------------------------------------+-----------+-----------------+----------+------------+
| math:create | 125.40µs | 1.787 | 1.11ms | 1 |
+---------------------------------------+-----------+-----------------+----------+------------+
| Value::set_field | 100.20µs | 1.428 | 262.80µs | 8 |
+---------------------------------------+-----------+-----------------+----------+------------+
| function::builtin | 82.40µs | 1.175 | 82.40µs | 146 |
+---------------------------------------+-----------+-----------------+----------+------------+
| String | 81.60µs | 1.163 | 961.60µs | 1 |
+---------------------------------------+-----------+-----------------+----------+------------+
```


## More Info

- https://blog.rust-lang.org/inside-rust/2020/02/25/intro-rustc-self-profile.html
Expand Down

0 comments on commit 8b40e9e

Please sign in to comment.