Compare commits

...
13 Commits
Author SHA1 Message Date
Jamie Wong 519847b489 1.3.2 2018-12-03 19:25:54 -08:00
Jamie Wong 6d4f3499da Fix import of multithreaded Chrome profiles (#194)
In #160, I wrote code which incorrectly assumed that at most one profile would be active at a time. It turns out this assumption is incorrect because of webworkers! This PR introduces a fix which correctly separates samples taken on the main thread from samples taken on worker threads, and allows viewing both in speedscope.

Fixes #171
2018-12-03 19:21:59 -08:00
Jamie Wong ad49dacb29 1.3.1 2018-11-08 10:05:52 -08:00
Jamie Wong 6562fec7a7 Use TextDecoder if available for converting from an ArrayBuffer for speed (#188)
#165 introduced a performance regression by using a really inefficient method for converting from array buffers into string. This should ix it by using `TextDecoder` instead.
2018-11-08 10:01:05 -08:00
Jamie Wong 23d4042e04 1.3.0 2018-10-29 09:56:06 -07:00
Vincent Rischmann 9961ed8295 Make the wasd keymappings work on azerty keyboards (#184)
Instead of using `key`, use `code` which according to [this](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code) should work consistently for different layouts.

I tested the modification on a french AZERTY keyboard and it works fine.
2018-10-29 09:43:10 -07:00
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
Florian Hermouet-Joscht 86f4ba636d Use arrayBuffer instead of text for profileURL (#179)
When using #profileURL, some binary characters cannot be read if we use `fetch text`. So I changed that to use `arrayBuffer`.

Now we can read pprof protobuf files and normal JSON files instead of only text files.
2018-10-12 17:22:45 -07:00
Jamie Wong 0fe0c454d3 1.2.0 2018-10-08 09:49:15 -07:00
vmarchaud 4b292b2acf Add import of v8 heap allocation profile (#170)
This adds support for importing heap profiles from Chrome: https://developers.google.com/web/tools/chrome-devtools/memory-problems/#allocation-profile
2018-10-08 09:15:39 -07:00
Jamie Wong d78d20e005 Update README.md 2018-09-26 13:38:36 -07:00
Jamie Wong 7d0a3a2c59 1.1.0 2018-09-26 11:46:41 -07:00
Jamie Wong 3f205ec3e9 Add go tool pprof import support (#165)
This PR adds support for importing from Google's pprof format, which is a gzipped, protobuf encoded file format (that's incredibly well documented!) The [pprof http library](https://golang.org/pkg/net/http/pprof/) also offers an output of the trace file format, which continues to not be supported in speedscope to date (See #77). This will allow importing of profiles generated by the standard library go profiler for analysis of profiles containing heap allocation information, CPU profile information, and a few other things like coroutine creation information.

In order to add support for that a number of dependent bits of functionality were added, which should each provide an easier path for future binary input sources

- A protobuf decoding library was included ([protobufjs](https://www.npmjs.com/package/protobufjs)) which includes both a protobuf parser generator based on a .proto file & TypeScript definition generation from the resulting generated JavaScript file
- More generic binary file import. Before this PR, all supported sources were plaintext, with the exception of Instruments 10 support, which takes a totally different codepath. Now binary file import should work when files are dropped, opened via file browsing, or opened via invocation of the speedscope CLI.
- Transparent gzip decoding of imported files (this means that if you were to gzip compress another JSON file, then importing it should still work fine)

Fixes #60.

--

This is a [donation motivated](https://github.com/jlfwong/speedscope/issues/60#issuecomment-419660710) PR motivated by donations by @davecheney & @jmoiron to [/dev/color](https://www.devcolor.org/welcome) 🎉
2018-09-26 11:33:34 -07:00
39 changed files with 18065 additions and 2629 deletions
+36 -1
View File
@@ -1,5 +1,40 @@
## Unreleased
## [1.3.2] - 2018-12-03
* Fixed import of multithreaded Chrome profiles [#19] (by @jlfwong)
### Fixed
## [1.3.1] - 2018-11-08
### Fixed
* Fixed a file import performance regression by using TextDecoder [#188] (by @jlfwong)
## [1.3.0] - 2018-10-29
### Added
* Support import from Haskell GHC JSON format support [#183] (by @trishume)
### Fixed
* Make the wasd keymappings work on azerty keyboards [#184] (by @vrischmann)
* Fix import of binary formats via profileURL [#179] (by @f-hj)
## [1.2.0] - 2018-10-08
### Added
* Add import of v8 heap allocation profile [#170] (by @vmarchaud)
## [1.1.0] - 2018-09-26
### Added
* Add go tool pprof import support [#165]
## [1.0.4] - 2018-09-12
### Fixed
@@ -18,7 +53,7 @@
* Allow optional CR before LF when probing collapsed stacks files [#154]
* Fix import for Firefox 63 [#156]
* Change time formatting for minutes from 1.50min to 1:30 [#153]
* Change time formatting for minutes from 1.50min to 1:30 [#153] (by @Alex-Diez)
## [1.0.1] - 2018-08-23
+3
View File
@@ -40,9 +40,12 @@ speedscope is designed to ingest profiles from a variety of different profilers
- Ruby
- [Importing from stackprof](https://github.com/jlfwong/speedscope/wiki/Importing-from-stackprof-(ruby))
- [Importing from rbspy](https://github.com/jlfwong/speedscope/wiki/Importing-from-rbspy-(ruby))
- Go
- [Importing from pprof](https://github.com/jlfwong/speedscope/wiki/Importing-from-pprof-(go))
- Native code
- [Importing from Instruments.app](https://github.com/jlfwong/speedscope/wiki/Importing-from-Instruments.app) (macOS)
- [Importing from `perf`](https://github.com/jlfwong/speedscope/wiki/Importing-from-perf-(linux)) (linux)
- [Importing from GHC (Haskell)](https://github.com/jlfwong/speedscope/wiki/Importing-from-Haskell)
- [Importing from custom sources](https://github.com/jlfwong/speedscope/wiki/Importing-from-custom-sources)
Contributions to add support for additional formats are welcome! See issues with the ["import source" tag](https://github.com/jlfwong/speedscope/issues?q=is%3Aissue+is%3Aopen+label%3A%22import+source%22).
+2622 -2528
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "speedscope",
"version": "1.0.4",
"version": "1.3.2",
"description": "",
"repository": "jlfwong/speedscope",
"main": "index.js",
@@ -38,6 +38,7 @@
"preact": "8.2.7",
"preact-redux": "jlfwong/preact-redux#a56dcc4",
"prettier": "1.12.0",
"protobufjs": "6.8.8",
"quicktype": "15.0.45",
"redux": "^4.0.0",
"ts-jest": "22.4.6",
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
+2
View File
@@ -0,0 +1,2 @@
simple
server
+15
View File
@@ -0,0 +1,15 @@
.PHONY: all clean linux-perf
all: simple server
clean:
rm -f simple server
simple: simple.go
go build $<
server: server.go
go build $<
simple.prof: simple
./$< -cpuprofile=$@
+71
View File
@@ -0,0 +1,71 @@
package main
import (
"log"
"fmt"
"sync"
"time"
"net/http"
)
import _ "net/http/pprof"
// See https://golang.org/pkg/net/http/pprof/ for details
func alpha() {
z := 3
for i := 0; i < 100000; i++ {
z *= 3
}
}
func beta() {
z := 3
for i := 0; i < 100000; i++ {
z *= 3
}
}
func delta() {
z := 3
for i := 0; i < 100000; i++ {
z *= 3
}
alpha()
beta()
}
func gamma() {
z := 3
for i := 0; i < 100000; i++ {
z *= 3
}
}
func main() {
// we need a webserver to get the pprof webserver
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
fmt.Println("hello world")
var wg sync.WaitGroup
wg.Add(1)
go leakyFunction(wg)
wg.Wait()
}
func leakyFunction(wg sync.WaitGroup) {
defer wg.Done()
s := make([]string, 3)
for i:= 0; i < 10000000; i++{
alpha()
beta()
delta()
gamma()
s = append(s, "magical pandas")
if (i % 100000) == 0 {
time.Sleep(50 * time.Millisecond)
}
}
}
+53
View File
@@ -0,0 +1,53 @@
package main
import "flag"
import "runtime/pprof"
import "os"
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
func alpha() {
z := 3
for i := 0; i < 100000; i++ {
z *= 3
}
}
func beta() {
z := 3
for i := 0; i < 100000; i++ {
z *= 3
}
}
func delta() {
z := 3
for i := 0; i < 100000; i++ {
z *= 3
}
alpha()
beta()
}
func gamma() {
z := 3
for i := 0; i < 100000; i++ {
z *= 3
}
}
func main() {
flag.Parse()
if *cpuprofile != "" {
f, _ := os.Create(*cpuprofile)
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
for i := 0; i < 10000; i++ {
alpha()
beta()
delta()
gamma()
}
}
+28
View File
@@ -0,0 +1,28 @@
<script>
function banana() {
let prod = 1
for (let i = 1; i < 1000; i++) {
prod *= i
}
return prod
}
function apple() {
for (let i = 0; i < 1000; i++) {
banana()
}
}
let bounces = 0
const worker = new Worker('./worker.js')
worker.onmessage = function() {
apple()
if (bounces++ < 10) {
worker.postMessage('ping')
}
}
worker.postMessage('ping')
</script>
+18
View File
@@ -0,0 +1,18 @@
function gamma() {
let prod = 1
for (let i = 1; i < 1000; i++) {
prod *= i
}
return prod
}
function alpha() {
for (let i = 0; i < 1000; i++) {
gamma()
}
}
onmessage = function(e) {
alpha()
postMessage('pong')
}
@@ -515,6 +515,845 @@ exports[`importFromChromeTimeline Chrome 69: indexToView 1`] = `0`;
exports[`importFromChromeTimeline Chrome 69: profileGroup.name 1`] = `"simple.json"`;
exports[`importFromChromeTimeline Workers Chrome 70 1`] = `
Object {
"frames": Array [
Frame {
"col": 0,
"file": "extensions::SafeBuiltins",
"key": "(anonymous):extensions::SafeBuiltins:0:0",
"line": 0,
"name": "(anonymous)",
"selfWeight": 0,
"totalWeight": 37463,
},
Frame {
"col": 9,
"file": "extensions::SafeBuiltins",
"key": "(anonymous):extensions::SafeBuiltins:0:9",
"line": 0,
"name": "(anonymous)",
"selfWeight": 0,
"totalWeight": 37463,
},
Frame {
"col": 20,
"file": "extensions::SafeBuiltins",
"key": "saveBuiltin:extensions::SafeBuiltins:24:20",
"line": 24,
"name": "saveBuiltin",
"selfWeight": 233,
"totalWeight": 9858,
},
Frame {
"col": 21,
"file": "extensions::SafeBuiltins",
"key": "makeCallable:extensions::SafeBuiltins:6:21",
"line": 6,
"name": "makeCallable",
"selfWeight": 122,
"totalWeight": 7007,
},
Frame {
"col": 32,
"file": "extensions::SafeBuiltins",
"key": "(anonymous):extensions::SafeBuiltins:7:32",
"line": 7,
"name": "(anonymous)",
"selfWeight": 234,
"totalWeight": 234,
},
Frame {
"col": undefined,
"file": undefined,
"key": "(program):undefined:undefined:undefined",
"line": undefined,
"name": "(program)",
"selfWeight": 48725,
"totalWeight": 48827,
},
Frame {
"col": undefined,
"file": undefined,
"key": "(garbage collector):undefined:undefined:undefined",
"line": undefined,
"name": "(garbage collector)",
"selfWeight": 3380,
"totalWeight": 3380,
},
Frame {
"col": 0,
"file": "chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js",
"key": "(anonymous):chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js:0:0",
"line": 0,
"name": "(anonymous)",
"selfWeight": 1550,
"totalWeight": 15220,
},
Frame {
"col": 466,
"file": "chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js",
"key": "La:chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js:34:466",
"line": 34,
"name": "La",
"selfWeight": 407,
"totalWeight": 11272,
},
Frame {
"col": undefined,
"file": undefined,
"key": "get webstore:undefined:undefined:undefined",
"line": undefined,
"name": "get webstore",
"selfWeight": 287,
"totalWeight": 15564,
},
Frame {
"col": 9,
"file": "extensions::runtime",
"key": "(anonymous):extensions::runtime:0:9",
"line": 0,
"name": "(anonymous)",
"selfWeight": 2319,
"totalWeight": 15277,
},
Frame {
"col": undefined,
"file": undefined,
"key": "privates:undefined:undefined:undefined",
"line": undefined,
"name": "privates",
"selfWeight": 1751,
"totalWeight": 6636,
},
Frame {
"col": 9,
"file": "extensions::binding",
"key": "(anonymous):extensions::binding:0:9",
"line": 0,
"name": "(anonymous)",
"selfWeight": 791,
"totalWeight": 4994,
},
Frame {
"col": 9,
"file": "extensions::event_bindings",
"key": "(anonymous):extensions::event_bindings:0:9",
"line": 0,
"name": "(anonymous)",
"selfWeight": 822,
"totalWeight": 4068,
},
Frame {
"col": 9,
"file": "extensions::sendRequest",
"key": "(anonymous):extensions::sendRequest:0:9",
"line": 0,
"name": "(anonymous)",
"selfWeight": 761,
"totalWeight": 2844,
},
Frame {
"col": 9,
"file": "extensions::schemaUtils",
"key": "(anonymous):extensions::schemaUtils:0:9",
"line": 0,
"name": "(anonymous)",
"selfWeight": 847,
"totalWeight": 1814,
},
Frame {
"col": 9,
"file": "extensions::json_schema",
"key": "(anonymous):extensions::json_schema:0:9",
"line": 0,
"name": "(anonymous)",
"selfWeight": 834,
"totalWeight": 834,
},
Frame {
"col": 15,
"file": "extensions::utils",
"key": "expose:extensions::utils:97:15",
"line": 97,
"name": "expose",
"selfWeight": 147,
"totalWeight": 293,
},
Frame {
"col": 35,
"file": "extensions::SafeBuiltins",
"key": "target.(anonymous function):extensions::SafeBuiltins:9:35",
"line": 9,
"name": "target.(anonymous function)",
"selfWeight": 727,
"totalWeight": 7136,
},
Frame {
"col": undefined,
"file": undefined,
"key": "Apply:undefined:undefined:undefined",
"line": undefined,
"name": "Apply",
"selfWeight": 2187,
"totalWeight": 6547,
},
Frame {
"col": 9,
"file": "extensions::messaging",
"key": "(anonymous):extensions::messaging:0:9",
"line": 0,
"name": "(anonymous)",
"selfWeight": 151,
"totalWeight": 428,
},
Frame {
"col": 20,
"file": "extensions::binding",
"key": "generate:extensions::binding:198:20",
"line": 198,
"name": "generate",
"selfWeight": 149,
"totalWeight": 7002,
},
Frame {
"col": 36,
"file": "extensions::binding",
"key": "shouldCheckUnprivileged:extensions::binding:208:36",
"line": 208,
"name": "shouldCheckUnprivileged",
"selfWeight": 0,
"totalWeight": 146,
},
Frame {
"col": 43,
"file": "extensions::binding",
"key": "(anonymous):extensions::binding:252:43",
"line": 252,
"name": "(anonymous)",
"selfWeight": 0,
"totalWeight": 3651,
},
Frame {
"col": 49,
"file": "extensions::json_schema",
"key": "JSONSchemaValidator.addTypes:extensions::json_schema:173:49",
"line": 173,
"name": "JSONSchemaValidator.addTypes",
"selfWeight": 149,
"totalWeight": 149,
},
Frame {
"col": 45,
"file": "extensions::binding",
"key": "(anonymous):extensions::binding:270:45",
"line": 270,
"name": "(anonymous)",
"selfWeight": 546,
"totalWeight": 3349,
},
Frame {
"col": 47,
"file": "extensions::binding",
"key": "(anonymous):extensions::binding:322:47",
"line": 322,
"name": "(anonymous)",
"selfWeight": 159,
"totalWeight": 586,
},
Frame {
"col": 44,
"file": "extensions::binding",
"key": "(anonymous):extensions::binding:396:44",
"line": 396,
"name": "(anonymous)",
"selfWeight": 142,
"totalWeight": 802,
},
Frame {
"col": 16,
"file": "extensions::event_bindings",
"key": "Event:extensions::event_bindings:512:16",
"line": 512,
"name": "Event",
"selfWeight": 139,
"totalWeight": 527,
},
Frame {
"col": 51,
"file": "extensions::utils",
"key": "privates.constructPrivate:extensions::utils:101:51",
"line": 101,
"name": "privates.constructPrivate",
"selfWeight": 0,
"totalWeight": 388,
},
Frame {
"col": 20,
"file": "extensions::event_bindings",
"key": "EventImpl:extensions::event_bindings:212:20",
"line": 212,
"name": "EventImpl",
"selfWeight": 251,
"totalWeight": 251,
},
Frame {
"col": 26,
"file": "extensions::binding",
"key": "addProperties:extensions::binding:424:26",
"line": 424,
"name": "addProperties",
"selfWeight": 149,
"totalWeight": 710,
},
Frame {
"col": 16,
"file": "extensions::utils",
"key": "forEach:extensions::utils:26:16",
"line": 26,
"name": "forEach",
"selfWeight": 0,
"totalWeight": 561,
},
Frame {
"col": 21,
"file": "extensions::binding",
"key": "runHooks_:extensions::binding:179:21",
"line": 179,
"name": "runHooks_",
"selfWeight": 0,
"totalWeight": 273,
},
Frame {
"col": 46,
"file": "extensions::binding",
"key": "(anonymous):extensions::binding:180:46",
"line": 180,
"name": "(anonymous)",
"selfWeight": 141,
"totalWeight": 273,
},
Frame {
"col": 35,
"file": "extensions::runtime",
"key": "(anonymous):extensions::runtime:16:35",
"line": 16,
"name": "(anonymous)",
"selfWeight": 132,
"totalWeight": 132,
},
Frame {
"col": 260,
"file": "chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js",
"key": "l:chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js:37:260",
"line": 37,
"name": "l",
"selfWeight": 127,
"totalWeight": 127,
},
Frame {
"col": 43,
"file": "extensions::utils",
"key": "publicClassPrototype.(anonymous function):extensions::utils:135:43",
"line": 135,
"name": "publicClassPrototype.(anonymous function)",
"selfWeight": 0,
"totalWeight": 276,
},
Frame {
"col": 44,
"file": "extensions::event_bindings",
"key": "EventImpl.addListener:extensions::event_bindings:272:44",
"line": 272,
"name": "EventImpl.addListener",
"selfWeight": 135,
"totalWeight": 135,
},
Frame {
"col": 161,
"file": "chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js",
"key": "bb:chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js:57:161",
"line": 57,
"name": "bb",
"selfWeight": 146,
"totalWeight": 146,
},
Frame {
"col": 9,
"file": "chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js",
"key": "(anonymous):chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js:64:9",
"line": 64,
"name": "(anonymous)",
"selfWeight": 141,
"totalWeight": 1071,
},
Frame {
"col": 46,
"file": "extensions::SafeBuiltins",
"key": "(anonymous):extensions::SafeBuiltins:65:46",
"line": 65,
"name": "(anonymous)",
"selfWeight": 116,
"totalWeight": 27605,
},
Frame {
"col": 0,
"file": "chrome-extension://denbgaamihkadbghdceggmchnflmhpmk/contentScript.js",
"key": "(anonymous):chrome-extension://denbgaamihkadbghdceggmchnflmhpmk/contentScript.js:0:0",
"line": 0,
"name": "(anonymous)",
"selfWeight": 542,
"totalWeight": 6218,
},
Frame {
"col": 25,
"file": "chrome-extension://denbgaamihkadbghdceggmchnflmhpmk/contentScript.js",
"key": "insertTextScript:chrome-extension://denbgaamihkadbghdceggmchnflmhpmk/contentScript.js:30:25",
"line": 30,
"name": "insertTextScript",
"selfWeight": 392,
"totalWeight": 977,
},
Frame {
"col": 25,
"file": "chrome-extension://denbgaamihkadbghdceggmchnflmhpmk/contentScript.js",
"key": "insertHeaderNode:chrome-extension://denbgaamihkadbghdceggmchnflmhpmk/contentScript.js:57:25",
"line": 57,
"name": "insertHeaderNode",
"selfWeight": 292,
"totalWeight": 585,
},
Frame {
"col": undefined,
"file": undefined,
"key": "appendChild:undefined:undefined:undefined",
"line": undefined,
"name": "appendChild",
"selfWeight": 145,
"totalWeight": 293,
},
Frame {
"col": 0,
"file": undefined,
"key": "(anonymous):undefined:0:0",
"line": 0,
"name": "(anonymous)",
"selfWeight": 0,
"totalWeight": 148,
},
Frame {
"col": 13,
"file": undefined,
"key": "(anonymous):undefined:6:13",
"line": 6,
"name": "(anonymous)",
"selfWeight": 148,
"totalWeight": 148,
},
Frame {
"col": 25,
"file": "chrome-extension://denbgaamihkadbghdceggmchnflmhpmk/contentScript.js",
"key": "listenForMessage:chrome-extension://denbgaamihkadbghdceggmchnflmhpmk/contentScript.js:24:25",
"line": 24,
"name": "listenForMessage",
"selfWeight": 0,
"totalWeight": 4699,
},
Frame {
"col": 9,
"file": "extensions::uncaught_exception_handler",
"key": "(anonymous):extensions::uncaught_exception_handler:0:9",
"line": 0,
"name": "(anonymous)",
"selfWeight": 121,
"totalWeight": 121,
},
Frame {
"col": undefined,
"file": undefined,
"key": "(anonymous):undefined:undefined:undefined",
"line": undefined,
"name": "(anonymous)",
"selfWeight": 135,
"totalWeight": 135,
},
Frame {
"col": 8,
"file": "http://127.0.0.1:8081/worker.html",
"key": "(anonymous):http://127.0.0.1:8081/worker.html:0:8",
"line": 0,
"name": "(anonymous)",
"selfWeight": 0,
"totalWeight": 939,
},
Frame {
"col": undefined,
"file": undefined,
"key": "Worker:undefined:undefined:undefined",
"line": undefined,
"name": "Worker",
"selfWeight": 416,
"totalWeight": 939,
},
Frame {
"col": 11,
"file": "chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js",
"key": "cb:chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js:49:11",
"line": 49,
"name": "cb",
"selfWeight": 0,
"totalWeight": 359,
},
Frame {
"col": 314,
"file": "chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js",
"key": "$a:chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js:46:314",
"line": 46,
"name": "$a",
"selfWeight": 278,
"totalWeight": 359,
},
Frame {
"col": 51,
"file": "chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js",
"key": "(anonymous):chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js:50:51",
"line": 50,
"name": "(anonymous)",
"selfWeight": 0,
"totalWeight": 683,
},
Frame {
"col": undefined,
"file": undefined,
"key": "setTimeout:undefined:undefined:undefined",
"line": undefined,
"name": "setTimeout",
"selfWeight": 63,
"totalWeight": 704,
},
Frame {
"col": 144,
"file": "chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js",
"key": "(anonymous):chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/injected.min.js:50:144",
"line": 50,
"name": "(anonymous)",
"selfWeight": 117,
"totalWeight": 678,
},
Frame {
"col": 29,
"file": "http://127.0.0.1:8081/worker.html",
"key": "worker.onmessage:http://127.0.0.1:8081/worker.html:19:29",
"line": 19,
"name": "worker.onmessage",
"selfWeight": 0,
"totalWeight": 21103,
},
Frame {
"col": 16,
"file": "http://127.0.0.1:8081/worker.html",
"key": "apple:http://127.0.0.1:8081/worker.html:9:16",
"line": 9,
"name": "apple",
"selfWeight": 660,
"totalWeight": 20852,
},
Frame {
"col": 17,
"file": "http://127.0.0.1:8081/worker.html",
"key": "banana:http://127.0.0.1:8081/worker.html:1:17",
"line": 1,
"name": "banana",
"selfWeight": 18755,
"totalWeight": 20192,
},
Frame {
"col": undefined,
"file": undefined,
"key": "postMessage:undefined:undefined:undefined",
"line": undefined,
"name": "postMessage",
"selfWeight": 251,
"totalWeight": 251,
},
],
"name": "worker.json - CrRendererMain",
"stacks": Array [
" 15.06ms",
"(anonymous);(anonymous);saveBuiltin;makeCallable;(anonymous) 102.00µs",
"(anonymous);(anonymous);saveBuiltin 92.00µs",
"(anonymous);(anonymous);saveBuiltin;(program) 2.62ms",
" 312.00µs",
"(program) 295.00µs",
" 105.00µs",
"(program) 306.00µs",
" 111.00µs",
"(program) 109.00µs",
" 197.00µs",
"(program) 110.00µs",
"(program);(garbage collector) 102.00µs",
"(program) 1.25ms",
"(anonymous);(anonymous);saveBuiltin 141.00µs",
"(anonymous);(anonymous);saveBuiltin;makeCallable 122.00µs",
"(anonymous);(anonymous);saveBuiltin;makeCallable;(program) 6.65ms",
"(anonymous) 598.00µs",
"(anonymous);(garbage collector) 778.00µs",
"(anonymous) 660.00µs",
"(anonymous);La 407.00µs",
"(anonymous);La;get webstore 139.00µs",
"(anonymous);La;get webstore;(anonymous) 1.15ms",
"(anonymous);La;get webstore;(anonymous);privates 132.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous) 791.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates 135.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates;(anonymous) 669.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous) 375.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous);privates 134.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous) 256.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous);privates 135.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous) 847.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous);privates 133.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous) 580.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates;(anonymous) 153.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);expose;target.(anonymous function);Apply 146.00µs",
"(anonymous);La;get webstore;(anonymous) 744.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous) 151.00µs",
"(anonymous);La;get webstore;(anonymous);privates;(anonymous);expose 147.00µs",
"(anonymous);La;get webstore;(anonymous);privates 141.00µs",
"(anonymous);La;get webstore;(anonymous) 146.00µs",
"(anonymous);La;get webstore;(anonymous);privates 139.00µs",
"(anonymous);La;get webstore;(anonymous) 142.00µs",
"(anonymous);La;get webstore;(anonymous);generate;privates 120.00µs",
"(anonymous);La;get webstore;(anonymous);generate;shouldCheckUnprivileged;target.(anonymous function);Apply 146.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply 259.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);JSONSchemaValidator.addTypes 149.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply 153.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply 251.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply;(anonymous);target.(anonymous function) 292.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply;(anonymous) 295.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply 152.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous) 159.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);privates 135.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);privates 133.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);Event 139.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);Event;privates.constructPrivate;target.(anonymous function);Apply 137.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);Event;privates.constructPrivate;target.(anonymous function);Apply;EventImpl 125.00µs",
"(anonymous);La;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous) 142.00µs",
"(anonymous);La;get webstore;(anonymous);generate;addProperties 149.00µs",
"(anonymous);La;get webstore;(anonymous);generate;addProperties;forEach;target.(anonymous function);Apply 126.00µs",
"(anonymous);La;get webstore;(anonymous);generate 149.00µs",
"(anonymous);La;get webstore;(anonymous);generate;runHooks_;target.(anonymous function);Apply;(anonymous) 141.00µs",
"(anonymous);La;get webstore;(anonymous);generate;runHooks_;target.(anonymous function);Apply;(anonymous);(anonymous) 132.00µs",
"(anonymous) 160.00µs",
"(anonymous);l 127.00µs",
"(anonymous) 132.00µs",
"(anonymous);publicClassPrototype.(anonymous function);target.(anonymous function);Apply 141.00µs",
"(anonymous);publicClassPrototype.(anonymous function);target.(anonymous function);Apply;EventImpl.addListener 135.00µs",
"(anonymous);bb 146.00µs",
"(anonymous);(anonymous) 141.00µs",
"(anonymous);(anonymous);(program) 930.00µs",
"(anonymous);(anonymous);saveBuiltin;makeCallable;(anonymous) 132.00µs",
"(anonymous);(anonymous);(anonymous) 116.00µs",
"(anonymous);(anonymous);(anonymous);(program) 27.49ms",
"(anonymous) 542.00µs",
"(anonymous);insertTextScript 392.00µs",
"(anonymous);insertTextScript;insertHeaderNode 292.00µs",
"(anonymous);insertTextScript;insertHeaderNode;appendChild;(anonymous);(anonymous) 148.00µs",
"(anonymous);insertTextScript;insertHeaderNode;appendChild 145.00µs",
"(anonymous);listenForMessage;get webstore 148.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous) 121.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous) 130.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous);privates;(anonymous) 254.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);privates;(anonymous);privates;(anonymous);(anonymous) 135.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);privates 122.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);privates;(anonymous);target.(anonymous function);Apply 130.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous) 141.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;target.(anonymous function) 154.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply;(anonymous) 123.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply;(anonymous);target.(anonymous function) 137.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply 257.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply;(garbage collector) 1.58ms",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply;(anonymous) 128.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply;(anonymous);target.(anonymous function);Apply 289.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);privates 292.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;target.(anonymous function);Apply;(anonymous);Event;privates.constructPrivate;target.(anonymous function);Apply;EventImpl 126.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;addProperties;forEach;target.(anonymous function) 144.00µs",
"(anonymous);listenForMessage;get webstore;(anonymous);generate;addProperties;forEach;target.(anonymous function);(program) 291.00µs",
"(anonymous);Worker 416.00µs",
"(anonymous);Worker;(program) 523.00µs",
"cb;$a 278.00µs",
"cb;$a;(program) 81.00µs",
"(anonymous);setTimeout 42.00µs",
"(anonymous);setTimeout;(program) 641.00µs",
"(anonymous);setTimeout 21.00µs",
"(anonymous) 117.00µs",
"(anonymous);(program) 540.00µs",
" 511.00µs",
"(program) 125.00µs",
" 136.00µs",
"(program) 1.06ms",
" 133.00µs",
"(program) 1.46ms",
" 261.00µs",
"(program) 147.00µs",
" 4.74ms",
"(program) 145.00µs",
" 525.00µs",
"(program) 221.00µs",
" 325.00µs",
"(program) 399.00µs",
" 146.00µs",
"(program) 391.00µs",
" 4.01ms",
"(program) 131.00µs",
" 1.10ms",
"(program) 146.00µs",
" 2.91ms",
"(program) 280.00µs",
"worker.onmessage;apple;banana 420.00µs",
"worker.onmessage;apple 128.00µs",
"worker.onmessage;apple;banana 1.27ms",
"worker.onmessage;apple 146.00µs",
"worker.onmessage;apple;banana 1.06ms",
"worker.onmessage;apple 130.00µs",
"worker.onmessage;apple;banana 129.00µs",
"worker.onmessage;postMessage 143.00µs",
" 1.80ms",
"worker.onmessage;apple;banana 1.53ms",
"worker.onmessage;postMessage 108.00µs",
" 1.63ms",
"(program) 141.00µs",
"worker.onmessage;apple;banana 1.86ms",
" 1.75ms",
"worker.onmessage;apple;banana 1.67ms",
" 1.84ms",
"worker.onmessage;apple;banana 1.62ms",
"worker.onmessage;apple;banana;(program) 146.00µs",
" 1.67ms",
"worker.onmessage;apple;banana 1.45ms",
"worker.onmessage;apple;banana;(garbage collector) 923.00µs",
"worker.onmessage;apple;banana 136.00µs",
"worker.onmessage;apple;banana;(program) 132.00µs",
" 1.81ms",
"(program) 136.00µs",
"worker.onmessage;apple;banana 1.69ms",
" 1.75ms",
"(program) 131.00µs",
"worker.onmessage;apple;banana 282.00µs",
"worker.onmessage;apple 128.00µs",
"worker.onmessage;apple;banana 1.10ms",
"worker.onmessage;apple;banana;(program) 136.00µs",
" 1.57ms",
"worker.onmessage;apple;banana 665.00µs",
"worker.onmessage;apple 128.00µs",
"worker.onmessage;apple;banana 779.00µs",
" 1.56ms",
"(program) 131.00µs",
"worker.onmessage;apple;banana 1.56ms",
" 1.57ms",
"(program) 149.00µs",
"worker.onmessage;apple;banana 1.54ms",
"worker.onmessage;apple;banana;(program) 100.00µs",
" 52.45ms",
"(program) 125.00µs",
" 88.71ms",
"(program) 1.06ms",
],
}
`;
exports[`importFromChromeTimeline Workers Chrome 70 2`] = `
Object {
"frames": Array [
Frame {
"col": 20,
"file": "http://127.0.0.1:8081/worker.js",
"key": "onmessage:http://127.0.0.1:8081/worker.js:14:20",
"line": 14,
"name": "onmessage",
"selfWeight": 402,
"totalWeight": 187278,
},
Frame {
"col": 14,
"file": "http://127.0.0.1:8081/worker.js",
"key": "alpha:http://127.0.0.1:8081/worker.js:8:14",
"line": 8,
"name": "alpha",
"selfWeight": 7945,
"totalWeight": 177837,
},
Frame {
"col": 14,
"file": "http://127.0.0.1:8081/worker.js",
"key": "gamma:http://127.0.0.1:8081/worker.js:0:14",
"line": 0,
"name": "gamma",
"selfWeight": 13631,
"totalWeight": 21888,
},
Frame {
"col": undefined,
"file": undefined,
"key": "(program):undefined:undefined:undefined",
"line": undefined,
"name": "(program)",
"selfWeight": 164753,
"totalWeight": 164753,
},
Frame {
"col": undefined,
"file": undefined,
"key": "postMessage:undefined:undefined:undefined",
"line": undefined,
"name": "postMessage",
"selfWeight": 547,
"totalWeight": 5452,
},
],
"name": "worker.json - DedicatedWorker thread",
"stacks": Array [
" 4.33ms",
"onmessage;alpha;gamma 604.00µs",
"onmessage;alpha 1.38ms",
"onmessage;alpha;gamma 3.31ms",
"onmessage 270.00µs",
"onmessage;(program) 3.59ms",
"onmessage;alpha;gamma 127.00µs",
"onmessage;alpha 128.00µs",
"onmessage;alpha;gamma 1.48ms",
"onmessage;alpha;gamma;(program) 1.68ms",
"onmessage;alpha;gamma 1.65ms",
"onmessage;alpha;gamma;(program) 2.00ms",
"onmessage;alpha;gamma 1.62ms",
"onmessage;postMessage 146.00µs",
"onmessage;postMessage;(program) 1.65ms",
"onmessage;alpha;gamma 1.70ms",
"onmessage;postMessage 256.00µs",
"onmessage;postMessage;(program) 1.63ms",
"onmessage;alpha;gamma 670.00µs",
"onmessage;alpha 134.00µs",
"onmessage;alpha;gamma 899.00µs",
"onmessage;alpha;gamma;(program) 2.72ms",
"onmessage 132.00µs",
"onmessage;alpha;gamma 1.57ms",
"onmessage;alpha;gamma;(program) 1.85ms",
"onmessage;alpha 1.75ms",
"onmessage;alpha;(program) 1.76ms",
"onmessage;alpha 1.44ms",
"onmessage;postMessage 145.00µs",
"onmessage;postMessage;(program) 1.63ms",
"onmessage;alpha 1.57ms",
"onmessage;alpha;(program) 1.60ms",
"onmessage;alpha 1.55ms",
"onmessage;alpha;(program) 144.64ms",
],
}
`;
exports[`importFromChromeTimeline Workers Chrome 70: indexToView 1`] = `0`;
exports[`importFromChromeTimeline Workers Chrome 70: profileGroup.name 1`] = `"worker.json"`;
exports[`importFromChromeTimeline: indexToView 1`] = `0`;
exports[`importFromChromeTimeline: profileGroup.name 1`] = `"simple-timeline.json"`;
@@ -0,0 +1,864 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`importFromHaskell 1`] = `
Object {
"frames": Array [
Frame {
"col": undefined,
"file": undefined,
"key": 144,
"line": undefined,
"name": "MAIN.MAIN",
"selfWeight": 0,
"totalWeight": 798,
},
Frame {
"col": undefined,
"file": undefined,
"key": 56,
"line": undefined,
"name": "GHC.Conc.Signal.CAF",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 73,
"line": undefined,
"name": "GHC.IO.Encoding.CAF",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 75,
"line": undefined,
"name": "GHC.IO.Encoding.Iconv.CAF",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 84,
"line": undefined,
"name": "GHC.IO.Handle.FD.CAF",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 119,
"line": undefined,
"name": "Text.Printf.CAF",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 26,
"line": undefined,
"name": "Main.CAF:eta1_r6nI",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "src/Main.hs:(21,1)-(38,42)",
"key": 19,
"line": undefined,
"name": "Main.main",
"selfWeight": 0,
"totalWeight": 733,
},
Frame {
"col": undefined,
"file": "src/Main.hs:(56,1)-(57,42)",
"key": 4,
"line": undefined,
"name": "Main.check",
"selfWeight": 320,
"totalWeight": 320,
},
Frame {
"col": undefined,
"file": "src/Main.hs:31:9-29",
"key": 16,
"line": undefined,
"name": "Main.main.long",
"selfWeight": 0,
"totalWeight": 3,
},
Frame {
"col": undefined,
"file": undefined,
"key": 28,
"line": undefined,
"name": "Main.CAF:eta_r6nG",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 35,
"line": undefined,
"name": "Main.CAF:io1",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 27,
"line": undefined,
"name": "Main.CAF:lvl2_r6nH",
"selfWeight": 0,
"totalWeight": 3,
},
Frame {
"col": undefined,
"file": "src/Main.hs:(61,1)-(63,26)",
"key": 3,
"line": undefined,
"name": "Main.make",
"selfWeight": 406,
"totalWeight": 409,
},
Frame {
"col": undefined,
"file": "src/Main.hs:63:19-26",
"key": 1,
"line": undefined,
"name": "Main.make.d2",
"selfWeight": 2,
"totalWeight": 2,
},
Frame {
"col": undefined,
"file": "src/Main.hs:63:9-16",
"key": 2,
"line": undefined,
"name": "Main.make.i2",
"selfWeight": 1,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": undefined,
"key": 24,
"line": undefined,
"name": "Main.CAF:lvl4_r6nL",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 22,
"line": undefined,
"name": "Main.CAF:lvl8_r6nP",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 21,
"line": undefined,
"name": "Main.CAF:main1",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 29,
"line": undefined,
"name": "Main.CAF:main11",
"selfWeight": 0,
"totalWeight": 4,
},
Frame {
"col": undefined,
"file": "src/Main.hs:27:9-35",
"key": 15,
"line": undefined,
"name": "Main.main.c",
"selfWeight": 0,
"totalWeight": 8,
},
Frame {
"col": undefined,
"file": undefined,
"key": 30,
"line": undefined,
"name": "Main.CAF:main12",
"selfWeight": 0,
"totalWeight": 4,
},
Frame {
"col": undefined,
"file": undefined,
"key": 23,
"line": undefined,
"name": "Main.CAF:main5",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 31,
"line": undefined,
"name": "Main.CAF:main7",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 25,
"line": undefined,
"name": "Main.CAF:main9",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:23:9-12",
"key": 33,
"line": undefined,
"name": "Main.CAF:main_maxN",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:23:9-35",
"key": 13,
"line": undefined,
"name": "Main.main.maxN",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:22:9",
"key": 34,
"line": undefined,
"name": "Main.CAF:main_n",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:22:9-14",
"key": 12,
"line": undefined,
"name": "Main.main.n",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:24:9-16",
"key": 32,
"line": undefined,
"name": "Main.CAF:main_stretchN",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:24:9-27",
"key": 14,
"line": undefined,
"name": "Main.main.stretchN",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:17:1-4",
"key": 36,
"line": undefined,
"name": "Main.CAF:minN",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:17:1-8",
"key": 9,
"line": undefined,
"name": "Main.minN",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 146,
"line": undefined,
"name": "GC.GC",
"selfWeight": 46,
"totalWeight": 46,
},
Frame {
"col": undefined,
"file": undefined,
"key": 147,
"line": undefined,
"name": "PROFILING.OVERHEAD_of",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 145,
"line": undefined,
"name": "SYSTEM.SYSTEM",
"selfWeight": 19,
"totalWeight": 19,
},
Frame {
"col": undefined,
"file": "src/Main.hs:35:26-54",
"key": 18,
"line": undefined,
"name": "Main.main.\\\\",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:19:1-56",
"key": 8,
"line": undefined,
"name": "Main.io",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:34:9-28",
"key": 17,
"line": undefined,
"name": "Main.main.vs",
"selfWeight": 0,
"totalWeight": 721,
},
Frame {
"col": undefined,
"file": "src/Main.hs:(42,1)-(45,38)",
"key": 11,
"line": undefined,
"name": "Main.depth",
"selfWeight": 0,
"totalWeight": 721,
},
Frame {
"col": undefined,
"file": "src/Main.hs:(49,1)-(52,31)",
"key": 7,
"line": undefined,
"name": "Main.sumT",
"selfWeight": 0,
"totalWeight": 721,
},
Frame {
"col": undefined,
"file": "src/Main.hs:51:9-31",
"key": 6,
"line": undefined,
"name": "Main.sumT.a",
"selfWeight": 3,
"totalWeight": 369,
},
Frame {
"col": undefined,
"file": "src/Main.hs:52:9-31",
"key": 5,
"line": undefined,
"name": "Main.sumT.b",
"selfWeight": 1,
"totalWeight": 352,
},
Frame {
"col": undefined,
"file": "src/Main.hs:45:9-38",
"key": 10,
"line": undefined,
"name": "Main.depth.n",
"selfWeight": 0,
"totalWeight": 0,
},
],
"name": "binary-trees time",
"stacks": Array [
"MAIN.MAIN;Main.CAF:eta1_r6nI;Main.main;Main.check 1.00ms",
"MAIN.MAIN;Main.CAF:lvl2_r6nH;Main.main;Main.main.long;Main.make 3.00ms",
"MAIN.MAIN;Main.CAF:main11;Main.main;Main.main.c;Main.check 4.00ms",
"MAIN.MAIN;Main.CAF:main12;Main.main;Main.main.c;Main.make 4.00ms",
"MAIN.MAIN;GC.GC 46.00ms",
"MAIN.MAIN;SYSTEM.SYSTEM 19.00ms",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.a;Main.check 153.00ms",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.a;Main.make;Main.make.d2 2.00ms",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.a;Main.make;Main.make.i2 1.00ms",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.a;Main.make 210.00ms",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.a 3.00ms",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.b;Main.check 162.00ms",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.b;Main.make 189.00ms",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.b 1.00ms",
],
}
`;
exports[`importFromHaskell 2`] = `
Object {
"frames": Array [
Frame {
"col": undefined,
"file": undefined,
"key": 144,
"line": undefined,
"name": "MAIN.MAIN",
"selfWeight": 648,
"totalWeight": 1921672664,
},
Frame {
"col": undefined,
"file": undefined,
"key": 56,
"line": undefined,
"name": "GHC.Conc.Signal.CAF",
"selfWeight": 640,
"totalWeight": 640,
},
Frame {
"col": undefined,
"file": undefined,
"key": 73,
"line": undefined,
"name": "GHC.IO.Encoding.CAF",
"selfWeight": 2768,
"totalWeight": 2768,
},
Frame {
"col": undefined,
"file": undefined,
"key": 75,
"line": undefined,
"name": "GHC.IO.Encoding.Iconv.CAF",
"selfWeight": 200,
"totalWeight": 200,
},
Frame {
"col": undefined,
"file": undefined,
"key": 84,
"line": undefined,
"name": "GHC.IO.Handle.FD.CAF",
"selfWeight": 34704,
"totalWeight": 34704,
},
Frame {
"col": undefined,
"file": undefined,
"key": 119,
"line": undefined,
"name": "Text.Printf.CAF",
"selfWeight": 528,
"totalWeight": 528,
},
Frame {
"col": undefined,
"file": undefined,
"key": 26,
"line": undefined,
"name": "Main.CAF:eta1_r6nI",
"selfWeight": 0,
"totalWeight": 2097152,
},
Frame {
"col": undefined,
"file": "src/Main.hs:(21,1)-(38,42)",
"key": 19,
"line": undefined,
"name": "Main.main",
"selfWeight": 32,
"totalWeight": 1921591544,
},
Frame {
"col": undefined,
"file": "src/Main.hs:(56,1)-(57,42)",
"key": 4,
"line": undefined,
"name": "Main.check",
"selfWeight": 406149056,
"totalWeight": 406149056,
},
Frame {
"col": undefined,
"file": "src/Main.hs:31:9-29",
"key": 16,
"line": undefined,
"name": "Main.main.long",
"selfWeight": 32,
"totalWeight": 7864112,
},
Frame {
"col": undefined,
"file": undefined,
"key": 28,
"line": undefined,
"name": "Main.CAF:eta_r6nG",
"selfWeight": 1096,
"totalWeight": 1096,
},
Frame {
"col": undefined,
"file": undefined,
"key": 35,
"line": undefined,
"name": "Main.CAF:io1",
"selfWeight": 1888,
"totalWeight": 1888,
},
Frame {
"col": undefined,
"file": undefined,
"key": 27,
"line": undefined,
"name": "Main.CAF:lvl2_r6nH",
"selfWeight": 0,
"totalWeight": 7864112,
},
Frame {
"col": undefined,
"file": "src/Main.hs:(61,1)-(63,26)",
"key": 3,
"line": undefined,
"name": "Main.make",
"selfWeight": 1512575520,
"totalWeight": 1512575520,
},
Frame {
"col": undefined,
"file": "src/Main.hs:63:19-26",
"key": 1,
"line": undefined,
"name": "Main.make.d2",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:63:9-16",
"key": 2,
"line": undefined,
"name": "Main.make.i2",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 24,
"line": undefined,
"name": "Main.CAF:lvl4_r6nL",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 22,
"line": undefined,
"name": "Main.CAF:lvl8_r6nP",
"selfWeight": 520,
"totalWeight": 520,
},
Frame {
"col": undefined,
"file": undefined,
"key": 21,
"line": undefined,
"name": "Main.CAF:main1",
"selfWeight": 16,
"totalWeight": 16,
},
Frame {
"col": undefined,
"file": undefined,
"key": 29,
"line": undefined,
"name": "Main.CAF:main11",
"selfWeight": 0,
"totalWeight": 4194304,
},
Frame {
"col": undefined,
"file": "src/Main.hs:27:9-35",
"key": 15,
"line": undefined,
"name": "Main.main.c",
"selfWeight": 64,
"totalWeight": 19922736,
},
Frame {
"col": undefined,
"file": undefined,
"key": 30,
"line": undefined,
"name": "Main.CAF:main12",
"selfWeight": 0,
"totalWeight": 15728432,
},
Frame {
"col": undefined,
"file": undefined,
"key": 23,
"line": undefined,
"name": "Main.CAF:main5",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 31,
"line": undefined,
"name": "Main.CAF:main7",
"selfWeight": 880,
"totalWeight": 880,
},
Frame {
"col": undefined,
"file": undefined,
"key": 25,
"line": undefined,
"name": "Main.CAF:main9",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:23:9-12",
"key": 33,
"line": undefined,
"name": "Main.CAF:main_maxN",
"selfWeight": 0,
"totalWeight": 32,
},
Frame {
"col": undefined,
"file": "src/Main.hs:23:9-35",
"key": 13,
"line": undefined,
"name": "Main.main.maxN",
"selfWeight": 32,
"totalWeight": 32,
},
Frame {
"col": undefined,
"file": "src/Main.hs:22:9",
"key": 34,
"line": undefined,
"name": "Main.CAF:main_n",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:22:9-14",
"key": 12,
"line": undefined,
"name": "Main.main.n",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:24:9-16",
"key": 32,
"line": undefined,
"name": "Main.CAF:main_stretchN",
"selfWeight": 0,
"totalWeight": 32,
},
Frame {
"col": undefined,
"file": "src/Main.hs:24:9-27",
"key": 14,
"line": undefined,
"name": "Main.main.stretchN",
"selfWeight": 32,
"totalWeight": 32,
},
Frame {
"col": undefined,
"file": "src/Main.hs:17:1-4",
"key": 36,
"line": undefined,
"name": "Main.CAF:minN",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": "src/Main.hs:17:1-8",
"key": 9,
"line": undefined,
"name": "Main.minN",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 146,
"line": undefined,
"name": "GC.GC",
"selfWeight": 0,
"totalWeight": 0,
},
Frame {
"col": undefined,
"file": undefined,
"key": 147,
"line": undefined,
"name": "PROFILING.OVERHEAD_of",
"selfWeight": 2496,
"totalWeight": 2496,
},
Frame {
"col": undefined,
"file": undefined,
"key": 145,
"line": undefined,
"name": "SYSTEM.SYSTEM",
"selfWeight": 34736,
"totalWeight": 34736,
},
Frame {
"col": undefined,
"file": "src/Main.hs:35:26-54",
"key": 18,
"line": undefined,
"name": "Main.main.\\\\",
"selfWeight": 2224,
"totalWeight": 46672,
},
Frame {
"col": undefined,
"file": "src/Main.hs:19:1-56",
"key": 8,
"line": undefined,
"name": "Main.io",
"selfWeight": 67912,
"totalWeight": 67912,
},
Frame {
"col": undefined,
"file": "src/Main.hs:34:9-28",
"key": 17,
"line": undefined,
"name": "Main.main.vs",
"selfWeight": 0,
"totalWeight": 1891637344,
},
Frame {
"col": undefined,
"file": "src/Main.hs:(42,1)-(45,38)",
"key": 11,
"line": undefined,
"name": "Main.depth",
"selfWeight": 1120,
"totalWeight": 1891637344,
},
Frame {
"col": undefined,
"file": "src/Main.hs:(49,1)-(52,31)",
"key": 7,
"line": undefined,
"name": "Main.sumT",
"selfWeight": 0,
"totalWeight": 1891636224,
},
Frame {
"col": undefined,
"file": "src/Main.hs:51:9-31",
"key": 6,
"line": undefined,
"name": "Main.sumT.a",
"selfWeight": 1397760,
"totalWeight": 945818112,
},
Frame {
"col": undefined,
"file": "src/Main.hs:52:9-31",
"key": 5,
"line": undefined,
"name": "Main.sumT.b",
"selfWeight": 1397760,
"totalWeight": 945818112,
},
Frame {
"col": undefined,
"file": "src/Main.hs:45:9-38",
"key": 10,
"line": undefined,
"name": "Main.depth.n",
"selfWeight": 0,
"totalWeight": 0,
},
],
"name": "binary-trees allocation",
"stacks": Array [
"MAIN.MAIN;GHC.Conc.Signal.CAF 640 B",
"MAIN.MAIN;GHC.IO.Encoding.CAF 2.70 KB",
"MAIN.MAIN;GHC.IO.Encoding.Iconv.CAF 200 B",
"MAIN.MAIN;GHC.IO.Handle.FD.CAF 33.89 KB",
"MAIN.MAIN;Text.Printf.CAF 528 B",
"MAIN.MAIN;Main.CAF:eta1_r6nI;Main.main;Main.check 2.00 MB",
"MAIN.MAIN;Main.CAF:eta1_r6nI;Main.main 32 B",
"MAIN.MAIN;Main.CAF:eta_r6nG 1.07 KB",
"MAIN.MAIN;Main.CAF:io1 1.84 KB",
"MAIN.MAIN;Main.CAF:lvl2_r6nH;Main.main;Main.main.long;Main.make 7.50 MB",
"MAIN.MAIN;Main.CAF:lvl2_r6nH;Main.main;Main.main.long 32 B",
"MAIN.MAIN;Main.CAF:lvl8_r6nP 520 B",
"MAIN.MAIN;Main.CAF:main1 16 B",
"MAIN.MAIN;Main.CAF:main11;Main.main;Main.main.c;Main.check 4.00 MB",
"MAIN.MAIN;Main.CAF:main11;Main.main;Main.main.c 32 B",
"MAIN.MAIN;Main.CAF:main12;Main.main;Main.main.c;Main.make 15.00 MB",
"MAIN.MAIN;Main.CAF:main12;Main.main;Main.main.c 32 B",
"MAIN.MAIN;Main.CAF:main7 880 B",
"MAIN.MAIN;Main.CAF:main_maxN;Main.main;Main.main.maxN 32 B",
"MAIN.MAIN;Main.CAF:main_stretchN;Main.main;Main.main.stretchN 32 B",
"MAIN.MAIN;PROFILING.OVERHEAD_of 2.44 KB",
"MAIN.MAIN;SYSTEM.SYSTEM 33.92 KB",
"MAIN.MAIN;Main.main;Main.main.\\\\;Main.io 43.41 KB",
"MAIN.MAIN;Main.main;Main.main.\\\\ 2.17 KB",
"MAIN.MAIN;Main.main;Main.io 22.91 KB",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.a;Main.check 190.67 MB",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.a;Main.make 710.00 MB",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.a 1.33 MB",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.b;Main.check 190.67 MB",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.b;Main.make 710.00 MB",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth;Main.sumT;Main.sumT.b 1.33 MB",
"MAIN.MAIN;Main.main;Main.main.vs;Main.depth 1.09 KB",
"MAIN.MAIN 648 B",
],
}
`;
exports[`importFromHaskell: indexToView 1`] = `0`;
exports[`importFromHaskell: profileGroup.name 1`] = `"binary-trees"`;
+249
View File
@@ -0,0 +1,249 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`importAsPprofProfile 1`] = `
Object {
"frames": Array [
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go",
"key": "runtime.main:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go:0",
"line": 0,
"name": "runtime.main",
"selfWeight": 0,
"totalWeight": 136,
},
Frame {
"col": undefined,
"file": "/Users/jlfwong/code/speedscope/sample/programs/go/simple.go",
"key": "main.main:/Users/jlfwong/code/speedscope/sample/programs/go/simple.go:0",
"line": 0,
"name": "main.main",
"selfWeight": 0,
"totalWeight": 136,
},
Frame {
"col": undefined,
"file": "/Users/jlfwong/code/speedscope/sample/programs/go/simple.go",
"key": "main.delta:/Users/jlfwong/code/speedscope/sample/programs/go/simple.go:0",
"line": 0,
"name": "main.delta",
"selfWeight": 22,
"totalWeight": 58,
},
Frame {
"col": undefined,
"file": "/Users/jlfwong/code/speedscope/sample/programs/go/simple.go",
"key": "main.beta:/Users/jlfwong/code/speedscope/sample/programs/go/simple.go:0",
"line": 0,
"name": "main.beta",
"selfWeight": 39,
"totalWeight": 39,
},
Frame {
"col": undefined,
"file": "/Users/jlfwong/code/speedscope/sample/programs/go/simple.go",
"key": "main.alpha:/Users/jlfwong/code/speedscope/sample/programs/go/simple.go:0",
"line": 0,
"name": "main.alpha",
"selfWeight": 48,
"totalWeight": 48,
},
Frame {
"col": undefined,
"file": "/Users/jlfwong/code/speedscope/sample/programs/go/simple.go",
"key": "main.gamma:/Users/jlfwong/code/speedscope/sample/programs/go/simple.go:0",
"line": 0,
"name": "main.gamma",
"selfWeight": 27,
"totalWeight": 27,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/asm_amd64.s",
"key": "runtime.morestack:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/asm_amd64.s:0",
"line": 0,
"name": "runtime.morestack",
"selfWeight": 0,
"totalWeight": 11,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/stack.go",
"key": "runtime.newstack:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/stack.go:0",
"line": 0,
"name": "runtime.newstack",
"selfWeight": 0,
"totalWeight": 11,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/duff_amd64.s",
"key": "runtime.duffcopy:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/duff_amd64.s:0",
"line": 0,
"name": "runtime.duffcopy",
"selfWeight": 11,
"totalWeight": 11,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/time.go",
"key": "runtime.timerproc:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/time.go:0",
"line": 0,
"name": "runtime.timerproc",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/time.go",
"key": "runtime.goroutineReady:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/time.go:0",
"line": 0,
"name": "runtime.goroutineReady",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go",
"key": "runtime.goready:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go:0",
"line": 0,
"name": "runtime.goready",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/asm_amd64.s",
"key": "runtime.systemstack:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/asm_amd64.s:0",
"line": 0,
"name": "runtime.systemstack",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go",
"key": "runtime.goready.func1:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go:0",
"line": 0,
"name": "runtime.goready.func1",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go",
"key": "runtime.ready:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go:0",
"line": 0,
"name": "runtime.ready",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go",
"key": "runtime.wakep:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go:0",
"line": 0,
"name": "runtime.wakep",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go",
"key": "runtime.startm:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go:0",
"line": 0,
"name": "runtime.startm",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/lock_sema.go",
"key": "runtime.notewakeup:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/lock_sema.go:0",
"line": 0,
"name": "runtime.notewakeup",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/os_darwin.go",
"key": "runtime.semawakeup:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/os_darwin.go:0",
"line": 0,
"name": "runtime.semawakeup",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/os_darwin.go",
"key": "runtime.mach_semrelease:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/os_darwin.go:0",
"line": 0,
"name": "runtime.mach_semrelease",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/sys_darwin_amd64.s",
"key": "runtime.mach_semaphore_signal:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/sys_darwin_amd64.s:0",
"line": 0,
"name": "runtime.mach_semaphore_signal",
"selfWeight": 1,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go",
"key": "runtime.mstart:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go:0",
"line": 0,
"name": "runtime.mstart",
"selfWeight": 0,
"totalWeight": 2,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go",
"key": "runtime.mstart1:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go:0",
"line": 0,
"name": "runtime.mstart1",
"selfWeight": 0,
"totalWeight": 2,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go",
"key": "runtime.sysmon:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/proc.go:0",
"line": 0,
"name": "runtime.sysmon",
"selfWeight": 0,
"totalWeight": 2,
},
Frame {
"col": undefined,
"file": "/usr/local/Cellar/go/1.10.1/libexec/src/runtime/sys_darwin_amd64.s",
"key": "runtime.usleep:/usr/local/Cellar/go/1.10.1/libexec/src/runtime/sys_darwin_amd64.s:0",
"line": 0,
"name": "runtime.usleep",
"selfWeight": 2,
"totalWeight": 2,
},
],
"name": "simple.prof",
"stacks": Array [
"runtime.main;main.main;main.delta;main.beta 14",
"runtime.main;main.main;main.alpha 26",
"runtime.main;main.main;main.gamma 27",
"runtime.morestack;runtime.newstack;runtime.duffcopy 11",
"runtime.main;main.main;main.beta 25",
"runtime.main;main.main;main.delta 22",
"runtime.main;main.main;main.delta;main.alpha 22",
"runtime.timerproc;runtime.goroutineReady;runtime.goready;runtime.systemstack;runtime.goready.func1;runtime.ready;runtime.wakep;runtime.startm;runtime.notewakeup;runtime.semawakeup;runtime.mach_semrelease;runtime.mach_semaphore_signal 1",
"runtime.mstart;runtime.mstart1;runtime.sysmon;runtime.usleep 2",
],
}
`;
exports[`importAsPprofProfile: indexToView 1`] = `0`;
exports[`importAsPprofProfile: profileGroup.name 1`] = `"simple.prof"`;
File diff suppressed because it is too large Load Diff
+4
View File
@@ -11,3 +11,7 @@ test('importFromChromeTimeline', async () => {
test('importFromChromeTimeline Chrome 69', async () => {
await checkProfileSnapshot('./sample/profiles/Chrome/69/simple.json')
})
test('importFromChromeTimeline Workers Chrome 70', async () => {
await checkProfileSnapshot('./sample/profiles/Chrome/70/worker.json')
})
+61 -13
View File
@@ -1,5 +1,5 @@
import {Profile, FrameInfo, CallTreeProfileBuilder} from '../lib/profile'
import {getOrInsert, lastOf, sortBy} from '../lib/utils'
import {Profile, FrameInfo, CallTreeProfileBuilder, ProfileGroup} from '../lib/profile'
import {getOrInsert, lastOf, sortBy, itForEach} from '../lib/utils'
import {TimeFormatter} from '../lib/value-formatters'
// See: https://github.com/v8/v8/blob/master/src/inspector/js_protocol.json
@@ -15,6 +15,7 @@ interface TimelineEvent {
tdur: number
tts: number
args: {[key: string]: any}
id?: string
}
interface PositionTickInfo {
@@ -61,33 +62,54 @@ export function isChromeTimeline(rawProfile: any): boolean {
return true
}
export function importFromChromeTimeline(events: TimelineEvent[]): Profile {
export function importFromChromeTimeline(events: TimelineEvent[], fileName: string): ProfileGroup {
// It seems like sometimes Chrome timeline files contain multiple CpuProfiles?
// For now, choose the first one in the list.
let cpuProfile: CPUProfile | null = null
const cpuProfileByID = new Map<string, CPUProfile>()
// Maps profile IDs (like "0x3") to pid/tid pairs formatted as `${pid}:${tid}`
const pidTidById = new Map<string, string>()
// Maps pid/tid pairs to thread names
const threadNameByPidTid = new Map<string, string>()
// The events aren't necessarily recorded in chronological order. Sort them so
// that they are.
sortBy(events, e => e.ts)
const DEFAULT_ID = '(default id)'
for (let event of events) {
if (event.name == 'CpuProfile') {
cpuProfile = event.args.data.cpuProfile as CPUProfile
if (event.name === 'CpuProfile') {
cpuProfileByID.set(event.id || DEFAULT_ID, event.args.data.cpuProfile as CPUProfile)
if (event.id) {
pidTidById.set(event.id, `${event.pid}:${event.tid}`)
}
}
if (event.name == 'Profile') {
cpuProfile = {
if (event.name === 'Profile') {
cpuProfileByID.set(event.id || DEFAULT_ID, {
startTime: 0,
endTime: 0,
nodes: [],
samples: [],
timeDeltas: [],
...event.args.data,
})
if (event.id) {
pidTidById.set(event.id, `${event.pid}:${event.tid}`)
}
}
if (event.name == 'ProfileChunk') {
if (event.name === 'thread_name') {
threadNameByPidTid.set(`${event.pid}:${event.tid}`, event.args.name)
}
if (event.name === 'ProfileChunk') {
const cpuProfile = cpuProfileByID.get(event.id || DEFAULT_ID)
if (cpuProfile) {
const chunk = event.args.data
if (chunk.cpuProfile) {
@@ -108,13 +130,38 @@ export function importFromChromeTimeline(events: TimelineEvent[]): Profile {
cpuProfile.endTime = chunk.endTime
}
} else {
console.log('Ignoring ProfileChunk when no Profile is active')
console.warn(
`Ignoring ProfileChunk for undeclared Profile with id ${event.id || DEFAULT_ID}`,
)
}
}
}
if (cpuProfile) {
return importFromChromeCPUProfile(cpuProfile as CPUProfile)
if (cpuProfileByID.size > 0) {
const profiles: Profile[] = []
let indexToView = 0
itForEach(cpuProfileByID.keys(), profileId => {
let threadName: string | null = null
let pidTid = pidTidById.get(profileId)
if (pidTid) {
threadName = threadNameByPidTid.get(pidTid) || null
if (threadName) {
}
}
const profile = importFromChromeCPUProfile(cpuProfileByID.get(profileId)!)
if (threadName && cpuProfileByID.size > 1) {
profile.setName(`${fileName} - ${threadName}`)
if (threadName === 'CrRendererMain') {
indexToView = profiles.length
}
} else {
profile.setName(`${fileName}`)
}
profiles.push(profile)
})
return {name: fileName, indexToView, profiles}
} else {
throw new Error('Could not find CPU profile in Timeline')
}
@@ -198,7 +245,8 @@ export function importFromChromeCPUProfile(chromeProfile: CPUProfile): Profile {
} else {
let timeDelta = chromeProfile.timeDeltas[i + 1]
if (timeDelta < 0) {
console.warn('Substituting zero for unexpected time delta:', timeDelta, 'at index', i)
// This is super noisy, but can be helpful when debugging strange data
// console.warn('Substituting zero for unexpected time delta:', timeDelta, 'at index', i)
timeDelta = 0
}
+5
View File
@@ -0,0 +1,5 @@
import {checkProfileSnapshot} from '../lib/test-utils'
test('importFromHaskell', async () => {
await checkProfileSnapshot('./sample/profiles/haskell/simple.prof')
})
+98
View File
@@ -0,0 +1,98 @@
import {ProfileGroup, FrameInfo, CallTreeProfileBuilder} from '../lib/profile'
import {TimeFormatter, ByteFormatter} from '../lib/value-formatters'
// See https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html#json-profile-format
// for information on the GHC profiler JSON output format.
interface CostCentre {
id: number
label: string
module: string
src_loc: string
is_caf: boolean
}
interface ProfileTree {
id: number
entries: number
alloc: number
ticks: number
children: ProfileTree[]
}
interface HaskellProfile {
program: string
arguments: string[]
rts_arguments: string[]
end_time: string
initial_capabilities: number
total_time: number
total_ticks: number
tick_interval: number
total_alloc: number
cost_centres: CostCentre[]
profile: ProfileTree
}
// The profiler already collapses recursion before output so using the JS stack here should be fine
function addToProfile(
tree: ProfileTree,
startVal: number,
profile: CallTreeProfileBuilder,
infos: Map<number, FrameInfo>,
attribute: (tree: ProfileTree) => number,
): number {
// If the expression never did anything we don't care about it
if (tree.ticks === 0 && tree.entries === 0 && tree.alloc === 0 && tree.children.length === 0)
return startVal
let curVal = startVal
let frameInfo = infos.get(tree.id)!
profile.enterFrame(frameInfo, curVal)
for (let child of tree.children) {
curVal = addToProfile(child, curVal, profile, infos, attribute)
}
curVal += attribute(tree)
profile.leaveFrame(frameInfo, curVal)
return curVal
}
export function importFromHaskell(haskellProfile: HaskellProfile): ProfileGroup {
const idToFrameInfo = new Map<number, FrameInfo>()
for (let centre of haskellProfile.cost_centres) {
const frameInfo: FrameInfo = {
key: centre.id,
name: `${centre.module}.${centre.label}`,
}
// Ignore things like <entire-module> and <no location info>
if (!centre.src_loc.startsWith('<')) {
// This also contains line and column information, but sometimes it contains ranges,
// and in varying formats, so it's a better experience just to leave it as is
frameInfo.file = centre.src_loc
}
idToFrameInfo.set(centre.id, frameInfo)
}
const timeProfile = new CallTreeProfileBuilder(haskellProfile.total_ticks)
addToProfile(haskellProfile.profile, 0, timeProfile, idToFrameInfo, tree => tree.ticks)
timeProfile.setValueFormatter(new TimeFormatter('milliseconds'))
timeProfile.setName(`${haskellProfile.program} time`)
const allocProfile = new CallTreeProfileBuilder(haskellProfile.total_ticks)
addToProfile(haskellProfile.profile, 0, allocProfile, idToFrameInfo, tree => tree.alloc)
allocProfile.setValueFormatter(new ByteFormatter())
allocProfile.setName(`${haskellProfile.program} allocation`)
return {
name: haskellProfile.program,
indexToView: 0,
profiles: [timeProfile.build(), allocProfile.build()],
}
}
+4 -4
View File
@@ -1,8 +1,8 @@
import {importProfileGroup} from '.'
import {importProfileGroupFromText} from '.'
test('importProfileGroup', async () => {
// Importing garbage should return null
expect(await importProfileGroup('unknown', '')).toBe(null)
expect(await importProfileGroup('unknown', 'Hello world')).toBe(null)
expect(await importProfileGroup('unknown', 'Hello\n\nWorld')).toBe(null)
expect(await importProfileGroupFromText('unknown', '')).toBe(null)
expect(await importProfileGroupFromText('unknown', 'Hello world')).toBe(null)
expect(await importProfileGroupFromText('unknown', 'Hello\n\nWorld')).toBe(null)
})
+59 -8
View File
@@ -9,12 +9,43 @@ import {importFromFirefox} from './firefox'
import {importSpeedscopeProfiles} from '../lib/file-format'
import {importFromV8ProfLog} from './v8proflog'
import {importFromLinuxPerf} from './linux-tools-perf'
import {importFromHaskell} from './haskell'
import {ProfileDataSource, TextProfileDataSource, MaybeCompressedDataReader} from './utils'
import {importAsPprofProfile} from './pprof'
import {decodeBase64} from '../lib/utils'
import {importFromChromeHeapProfile} from './v8heapalloc'
export async function importProfileGroup(
export async function importProfileGroupFromText(
fileName: string,
contents: string,
): Promise<ProfileGroup | null> {
const profileGroup = await _importProfileGroup(fileName, contents)
return await importProfileGroup(new TextProfileDataSource(fileName, contents))
}
export async function importProfileGroupFromBase64(
fileName: string,
b64contents: string,
): Promise<ProfileGroup | null> {
return await importProfileGroup(
MaybeCompressedDataReader.fromArrayBuffer(fileName, decodeBase64(b64contents).buffer),
)
}
export async function importProfilesFromFile(file: File): Promise<ProfileGroup | null> {
return importProfileGroup(MaybeCompressedDataReader.fromFile(file))
}
export async function importProfilesFromArrayBuffer(
fileName: string,
buffer: ArrayBuffer,
): Promise<ProfileGroup | null> {
return importProfileGroup(MaybeCompressedDataReader.fromArrayBuffer(fileName, buffer))
}
async function importProfileGroup(dataSource: ProfileDataSource): Promise<ProfileGroup | null> {
const fileName = await dataSource.name()
const profileGroup = await _importProfileGroup(dataSource)
if (profileGroup) {
if (!profileGroup.name) {
profileGroup.name = fileName
@@ -34,10 +65,21 @@ function toGroup(profile: Profile | null): ProfileGroup | null {
return {name: profile.getName(), indexToView: 0, profiles: [profile]}
}
async function _importProfileGroup(
fileName: string,
contents: string,
): Promise<ProfileGroup | null> {
async function _importProfileGroup(dataSource: ProfileDataSource): Promise<ProfileGroup | null> {
const fileName = await dataSource.name()
const buffer = await dataSource.readAsArrayBuffer()
{
const profile = importAsPprofProfile(buffer)
if (profile) {
console.log('Importing as protobuf encoded pprof file')
return toGroup(profile)
}
}
const contents = await dataSource.readAsText()
// First pass: Check known file format names to infer the file type
if (fileName.endsWith('.speedscope.json')) {
console.log('Importing as speedscope json file')
@@ -47,7 +89,7 @@ async function _importProfileGroup(
return toGroup(importFromChromeCPUProfile(JSON.parse(contents)))
} else if (fileName.endsWith('.chrome.json') || /Profile-\d{8}T\d{6}/.exec(fileName)) {
console.log('Importing as Chrome Timeline')
return toGroup(importFromChromeTimeline(JSON.parse(contents)))
return importFromChromeTimeline(JSON.parse(contents), fileName)
} else if (fileName.endsWith('.stackprof.json')) {
console.log('Importing as stackprof profile')
return toGroup(importFromStackprof(JSON.parse(contents)))
@@ -63,6 +105,9 @@ async function _importProfileGroup(
} else if (fileName.endsWith('.v8log.json')) {
console.log('Importing as --prof-process v8 log')
return toGroup(importFromV8ProfLog(JSON.parse(contents)))
} else if (fileName.endsWith('.heapprofile')) {
console.log('Importing as Chrome Heap Profile')
return toGroup(importFromChromeHeapProfile(JSON.parse(contents)))
}
// Second pass: Try to guess what file format it is based on structure
@@ -79,7 +124,7 @@ async function _importProfileGroup(
return toGroup(importFromFirefox(parsed))
} else if (isChromeTimeline(parsed)) {
console.log('Importing as Chrome CPU Profile')
return toGroup(importFromChromeTimeline(parsed))
return importFromChromeTimeline(parsed, fileName)
} else if ('nodes' in parsed && 'samples' in parsed && 'timeDeltas' in parsed) {
console.log('Importing as Chrome Timeline')
return toGroup(importFromChromeCPUProfile(parsed))
@@ -89,6 +134,12 @@ async function _importProfileGroup(
} else if ('code' in parsed && 'functions' in parsed && 'ticks' in parsed) {
console.log('Importing as --prof-process v8 log')
return toGroup(importFromV8ProfLog(parsed))
} else if ('head' in parsed && 'selfSize' in parsed['head']) {
console.log('Importing as Chrome Heap Profile')
return toGroup(importFromChromeHeapProfile(JSON.parse(contents)))
} else if ('rts_arguments' in parsed && 'initial_capabilities' in parsed) {
console.log('Importing as Haskell GHC JSON Profile')
return importFromHaskell(parsed)
}
} else {
// Format is not JSON
+3 -47
View File
@@ -9,9 +9,9 @@ import {
ProfileGroup,
} from '../lib/profile'
import {sortBy, getOrThrow, getOrInsert, lastOf, getOrElse, zeroPad} from '../lib/utils'
import * as pako from 'pako'
import {ByteFormatter, TimeFormatter} from '../lib/value-formatters'
import {FileSystemDirectoryEntry, FileSystemEntry, FileSystemFileEntry} from './file-system-entry'
import {MaybeCompressedDataReader} from './utils'
function parseTSV<T>(contents: string): T[] {
const lines = contents.split('\n').map(l => l.split('\t'))
@@ -183,56 +183,12 @@ async function extractDirectoryTree(entry: FileSystemDirectoryEntry): Promise<Tr
return node
}
class MaybeCompressedFileReader {
private fileData: Promise<ArrayBuffer>
constructor(file: File) {
this.fileData = new Promise(resolve => {
const reader = new FileReader()
reader.addEventListener('loadend', () => {
if (!(reader.result instanceof ArrayBuffer)) {
throw new Error('Expected reader.result to be an instance of ArrayBuffer')
}
resolve(reader.result)
})
reader.readAsArrayBuffer(file)
})
}
private async getUncompressed(): Promise<ArrayBuffer> {
const fileData = await this.fileData
try {
const result = pako.inflate(new Uint8Array(fileData)).buffer
return result
} catch (e) {
return fileData
}
}
async readAsArrayBuffer(): Promise<ArrayBuffer> {
return await this.getUncompressed()
}
async readAsText(): Promise<string> {
const buffer = await this.getUncompressed()
let ret: string = ''
// JavaScript strings are UTF-16 encoded, but this data is coming
// from a UTF-8 encoded file.
const array = new Uint8Array(buffer)
for (let i = 0; i < array.length; i++) {
ret += String.fromCharCode(array[i])
}
return ret
}
}
function readAsArrayBuffer(file: File): Promise<ArrayBuffer> {
return new MaybeCompressedFileReader(file).readAsArrayBuffer()
return MaybeCompressedDataReader.fromFile(file).readAsArrayBuffer()
}
function readAsText(file: File): Promise<string> {
return new MaybeCompressedFileReader(file).readAsText()
return MaybeCompressedDataReader.fromFile(file).readAsText()
}
function getCoreDirForRun(tree: TraceDirectoryTree, selectedRun: number): TraceDirectoryTree {
+5
View File
@@ -0,0 +1,5 @@
import {checkProfileSnapshot} from '../lib/test-utils'
test('importAsPprofProfile', async () => {
await checkProfileSnapshot('./sample/profiles/pprof/simple.prof')
})
+134
View File
@@ -0,0 +1,134 @@
import {perftools} from './profile.proto.js'
import {FrameInfo, StackListProfileBuilder, Profile} from '../lib/profile'
import {lastOf} from '../lib/utils'
import {TimeFormatter, ByteFormatter} from '../lib/value-formatters'
interface SampleType {
type: string
unit: string
}
export function importAsPprofProfile(rawProfile: ArrayBuffer): Profile | null {
if (rawProfile.byteLength === 0) return null
let protoProfile: perftools.profiles.Profile
try {
protoProfile = perftools.profiles.Profile.decode(new Uint8Array(rawProfile))
} catch (e) {
return null
}
function i32(n: number | Long): number {
return typeof n === 'number' ? n : (n as Long).low
}
function stringVal(key: number | Long): string | null {
return protoProfile.stringTable[i32(key)] || null
}
const frameInfoByFunctionID = new Map<number, FrameInfo>()
function frameInfoForFunction(f: perftools.profiles.IFunction): FrameInfo | null {
const {name, filename, startLine} = f
const nameString = (name != null && stringVal(name)) || '(unknown)'
const fileNameString = filename != null ? stringVal(filename) : null
const line = startLine != null ? +startLine : null
const key = `${nameString}:${fileNameString}:${line}`
const frameInfo: FrameInfo = {
key,
name: nameString,
}
if (fileNameString != null) {
frameInfo.file = fileNameString
}
if (line != null) {
frameInfo.line = line
}
return frameInfo
}
for (let f of protoProfile.function) {
if (f.id) {
const frameInfo = frameInfoForFunction(f)
if (frameInfo != null) {
frameInfoByFunctionID.set(i32(f.id), frameInfo)
}
}
}
function frameInfoForLocation(location: perftools.profiles.ILocation): FrameInfo | null {
const {line} = location
if (line == null) return null
// From a comment on profile.proto:
//
// Multiple line indicates this location has inlined functions,
// where the last entry represents the caller into which the
// preceding entries were inlined.
//
// E.g., if memcpy() is inlined into printf:
// line[0].function_name == "memcpy"
// line[1].function_name == "printf"
//
// Let's just take the last line then
const lastLine = lastOf(line)
if (lastLine == null) return null
if (lastLine.functionId) {
return frameInfoByFunctionID.get(i32(lastLine.functionId)) || null
} else {
return null
}
}
const frameByLocationID = new Map<number, FrameInfo>()
for (let l of protoProfile.location) {
if (l.id != null) {
const frameInfo = frameInfoForLocation(l)
if (frameInfo) {
frameByLocationID.set(i32(l.id), frameInfo)
}
}
}
const sampleTypes: SampleType[] = protoProfile.sampleType.map(type => ({
type: (type.type && stringVal(type.type)) || 'samples',
unit: (type.unit && stringVal(type.unit)) || 'count',
}))
const sampleTypeIndex = protoProfile.defaultSampleType
? +protoProfile.defaultSampleType
: sampleTypes.length - 1
const sampleType = sampleTypes[sampleTypeIndex]
const profileBuilder = new StackListProfileBuilder()
switch (sampleType.unit) {
case 'nanoseconds':
case 'microseconds':
case 'milliseconds':
case 'seconds':
profileBuilder.setValueFormatter(new TimeFormatter(sampleType.unit))
break
case 'bytes':
profileBuilder.setValueFormatter(new ByteFormatter())
break
}
for (let s of protoProfile.sample) {
const stack = s.locationId ? s.locationId.map(l => frameByLocationID.get(i32(l))) : []
stack.reverse()
const value = s.value![sampleTypeIndex]
profileBuilder.appendSampleWithWeight(stack.filter(f => f != null) as FrameInfo[], +value)
}
return profileBuilder.build()
}
+206
View File
@@ -0,0 +1,206 @@
// THIS FILE WAS IMPORTED FROM AN EXTERNAL SOURCE. DO NOT MODIFY THIS FILE
// MANUALLY.
//
// Original from: https://github.com/google/pprof/blob/e027b50/proto/profile.proto
//
// This file is licensed under the Apache License 2.0
// (https://github.com/google/pprof/blob/e027b5/LICENSE)
// Profile is a common stacktrace profile format.
//
// Measurements represented with this format should follow the
// following conventions:
//
// - Consumers should treat unset optional fields as if they had been
// set with their default value.
//
// - When possible, measurements should be stored in "unsampled" form
// that is most useful to humans. There should be enough
// information present to determine the original sampled values.
//
// - On-disk, the serialized proto must be gzip-compressed.
//
// - The profile is represented as a set of samples, where each sample
// references a sequence of locations, and where each location belongs
// to a mapping.
// - There is a N->1 relationship from sample.location_id entries to
// locations. For every sample.location_id entry there must be a
// unique Location with that id.
// - There is an optional N->1 relationship from locations to
// mappings. For every nonzero Location.mapping_id there must be a
// unique Mapping with that id.
syntax = "proto3";
package perftools.profiles;
option java_package = "com.google.perftools.profiles";
option java_outer_classname = "ProfileProto";
message Profile {
// A description of the samples associated with each Sample.value.
// For a cpu profile this might be:
// [["cpu","nanoseconds"]] or [["wall","seconds"]] or [["syscall","count"]]
// For a heap profile, this might be:
// [["allocations","count"], ["space","bytes"]],
// If one of the values represents the number of events represented
// by the sample, by convention it should be at index 0 and use
// sample_type.unit == "count".
repeated ValueType sample_type = 1;
// The set of samples recorded in this profile.
repeated Sample sample = 2;
// Mapping from address ranges to the image/binary/library mapped
// into that address range. mapping[0] will be the main binary.
repeated Mapping mapping = 3;
// Useful program location
repeated Location location = 4;
// Functions referenced by locations
repeated Function function = 5;
// A common table for strings referenced by various messages.
// string_table[0] must always be "".
repeated string string_table = 6;
// frames with Function.function_name fully matching the following
// regexp will be dropped from the samples, along with their successors.
int64 drop_frames = 7; // Index into string table.
// frames with Function.function_name fully matching the following
// regexp will be kept, even if it matches drop_functions.
int64 keep_frames = 8; // Index into string table.
// The following fields are informational, do not affect
// interpretation of results.
// Time of collection (UTC) represented as nanoseconds past the epoch.
int64 time_nanos = 9;
// Duration of the profile, if a duration makes sense.
int64 duration_nanos = 10;
// The kind of events between sampled ocurrences.
// e.g [ "cpu","cycles" ] or [ "heap","bytes" ]
ValueType period_type = 11;
// The number of events between sampled occurrences.
int64 period = 12;
// Freeform text associated to the profile.
repeated int64 comment = 13; // Indices into string table.
// Index into the string table of the type of the preferred sample
// value. If unset, clients should default to the last sample value.
int64 default_sample_type = 14;
}
// ValueType describes the semantics and measurement units of a value.
message ValueType {
int64 type = 1; // Index into string table.
int64 unit = 2; // Index into string table.
}
// Each Sample records values encountered in some program
// context. The program context is typically a stack trace, perhaps
// augmented with auxiliary information like the thread-id, some
// indicator of a higher level request being handled etc.
message Sample {
// The ids recorded here correspond to a Profile.location.id.
// The leaf is at location_id[0].
repeated uint64 location_id = 1;
// The type and unit of each value is defined by the corresponding
// entry in Profile.sample_type. All samples must have the same
// number of values, the same as the length of Profile.sample_type.
// When aggregating multiple samples into a single sample, the
// result has a list of values that is the elemntwise sum of the
// lists of the originals.
repeated int64 value = 2;
// label includes additional context for this sample. It can include
// things like a thread id, allocation size, etc
repeated Label label = 3;
}
message Label {
int64 key = 1; // Index into string table
// At most one of the following must be present
int64 str = 2; // Index into string table
int64 num = 3;
// Should only be present when num is present.
// Specifies the units of num.
// Use arbitrary string (for example, "requests") as a custom count unit.
// If no unit is specified, consumer may apply heuristic to deduce the unit.
// Consumers may also interpret units like "bytes" and "kilobytes" as memory
// units and units like "seconds" and "nanoseconds" as time units,
// and apply appropriate unit conversions to these.
int64 num_unit = 4; // Index into string table
}
message Mapping {
// Unique nonzero id for the mapping.
uint64 id = 1;
// Address at which the binary (or DLL) is loaded into memory.
uint64 memory_start = 2;
// The limit of the address range occupied by this mapping.
uint64 memory_limit = 3;
// Offset in the binary that corresponds to the first mapped address.
uint64 file_offset = 4;
// The object this entry is loaded from. This can be a filename on
// disk for the main binary and shared libraries, or virtual
// abstractions like "[vdso]".
int64 filename = 5; // Index into string table
// A string that uniquely identifies a particular program version
// with high probability. E.g., for binaries generated by GNU tools,
// it could be the contents of the .note.gnu.build-id field.
int64 build_id = 6; // Index into string table
// The following fields indicate the resolution of symbolic info.
bool has_functions = 7;
bool has_filenames = 8;
bool has_line_numbers = 9;
bool has_inline_frames = 10;
}
// Describes function and line table debug information.
message Location {
// Unique nonzero id for the location. A profile could use
// instruction addresses or any integer sequence as ids.
uint64 id = 1;
// The id of the corresponding profile.Mapping for this location.
// It can be unset if the mapping is unknown or not applicable for
// this profile type.
uint64 mapping_id = 2;
// The instruction address for this location, if available. It
// should be within [Mapping.memory_start...Mapping.memory_limit]
// for the corresponding mapping. A non-leaf address may be in the
// middle of a call instruction. It is up to display tools to find
// the beginning of the instruction if necessary.
uint64 address = 3;
// Multiple line indicates this location has inlined functions,
// where the last entry represents the caller into which the
// preceding entries were inlined.
//
// E.g., if memcpy() is inlined into printf:
// line[0].function_name == "memcpy"
// line[1].function_name == "printf"
repeated Line line = 4;
// Provides an indication that multiple symbols map to this location's
// address, for example due to identical code folding by the linker. In that
// case the line information above represents one of the multiple
// symbols. This field must be recomputed when the symbolization state of the
// profile changes.
bool is_folded = 5;
}
message Line {
// The id of the corresponding profile.Function for this line.
uint64 function_id = 1;
// Line number in source code.
int64 line = 2;
}
message Function {
// Unique nonzero id for the function.
uint64 id = 1;
// Name of the function, in human-readable form if available.
int64 name = 2; // Index into string table
// Name of the function, as identified by the system.
// For instance, it can be a C++ mangled name.
int64 system_name = 3; // Index into string table
// Source file containing the function.
int64 filename = 4; // Index into string table
// Line number in source file.
int64 start_line = 5;
}
+1047
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+88
View File
@@ -0,0 +1,88 @@
import * as pako from 'pako'
export interface ProfileDataSource {
name(): Promise<string>
readAsArrayBuffer(): Promise<ArrayBuffer>
readAsText(): Promise<string>
}
export class TextProfileDataSource implements ProfileDataSource {
constructor(private fileName: string, private contents: string) {}
async name() {
return this.fileName
}
async readAsArrayBuffer() {
// JavaScript strings are UTF-16 encoded, but if this string is
// constructed based on
// TODO(jlfwong): Might want to make this construct an array
// buffer based on the text
return new ArrayBuffer(0)
}
async readAsText() {
return this.contents
}
}
export class MaybeCompressedDataReader implements ProfileDataSource {
private uncompressedData: Promise<ArrayBuffer>
constructor(
private namePromise: Promise<string>,
maybeCompressedDataPromise: Promise<ArrayBuffer>,
) {
this.uncompressedData = maybeCompressedDataPromise.then(async (fileData: ArrayBuffer) => {
try {
const result = pako.inflate(new Uint8Array(fileData)).buffer
return result
} catch (e) {
return fileData
}
})
}
async name(): Promise<string> {
return await this.namePromise
}
async readAsArrayBuffer(): Promise<ArrayBuffer> {
return await this.uncompressedData
}
async readAsText(): Promise<string> {
const buffer = await this.readAsArrayBuffer()
let ret: string = ''
if (typeof TextDecoder !== 'undefined') {
const decoder = new TextDecoder()
return decoder.decode(buffer)
} else {
// JavaScript strings are UTF-16 encoded, but we're reading data
// from disk that we're going to asusme is UTF-8 encoded.
const array = new Uint8Array(buffer)
for (let i = 0; i < array.length; i++) {
ret += String.fromCharCode(array[i])
}
return ret
}
}
static fromFile(file: File): MaybeCompressedDataReader {
const maybeCompressedDataPromise: Promise<ArrayBuffer> = new Promise(resolve => {
const reader = new FileReader()
reader.addEventListener('loadend', () => {
if (!(reader.result instanceof ArrayBuffer)) {
throw new Error('Expected reader.result to be an instance of ArrayBuffer')
}
resolve(reader.result)
})
reader.readAsArrayBuffer(file)
})
return new MaybeCompressedDataReader(Promise.resolve(file.name), maybeCompressedDataPromise)
}
static fromArrayBuffer(name: string, buffer: ArrayBuffer): MaybeCompressedDataReader {
return new MaybeCompressedDataReader(Promise.resolve(name), Promise.resolve(buffer))
}
}
+9
View File
@@ -0,0 +1,9 @@
import {checkProfileSnapshot} from '../lib/test-utils'
test('importV8HeapAlloc from Chrome', async () => {
await checkProfileSnapshot('./sample/profiles/Chrome/69/Heap-20181005T144546.heapprofile')
})
test('importV8HeapAlloc from NodeJS', async () => {
await checkProfileSnapshot('./sample/profiles/node/10.11.0/Heap-20181003T105432.heapprofile')
})
+109
View File
@@ -0,0 +1,109 @@
import {Profile, FrameInfo, StackListProfileBuilder} from '../lib/profile'
import {getOrInsert} from '../lib/utils'
import {ByteFormatter} from '../lib/value-formatters'
/**
* The V8 Heap Allocation profile is a way to represent heap allocation for each
* javascript function. The format is a simple tree where the weight of each node
* represent the memory allocated by the function and all its callee.
* You can find more information on how to get a profile there :
* https://developers.google.com/web/tools/chrome-devtools/memory-problems/#allocation-profile
* You need to scroll down to "Investigate memory allocation by function"
*
* Note that Node.JS can retrieve this kind of profile via the Inspector protocol.
*/
interface HeapProfileCallFrame {
columnNumber: number
functionName: string
lineNumber: number
scriptId: string
url: string
}
interface HeapProfileNode {
callFrame: HeapProfileCallFrame
selfSize: number
children: HeapProfileNode[]
id: number
parent?: number
totalSize: number
}
interface HeapProfile {
head: HeapProfileNode
}
const callFrameToFrameInfo = new Map<HeapProfileCallFrame, FrameInfo>()
function frameInfoForCallFrame(callFrame: HeapProfileCallFrame) {
return getOrInsert(callFrameToFrameInfo, callFrame, callFrame => {
const name = callFrame.functionName || '(anonymous)'
const file = callFrame.url
const line = callFrame.lineNumber
const col = callFrame.columnNumber
return {
key: `${name}:${file}:${line}:${col}`,
name,
file,
line,
col,
}
})
}
export function importFromChromeHeapProfile(chromeProfile: HeapProfile): Profile {
const nodeById = new Map<number, HeapProfileNode>()
let currentId = 0
const computeId = (node: HeapProfileNode, parent?: HeapProfileNode) => {
node.id = currentId++
nodeById.set(node.id, node)
if (parent) {
node.parent = parent.id
}
node.children.forEach(children => computeId(children, node))
}
computeId(chromeProfile.head)
// Compute the total size
const computeTotalSize = (node: HeapProfileNode): number => {
if (node.children.length === 0) return node.selfSize || 0
const totalChild = node.children.reduce((total: number, children) => {
total += computeTotalSize(children)
return total
}, node.selfSize)
node.totalSize = totalChild
return totalChild
}
const total = computeTotalSize(chromeProfile.head)
// Compute all stacks by taking each last node and going upward
const stacks: HeapProfileNode[][] = []
for (let currentNode of nodeById.values()) {
let stack: HeapProfileNode[] = []
stack.push(currentNode)
// While we found a parent
while (true) {
if (currentNode.parent === undefined) break
const parent = nodeById.get(currentNode.parent)
if (parent === undefined) break
// Push the parent at the beginning of the stack
stack.unshift(parent)
currentNode = parent
}
stacks.push(stack)
}
const profile = new StackListProfileBuilder(total)
for (let stack of stacks) {
const lastFrame = stack[stack.length - 1]
profile.appendSampleWithWeight(
stack.map(frame => frameInfoForCallFrame(frame.callFrame)),
lastFrame.selfSize,
)
}
profile.setValueFormatter(new ByteFormatter())
return profile.build()
}
+5 -4
View File
@@ -1,8 +1,8 @@
import * as fs from 'fs'
import * as path from 'path'
import {Profile, CallTreeNode, Frame} from './profile'
import {importProfileGroup} from '../import'
import {exportProfileGroup, importSpeedscopeProfiles} from './file-format'
import {importProfilesFromArrayBuffer} from '../import'
interface DumpedProfile {
name: string
@@ -47,9 +47,10 @@ export function dumpProfile(profile: Profile): any {
}
export async function checkProfileSnapshot(filepath: string) {
const input = fs.readFileSync(filepath, 'utf8')
const buffer = fs.readFileSync(filepath)
const arrayBuffer = buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)
const profileGroup = await importProfileGroup(path.basename(filepath), input)
const profileGroup = await importProfilesFromArrayBuffer(path.basename(filepath), arrayBuffer)
if (profileGroup) {
expect(profileGroup.name).toMatchSnapshot('profileGroup.name')
expect(profileGroup.indexToView).toMatchSnapshot('indexToView')
@@ -62,7 +63,7 @@ export async function checkProfileSnapshot(filepath: string) {
return
}
const profilesWithoutFilename = await importProfileGroup('unknown', input)
const profilesWithoutFilename = await importProfilesFromArrayBuffer('unknown', arrayBuffer)
if (profilesWithoutFilename) {
expect(profilesWithoutFilename.profiles.length).toEqual(profileGroup.profiles.length)
profilesWithoutFilename.name = profileGroup.name
+19
View File
@@ -13,8 +13,11 @@ import {
memoizeByReference,
memoizeByShallowEquality,
objectsHaveShallowEquality,
decodeBase64,
} from './utils'
import * as jsc from 'jsverify'
test('sortBy', () => {
const ls = ['a3', 'b2', 'c1', 'd4']
sortBy(ls, k => k.charCodeAt(1))
@@ -173,3 +176,19 @@ test('objectsHaveShallowEquality', () => {
expect(objectsHaveShallowEquality([1], [1, 2])).toBe(false)
expect(objectsHaveShallowEquality([1, 2], [1])).toBe(false)
})
test('decodeBase64', () => {
jsc.assertForall(jsc.array(jsc.uint8), byteArray => {
let binaryString = ''
for (let byte of byteArray) {
binaryString += String.fromCharCode(byte)
}
const b64string = btoa(binaryString)
const decoded = decodeBase64(b64string)
expect(Uint8Array.from(byteArray)).toEqual(decoded)
// If the above expect(...) assertion fails, we won't reach here.
return true
})
})
+128
View File
@@ -167,3 +167,131 @@ export function memoizeByReference<T, U>(cb: (t: T) => U): (t: T) => U {
}
}
}
export function lazyStatic<T>(cb: () => T): () => T {
let last: {result: T} | null = null
return () => {
if (last == null) {
last = {result: cb()}
}
return last.result
}
}
const base64lookupTable = lazyStatic((): Map<string, number> => {
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
const ret = new Map<string, number>()
for (let i = 0; i < alphabet.length; i++) {
ret.set(alphabet.charAt(i), i)
}
ret.set('=', -1)
return ret
})
// NOTE: There are probably simpler solutions to this problem, but I have this written already, so
// until we run into problems with this, let's just use this.
//
// See: https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem#The_Unicode_Problem
export function decodeBase64(encoded: string): Uint8Array {
// Reference: https://www.rfc-editor.org/rfc/rfc4648.txt
const lookupTable = base64lookupTable()
// 3 byte groups are represented as sequneces of 4 characters.
//
// "The encoding process represents 24-bit groups of input bits as output
// strings of 4 encoded characters."
//
// "Special processing is performed if fewer than 24 bits are available
// at the end of the data being encoded. A full encoding quantum is
// always completed at the end of a quantity. When fewer than 24 input
// bits are available in an input group bits with value zero are added
// (on the right) to form an integral number of 6-bit groups."
if (encoded.length % 4 !== 0) {
throw new Error(
`Invalid length for base64 encoded string. Expected length % 4 = 0, got length = ${
encoded.length
}`,
)
}
const quartetCount = encoded.length / 4
let byteCount: number
// Special processing is performed if fewer than 24 bits are available
// at the end of the data being encoded. A full encoding quantum is
// always completed at the end of a quantity. When fewer than 24 input
// bits are available in an input group, bits with value zero are added
// (on the right) to form an integral number of 6-bit groups. Padding
// at the end of the data is performed using the '=' character. Since
// all base 64 input is an integral number of octets, only the following
// cases can arise:
//
// (1) The final quantum of encoding input is an integral multiple of 24
// bits; here, the final unit of encoded output will be an integral
// multiple of 4 characters with no "=" padding.
//
// (2) The final quantum of encoding input is exactly 8 bits; here, the
// final unit of encoded output will be two characters followed by
// two "=" padding characters.
//
// (3) The final quantum of encoding input is exactly 16 bits; here, the
// final unit of encoded output will be three characters followed by
// one "=" padding character.
if (encoded.length >= 4) {
if (encoded.charAt(encoded.length - 1) === '=') {
if (encoded.charAt(encoded.length - 2) === '=') {
// Case (2)
byteCount = quartetCount * 3 - 2
} else {
// Case (3)
byteCount = quartetCount * 3 - 1
}
} else {
// Case (1)
byteCount = quartetCount * 3
}
} else {
// Case (1)
byteCount = quartetCount * 3
}
const bytes = new Uint8Array(byteCount)
let offset = 0
for (let i = 0; i < quartetCount; i++) {
const enc1 = encoded.charAt(i * 4 + 0)
const enc2 = encoded.charAt(i * 4 + 1)
const enc3 = encoded.charAt(i * 4 + 2)
const enc4 = encoded.charAt(i * 4 + 3)
const sextet1 = lookupTable.get(enc1)
const sextet2 = lookupTable.get(enc2)
const sextet3 = lookupTable.get(enc3)
const sextet4 = lookupTable.get(enc4)
if (sextet1 == null || sextet2 == null || sextet3 == null || sextet4 == null) {
throw new Error(
`Invalid quartet at indices ${i * 4} .. ${i * 4 + 3}: ${encoded.substring(
i * 4,
i * 4 + 3,
)}`,
)
}
bytes[offset++] = (sextet1 << 2) | (sextet2 >> 4)
if (enc3 !== '=') {
bytes[offset++] = ((sextet2 & 15) << 4) | (sextet3 >> 2)
}
if (enc4 !== '=') {
bytes[offset++] = ((sextet3 & 7) << 6) | sextet4
}
}
if (offset !== byteCount) {
throw new Error(`Expected to decode ${byteCount} bytes, but only decoded ${offset})`)
}
return bytes
}
+43 -19
View File
@@ -18,8 +18,30 @@ import {Graphics} from '../gl/graphics'
const importModule = import('../import')
// Force eager loading of the module
importModule.then(() => {})
async function importProfiles(fileName: string, contents: string): Promise<ProfileGroup | null> {
return (await importModule).importProfileGroup(fileName, contents)
async function importProfilesFromText(
fileName: string,
contents: string,
): Promise<ProfileGroup | null> {
return (await importModule).importProfileGroupFromText(fileName, contents)
}
async function importProfilesFromBase64(
fileName: string,
contents: string,
): Promise<ProfileGroup | null> {
return (await importModule).importProfileGroupFromBase64(fileName, contents)
}
async function importProfilesFromArrayBuffer(
fileName: string,
contents: ArrayBuffer,
): Promise<ProfileGroup | null> {
return (await importModule).importProfilesFromArrayBuffer(fileName, contents)
}
async function importProfilesFromFile(file: File): Promise<ProfileGroup | null> {
return (await importModule).importProfilesFromFile(file)
}
async function importFromFileSystemDirectoryEntry(entry: FileSystemDirectoryEntry) {
return (await importModule).importFromFileSystemDirectoryEntry(entry)
@@ -320,16 +342,7 @@ export class Application extends StatelessComponent<ApplicationProps> {
loadFromFile(file: File) {
this.loadProfile(async () => {
const reader = new FileReader()
const loadPromise = new Promise(resolve => reader.addEventListener('loadend', resolve))
reader.readAsText(file)
await loadPromise
if (typeof reader.result !== 'string') {
throw new Error('Expected ArrayBuffer')
}
const profiles = await importProfiles(file.name, reader.result)
const profiles = await importProfilesFromFile(file)
if (profiles) {
for (let profile of profiles.profiles) {
if (!profile.getName()) {
@@ -344,7 +357,19 @@ export class Application extends StatelessComponent<ApplicationProps> {
// a symbol map. If that's the case, we want to parse it, and apply the symbol
// mapping to the already loaded profile. This can be use to take an opaque
// profile and make it readable.
const map = importEmscriptenSymbolMap(reader.result)
const reader = new FileReader()
const fileContentsPromise = new Promise<string>(resolve => {
reader.addEventListener('loadend', () => {
if (typeof reader.result !== 'string') {
throw new Error('Expected reader.result to be a string')
}
resolve(reader.result)
})
})
reader.readAsText(file)
const fileContents = await fileContentsPromise
const map = importEmscriptenSymbolMap(fileContents)
if (map) {
const {profile, index} = this.props.activeProfileState
console.log('Importing as emscripten symbol map')
@@ -365,7 +390,7 @@ export class Application extends StatelessComponent<ApplicationProps> {
this.loadProfile(async () => {
const filename = 'perf-vertx-stacks-01-collapsed-all.txt'
const data = await fetch(exampleProfileURL).then(resp => resp.text())
return await importProfiles(filename, data)
return await importProfilesFromText(filename, data)
})
}
@@ -463,7 +488,7 @@ export class Application extends StatelessComponent<ApplicationProps> {
const pasted = (ev as ClipboardEvent).clipboardData.getData('text')
this.loadProfile(async () => {
return await importProfiles('From Clipboard', pasted)
return await importProfilesFromText('From Clipboard', pasted)
})
}
@@ -489,12 +514,12 @@ export class Application extends StatelessComponent<ApplicationProps> {
return
}
this.loadProfile(async () => {
const response = await fetch(this.props.hashParams.profileURL!)
const response: Response = await fetch(this.props.hashParams.profileURL!)
let filename = new URL(this.props.hashParams.profileURL!).pathname
if (filename.includes('/')) {
filename = filename.slice(filename.lastIndexOf('/') + 1)
}
return await importProfiles(filename, await response.text())
return await importProfilesFromArrayBuffer(filename, await response.arrayBuffer())
})
} else if (this.props.hashParams.localProfilePath) {
// There isn't good cross-browser support for XHR of local files, even from
@@ -502,8 +527,7 @@ export class Application extends StatelessComponent<ApplicationProps> {
// as a JavaScript file which will invoke a global function.
;(window as any)['speedscope'] = {
loadFileFromBase64: (filename: string, base64source: string) => {
const source = atob(base64source)
this.loadProfile(() => importProfiles(filename, source))
this.loadProfile(() => importProfilesFromBase64(filename, base64source))
},
}
+9 -4
View File
@@ -660,15 +660,20 @@ export class FlamechartPanZoomView extends Component<FlamechartPanZoomViewProps,
if (ev.ctrlKey || ev.shiftKey || ev.metaKey) return
// NOTE: We intentionally use ev.code rather than ev.key for
// WASD in order to have the keys retain the same layout even
// if the keyboard layout is not QWERTY.
//
// See: https://github.com/jlfwong/speedscope/pull/184
if (ev.key === '0') {
this.zoom(new Vec2(width / 2, height / 2), 1e9)
} else if (ev.key === 'ArrowRight' || ev.key === 'd') {
} else if (ev.key === 'ArrowRight' || ev.code === 'KeyD') {
this.pan(new Vec2(100, 0))
} else if (ev.key === 'ArrowLeft' || ev.key === 'a') {
} else if (ev.key === 'ArrowLeft' || ev.code === 'KeyA') {
this.pan(new Vec2(-100, 0))
} else if (ev.key === 'ArrowUp' || ev.key === 'w') {
} else if (ev.key === 'ArrowUp' || ev.code === 'KeyW') {
this.pan(new Vec2(0, -100))
} else if (ev.key === 'ArrowDown' || ev.key === 's') {
} else if (ev.key === 'ArrowDown' || ev.code === 'KeyS') {
this.pan(new Vec2(0, 100))
} else if (ev.key === 'Escape') {
this.props.onNodeSelect(null)