Commit Graph

30 Commits

Author SHA1 Message Date
Tristan Hume
e35335fe3c Haskell GHC JSON format support (fixes #182) (#183)
Fixes #182 by adding support for importing the JSON profiling format created by GHC's built in profiling support when the executable is passed the `-pj` option. Produces a profile group containing both a time and allocation profile.

Unfortunately, GHC doesn't provide the raw sample information to get the time view to be useful, so only left heavy and sandwich are useful.

Includes a test profile, and I've also tested it on a more real large 2MB profile file in the UI and it works great.

I also modified the Readme to link to a wiki page I'm unable to create, but that should have something like this content copy-pasted into it:

# Importing from Haskell

GHC provides built in profiling support that can export a JSON file.
In order to do this you need to compile your executable with profiling
support and then pass the `-pj` RTS flag to the executable.

This will produce a `my-binary.prof` file in the current directory which
you can import into speedscope.

## Using GHC

See the [GHC manual page on profiling](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html)
for more extensive information on the command line flags available.

```
$ ghc -prof -fprof-auto -rtsopts Main.hs
$ ./Main +RTS -pj -RTS
```

## Using Stack

### With executables

```
$ stack build --profile
$ stack exec -- my-executable +RTS -pj -RTS
```

### With tests

```
stack test --profile --test-arguments "+RTS -pj -RTS"
```
2018-10-29 09:37:11 -07:00
Jamie Wong
d78d20e005
Update README.md 2018-09-26 13:38:36 -07:00
Jamie Wong
9c6f88a9f2
Update README.md 2018-08-23 09:22:24 -07:00
Jamie Wong
48ae79a6a7 Revert "Update hero GIF in README"
This reverts commit 11585fed92.
2018-08-23 08:44:12 -07:00
Jamie Wong
11585fed92
Update hero GIF in README 2018-08-23 08:42:36 -07:00
Jamie Wong
f7279e088e
Update README.md 2018-08-23 08:15:59 -07:00
Jamie Wong
5ab320b4cf
Update README.md 2018-08-23 08:07:03 -07:00
Jamie Wong
a5c3184880 Add a way of generating a self-contained zip-file 2018-08-22 18:50:25 -07:00
Jamie Wong
3193b34c46
Update README.md 2018-08-21 10:20:08 -07:00
Jamie Wong
2df69b6713
Update README.md 2018-08-21 09:55:27 -07:00
Jamie Wong
777e605c7b
Update README.md to link to wiki pages for import instructions
Fixes #115
2018-08-21 09:55:06 -07:00
Jamie Wong
729d7c771b
Add support for importing linux "perf script" output (#135)
Fixes #119
2018-08-16 10:24:12 -07:00
Jamie Wong
e404053837 Add support for profiles w/ multiples processes & threads (#130)
More broadly, this just supports multiple profiles loaded into the editor in the same time, which supports import from profiles which are multithreaded by importing each thread as a different profile.

For now, the only two file formats that support multiprocess import are Instruments .trace files and speedscope's own file format

In the process of doing this, I refactored the container code considerably and extracted all the dispatch calls into containers rather than them being part of the non-container view code. This is nice because it means that views don't have to be aware of which Flamechart they are or which profile index is being operated upon.

Fixes #66
Fixes #82
Fixes #91
2018-08-11 22:06:53 -07:00
Jamie Wong
fcc6808054
Optionally read from stdin via cli (#99)
Test Plan:
- `./cli.js` opens speedscope in browser with no file selected
- `./cli.js sample/profiles/Chrome/65/simple-timeline.json` opens profile
- `cat sample/profiles/Chrome/65/simple-timeline.json | ./cli.js -` opens profile
- `node --prof-process --preprocess -j sample/profiles/node/8.5.0/isolate-0x102802600-v8.log | ./cli.js -` opens profile

Fixes #95
2018-07-21 19:42:58 -07:00
Jamie Wong
ea8f982c10
Import from node profiles via v8 logs (#98)
This is inspired by https://github.com/mapbox/flamebearer
2018-07-21 16:00:25 -07:00
Jamie Wong
3172e61f05
Add a CLI to load the target file in your default browser (#88)
This PR add a CLI speedscope which load file given as an argument in your default browser. Expected usage looks like:

```
speedscope /path/to/profile
```

Note that since we're using base64 encoded strings as a transport for this, this won't work with multi-file profiles, like the Instruments .trace files. This could be augmented to support that by archiving the contents, but that can be handled in a different PR.

This PR also set up a viable model for integrating speedscope into other projects. By replicating the contents of `cli.js` in other languages, integration should be possible in other languages with no dependency upon node in any way. Distribution should consist of just HTML, JS, and CSS assets to be loaded in browser.

Test Plan:
- Ran the following to simulate a publish & subsequent installation:

```
$ npm pack
$ mv speedscope-0.1.0.tgz /tmp/
$ cd /tmp
$ tar -xvvf speedscope-0.1.0.tgz
$ cd package
$ npm install --only=production
$ ./cli.js
Opening file:///private/tmp/package/dist/release/index.html in your default browser
$ ./cli.js ~/code/speedscope/sample/profiles/Chrome/65/timeline.json
Creating temp file /var/folders/l0/qtd9z14973s2tw81vmzwkyp00000gp/T/speedscope-1531023992823-3880.js
Creating temp file /var/folders/l0/qtd9z14973s2tw81vmzwkyp00000gp/T/speedscope-1531023992823-3880.html
Opening file:///var/folders/l0/qtd9z14973s2tw81vmzwkyp00000gp/T/speedscope-1531023992823-3880.html in your default browser
```

Fixes #24
2018-07-07 21:33:02 -07:00
Jamie Wong
e39381e498
Specify file format for speedscope (#83)
This defines a JSON-based file format for speedscope.

The motivation for is primarily two things:
1. To enable others to write tools to output profiles which can be read by speedscope
2. To enable others to write tools to handle the output of speedscope, leveraging the variety of importers that speedscope supports

Fixes #65
2018-07-07 18:37:28 -07:00
Jamie Wong
c4cdb39df2
Update URL in README 2018-07-06 02:14:34 -07:00
Jamie Wong
0e654801b5
Upgrade the "Table view" to a "Sandwich" view (#73)
![image](https://user-images.githubusercontent.com/150329/41837387-25417bae-7812-11e8-83cb-d3e6782b734e.png)

This provides information about the caller & callees of individual functions selected in the table view.
2018-06-29 12:06:19 -07:00
Jamie Wong
17d48e753a
Update README.md with info about recursion collapsing and table view 2018-06-21 14:00:16 -07:00
Jamie Wong
ad72036901
Update README.md 2018-06-03 22:59:57 -07:00
Jamie Wong
2b9f7ffe1b
Support importing from instruments via deep copy (#33)
Instruments has a complex binary file format. If we're interested in just having a nice flamegraph display of the contents and don't care too much about time ordering or symbol file locations, then we can just grab the information we need from the clipboard rather than deal with the binary file format. This also avoids needing to deal with multiple processes or multiple threads.

This PR contains 2 compressed `.trace` files. In each, if you select the top row in the call tree view and hit "Cmd+Shift+C" or go to "Edit -> Deep Copy", then paste into speedscope, you should get the corresponding flamechart.

## Allocations Profile

![image](https://user-images.githubusercontent.com/150329/39796943-5d900c88-530e-11e8-8dea-fa0a44888a64.png)

![image](https://user-images.githubusercontent.com/150329/39796949-65f6a9f4-530e-11e8-8509-64816cebe74c.png)

## Time Profile

![image](https://user-images.githubusercontent.com/150329/39796956-6fd88776-530e-11e8-9978-14aba8e883e1.png)

![image](https://user-images.githubusercontent.com/150329/39796973-8983189e-530e-11e8-8d82-92183c8590f6.png)
2018-05-08 22:27:31 -07:00
Jamie Wong
e519785924 Update README with note about Firefox support 2018-04-17 18:52:43 -07:00
Alan Pierce
7c1118a425 Add profileURL and title hash parameters (#19)
On init, we check the hash fragment for these parameters and load the URL. We
always show a loading state in that case rather than the landing screen.

When determining the title, an explicitly-specified title takes precedence,
otherwise we use the filename.

I also added an error state, currently only used for my new code, but possibly
there could be a more robust or widespread error handling approach in the
future.
2018-04-14 20:38:04 -07:00
Jamie Wong
8e32110a0d Update README 2018-01-31 10:21:48 -08:00
Jamie Wong
6227737581 Update docs 2018-01-07 19:53:36 -08:00
Jamie Wong
ea2ab1b062
Update README.md 2018-01-07 19:16:07 -08:00
Jamie Wong
cf36b8e630
Update README.md 2018-01-01 13:19:39 -05:00
Jamie Wong
f6772e3498
Update README.md 2017-12-07 23:51:48 -08:00
Jamie Wong
157a16939d
Create README.md 2017-12-07 23:51:15 -08:00