442 Commits

Author SHA1 Message Date
Jamie Wong
aa9bef5078 1.23.0
Some checks failed
Node.js CI / test (18.x) (push) Has been cancelled
Node.js CI / test (20.x) (push) Has been cancelled
Node.js CI / finish (push) Has been cancelled
v1.23.0
2025-07-06 20:04:25 -07:00
Ryan Moeller
31974da6e3 Add support for FreeBSD's pmcstat callgraph format (#502)
* Let tests run without bash

* Import pmcstat callgraph format

This eliminates the need for stackcollapse-pmc.pl and its dependency on
Perl to import FreeBSD callgraphs.  Tracing can be done completely with
tools included in the base system.  For example:

  ```
  # kldload hwpmc
  # pmcstat -S instructions -O sample.out sleep 1
  # pmcstat -R sample.out -G sample.pmcstat.graph
  ```
2025-03-18 10:08:10 -07:00
Jamie Wong
1c254dcb3e 1.22.2 v1.22.2 2025-02-15 13:02:35 -08:00
Jamie Wong
b17f7eeee8 1.22.1 v1.22.1 2025-02-15 12:55:08 -08:00
Philipp A.
0e153f0a2c Update to working open, switch to ESM (#499) 2025-02-15 12:49:27 -08:00
Jamie Wong
e3d57d5bb5 Revert "Fix broken CLI dependency open (#498)"
This reverts commit 60daa0e321.
2025-02-12 22:09:00 -08:00
Philipp A.
60daa0e321 Fix broken CLI dependency open (#498) 2025-02-12 13:13:25 -08:00
Daniel Kukula
c5b01beec3 Update README.md (#496) 2025-01-23 12:27:16 -08:00
Jamie Wong
bd7b44a0a7 1.22.0 v1.22.0 2025-01-16 16:47:42 -08:00
Jamie Wong
f181283861 Add an example trace with rust mangling 2025-01-16 16:47:11 -08:00
Corentin Kerisit
dd989ea51c Add support for Rust v0 symbol mangling scheme (#491) 2025-01-16 11:46:58 -08:00
Jamie Wong
c04a148518 1.21.2 v1.21.2 2025-01-15 14:56:25 -08:00
Jamie Wong
103e441e27 Switch from parcel to esbuild (#432) 2025-01-15 14:47:40 -08:00
Jamie Wong
911feb609b Revert "Upgrade to parcel 2.13.3 (#492)"
This reverts commit c7be11d4e0.
2025-01-14 16:15:16 -08:00
Jamie Wong
c7be11d4e0 Upgrade to parcel 2.13.3 (#492) 2025-01-13 23:32:29 -08:00
Jamie Wong
146477a850 Add link to async-profiler wiki page to README 2024-11-21 11:07:46 -08:00
Jamie Wong
d36c3a5442 1.21.0 v1.21.0 2024-11-16 22:13:13 -08:00
Robert Kruszewski
e468c60229 Add support for Instruments 16 Time Profile Deep Copy (#484)
* Add support for Instruments 16 time profiles

* rename

* prettier
2024-11-16 22:06:50 -08:00
Tom Levy
d69f3d0eec Fix bug where import after error continues failing (#463)
Steps to reproduce:
1. Open https://www.speedscope.app/
2. Try to import an invalid file such as [invalid.json](https://github.com/jlfwong/speedscope/files/14167326/invalid.json). The page says "Something went wrong. Check the JS console for more details."
3. Now try to import a valid file such as [simple.json](https://github.com/jlfwong/speedscope/files/14167335/simple.json). The page says "Something went wrong. Check the JS console for more details." even though this second file is valid.

Explanation of the fix (copied from the commit message):
> We need to clear the error flag, otherwise once there is an error and we display "Something went wrong" we will keep displaying that forever even when the user imports a valid file.
2024-04-15 11:50:13 -07:00
Timo Tijhof
25f671e9d8 Bundle the font (#472)
For performance, offline support and privacy.

Continues from https://github.com/jlfwong/speedscope/pull/412
2024-04-15 11:45:12 -07:00
Tom Levy
0121cf9342 Clarify specification of startValue in speedscope file format (#464)
The previous description ("event values will be relative to this
startValue") was ambiguous.

Suppose the profile starts at wall time 1000ms and the first event is
at wall time 1003ms.

The intention is that startValue should be set to 1000 and the "at"
value of the event should be set to 1003. The viewer's time axis will
start at 0ms and the first event will be displayed at 3ms.

But the previous description could be incorrectly interpreted as
saying that the "at" value of the first event should be set to 3 (the
time relative to startValue, as opposed to the absolute wall time).

Clarify that "relative" is referring to how the viewer displays the
data, not about which values to store in the file.
2024-02-05 10:58:18 -08:00
Jamie Wong
68fd88ceaf 1.20.0 v1.20.0 2024-01-12 09:57:30 -08:00
Zachary Marion
a6d700194f Partition based on samples instead of traceEvents when importing a sample-based chrome trace (#460)
In the existing code, if `traceEvents` did not have any importable events, the profile would be marked as empty. This was a bug, as the dev Hermes profiles I was testing with had one X event which made the code work. However we do not need to guarantee (and the spec doesn't seem to) any traceEvents being present as long as we have samples and stack frames. 

When I tested a production profile taken from Hermes it did not have any importable events, just a metadata event with a thread name. This PR updates the implementation to iterate over partitioned samples instead of traceEvents so we construct profiles for all thread + process pairs referenced in the samples array.

| Before | After |
| --- | ----- |
| <img width="1454" alt="Screenshot 2024-01-03 at 9 58 56 AM" src="https://github.com/jlfwong/speedscope/assets/9957046/78c098a7-b374-4492-ad13-9ca79afdb40c"> | <img width="1450" alt="Screenshot 2024-01-03 at 9 58 17 AM" src="https://github.com/jlfwong/speedscope/assets/9957046/d2d5e82b-fa3e-43db-bf8a-e8c3b84cd13a"> |
2024-01-03 16:04:22 -05:00
Jamie Wong
a3c0b15935 1.19.0 v1.19.0 2023-12-27 23:57:14 -05:00
Zachary Marion
e9a17d5d14 Improve hermes profile frame keys to better group frames (#459)
Because all args are serialized in the key for hermes profiles, frames were not properly getting grouped since the "parent" property was different. This PR ensures that the frame key is properly constructed from the function name, file name, line + column number.

| Before | After |
| ----- | ----- |
| <img width="1727" alt="Screenshot 2023-12-27 at 2 25 32 PM" src="https://github.com/jlfwong/speedscope/assets/9957046/4ec04653-5a80-4f34-9506-48e0eb415983"> | <img width="1728" alt="Screenshot 2023-12-27 at 2 26 02 PM" src="https://github.com/jlfwong/speedscope/assets/9957046/c3edc447-e8ad-4757-8576-cbb8c27eafe3"> |
| <img width="1720" alt="Screenshot 2023-12-27 at 2 13 37 PM" src="https://github.com/jlfwong/speedscope/assets/9957046/10194aba-8f26-48ca-bf15-06917b44ea99"> | <img width="1728" alt="Screenshot 2023-12-27 at 2 14 20 PM" src="https://github.com/jlfwong/speedscope/assets/9957046/75c32401-1705-4b23-b71a-5f0a720160dd"> |
2023-12-27 23:56:27 -05:00
Jamie Wong
3f3da22853 Update README.md
- Add link to Hermes import instructions
- Re-order import sources higher in the list
- Update first line
2023-12-27 10:48:07 -05:00
Jamie Wong
bea0ef6913 1.18.0 v1.18.0 2023-12-26 17:12:59 -05:00
Zachary Marion
4feb1e564d Add hermes-specific support for the trace event format (#458)
Profiles that are transformed into the hermes trace event format are guaranteed to have specific arguments that supply metadata that is useful for debugging - namely the filename, line + col number that the function call originated from, with sourcemaps applied. This PR adds specific support for this information to the trace event importer. This means that we can have the Frame name be just the name of the function, since we know all the information we want to be displayed in the UI is captured in the frame info, which makes the traces cleaner to look at.

| Before | After |
|-----|-----|
| <img width="1728" alt="Screenshot 2023-12-26 at 2 40 01 PM" src="https://github.com/jlfwong/speedscope/assets/9957046/f9dff608-5df3-4098-b1f8-91a69185d906"> | <img width="1726" alt="Screenshot 2023-12-26 at 2 39 13 PM" src="https://github.com/jlfwong/speedscope/assets/9957046/b8ff360e-a316-4bef-8ebc-620c9ff1a998"> |
| <img width="1728" alt="Screenshot 2023-12-26 at 2 41 03 PM" src="https://github.com/jlfwong/speedscope/assets/9957046/127a49b5-458e-4ac8-934a-202e565cb20f"> | <img width="1728" alt="Screenshot 2023-12-26 at 2 41 29 PM" src="https://github.com/jlfwong/speedscope/assets/9957046/ebb285ce-6b33-4535-8e45-b9ada4e4d97f"> |
2023-12-26 17:00:18 -05:00
Jamie Wong
88f4fe6105 Update README-ADMINS.md with npm login instructions (#457) 2023-12-25 22:52:46 -05:00
Jamie Wong
60f1812e51 1.17.0 v1.17.0 2023-12-25 22:40:40 -05:00
Jamie Wong
1717fecafb Upgrade prettier, update prettier & react-hooks eslint plugins (#456)
Re-ran prettier with latest version
2023-12-25 22:37:45 -05:00
Jamie Wong
c296f530c7 Upgrade typescript & eslint to latest, fix resulting errors (#455)
Also updated the ci.yml node test versions to 18.x and 20.x, given current support: https://endoflife.date/nodejs
2023-12-25 22:23:33 -05:00
Jamie Wong
8e0fa58d65 Re-enable eslint prettier rule after being accidentally disabled for 3 years (#454)
It looks like in #267 (which was 3 years ago!), I accidentally disabled prettier linting altogether 😱

https://github.com/jlfwong/speedscope/pull/267/files#diff-e2954b558f2aa82baff0e30964490d12942e0e251c1aa56c3294de6ec67b7cf5

There's no comment in that PR about this being an intentional thing, so I have to assume this was a dumb mistake.
2023-12-25 21:22:56 -05:00
Zachary Marion
b21480494e Support the chrome JSON trace format (allows viewing of hermes traces) (#453) 2023-12-25 21:11:45 -05:00
Zachary Marion
dfd3a0dfb3 Fix bug in selectQueueToTakeFromNext for trace profiles (#450)
I have been taking a lot of profiles using the Hermes profiler, but I noticed that they sometimes to not show up properly. After debugging what exactly was going on, I realized it was because the logic in `selectQueueToTakeFromNext` only checks for name, instead of the key for the event. I had a bunch of events with the name `anonymous` that were getting improperly exited before they should have been due to this logic. 

This fix makes the code more robust if there are added "args" which differentiate an event from another (as is the case in Hermes profiles), however it would still be an issue if they key just defaults to the name.

Example profile before:

<img width="1728" alt="Screenshot 2023-12-15 at 12 54 04 AM" src="https://github.com/jlfwong/speedscope/assets/9957046/345f556e-f944-40f1-b59c-748133acb950">

What it should look like (in Perfetto):
<img width="1051" alt="Screenshot 2023-12-15 at 8 51 38 AM" src="https://github.com/jlfwong/speedscope/assets/9957046/7473cdf8-95f1-49de-a0c7-ef4ac081ff85">

After the fix:

<img width="1728" alt="Screenshot 2023-12-15 at 12 54 29 AM" src="https://github.com/jlfwong/speedscope/assets/9957046/56b0870a-538b-4916-acc8-de2b7dfd78eb">
2023-12-16 00:27:03 -08:00
Jamie Wong
ac4a015559 Add bounds checking for sampleTypeIndex (#449)
Wow this was surprising. As reported in #448, the `simple.speedscope.json` file failed import. This was surprising to me because there's a test that covers that file to ensure it imports correctly.

The file provided in #448, however, is from a version of speedscope from 5 years ago before the file had been pretty printed. It turns out that when this *particular* file is not pretty-printed, it's a schematically valid pprof profile.

The fix is to do some bounds checks and return null. After the change, the file imports as you'd expect after realizing its not actually a valid pprof profile.

Fixes #448
2023-12-07 18:43:47 -08:00
byronhe
de17f128d0 Update README-zh_CN.md (#442)
fix url
2023-09-04 09:54:35 -07:00
Jamie Wong
304ccf33ab Update publish-and-deploy to remove automated release creation (#440)
Turns out the `--attach` command was hallucinated by GPT!
2023-07-16 15:31:31 -07:00
Jamie Wong
650e505b55 1.16.0 v1.16.0 2023-07-16 03:04:29 -07:00
Jamie Wong
8dad28e5e2 Automate more of the release process (#439)
The publish, deploy, and release process is annoying enough at the moment that I avoid doing it frequently. Let's automate most of it to reduce the friction
list
2023-07-16 03:01:50 -07:00
Nguyễn Văn Đức
f62519ab69 Improve profile builder performance (#437)
Follow up on this PR #435. 

Currently, it took roughly 22 seconds to load my 1.3GB file. After inspecting the profiler, there's a large chunk of time spending in Frame.getOrInsert. I figure we can reduce the number of invocations by half. It reduces the load time to roughly 18 seconds.I also tested with a smaller file (~350MB), and it show similar gains, about 15-20%
2023-06-28 22:11:12 -07:00
Nguyễn Văn Đức
984bf1296a Fix crash when importing big linux perf tool files (#435)
Currently, importing files generated by linux perf tool whose some blocks exceed V8 strings limit can crash the application. This issue is similar to the one in #385.

This PR fixes it by changing parseEvents to work directly with lines instead of chunking lines into blocks first.

Fixes #433
2023-06-28 01:30:08 -07:00
Nguyễn Văn Đức
26884c116c Improve splitLines: return iterator instead (#434)
The current behavior of splitLines is to eagerly split all the lines and return an array of strings.

This PR improves this by returning an iterator instead, which will emit lines. This lets callers decide how to best use the splitLines function (i.e. lazily enumerate over lines)

Relates to #433
2023-06-27 23:27:15 -07:00
Jamie Wong
bb063e49e3 Fix trimTextMid (#431)
There was a subtle bug in `trimTextMid` caused by calling substring methods with non-integer values. This happens because `findValueBisect` returns non-integer values, and there was no special handling of this.

The bug results in strings cutting off many of the last few characters in a string, rather than always displaying it when possible.

Before:
<img width="368" alt="image" src="https://github.com/jlfwong/speedscope/assets/150329/754a25f1-a6f7-46f1-8e34-059503d9e4cf">

After:
<img width="386" alt="image" src="https://github.com/jlfwong/speedscope/assets/150329/b2688ca1-54af-4d2e-b704-9f3322d2e5b4">

Fixes #411
2023-06-23 13:22:53 -07:00
xieve
693545b77a Added support for Papyrus profiles (#428)
Fixed #427
2023-06-23 13:02:08 -07:00
Jamie Wong
b3b4b1492a 1.15.2 v1.15.2 2023-06-21 17:28:24 -07:00
Jamie Wong
9cdceede15 Support showing pprof lines from the pprof Line object (take 2) (#430)
The previous behavior was to use the StartLine of a function as the line number to show in speedscope. However, the Line object has more precise line information, and we should only fallback to StartLine if we don't have this more detailed information.

Looking at the [documentation for the pprof proto](https://github.com/google/pprof/tree/main/proto#general-structure-of-a-profile), this is more how it intends to interpret line information:

> location: A unique place in the program, commonly mapped to a single instruction address. It has a unique nonzero id, to be referenced from the samples. It contains source information in the form of lines, and a mapping id that points to a binary.
> function: A program function as defined in the program source. It has a unique nonzero id, referenced from the location lines. It contains a human-readable name for the function (eg a C++ demangled name), a system name (eg a C++ mangled name), the name of the corresponding source file, and other function attributes.

Here is a sample profile that had line-level info on the Line object of the profile:

Before:

<img width="449" alt="Screen Shot 2022-11-03 at 11 17 11 AM" src="https://user-images.githubusercontent.com/618615/199760730-712daa70-6cfb-4e90-b037-b571809c26d9.png">

After:

<img width="449" alt="Screen Shot 2022-11-03 at 11 17 22 AM" src="https://user-images.githubusercontent.com/618615/199760777-1c0d5581-7b29-42b7-b642-6035f7d25405.png">
2023-06-21 15:25:16 -07:00
Manuel Correa
741fdeb427 Stackprof: weight on-cpu samples by period rather than timestamp delta (#425)
This attempts to improve the quality of the on-CPU profiles stackprof provides. Rather than weighing samples by their timestamp deltas, which, in our opinion, are only valid in wall-clock mode, this weighs callchains by:


```
S = number of samples
P = sample period in nanoseconds

W = S * P
```

The difference after this change is quite substantial, specially in profiles that previously were showing up with heavy IO frames:  

* Total profile weight is almost down by 90%, which actually makes sense for an on-CPU profile if the app is relatively idle
* Certain callchains that blocked in syscalls / IO are now much lower weight. This was what I was expecting to find.
Here is an example of the latter point.

In delta mode, we see an io select taking a long time, it is a significant portion of the profile:

<img width="1100" alt="236936508-709bee01-d616-4246-ba74-ab004331dcd3" src="https://github.com/dalehamel/speedscope/assets/4398256/39140f1e-50a9-4f33-8a61-ec98b6273fd4">

But in period scaling mode, it is only a couple of sample periods ultimately:

<img width="206" alt="236936693-9d44304e-a1c2-4906-b3c8-50e19e6f9f27" src="https://github.com/dalehamel/speedscope/assets/4398256/7d19077f-ef25-4d79-980b-cfa1775d928d">
2023-06-17 20:50:19 -07:00
Jake Zimmerman
e9133be353 Use frame.name?.startsWith for stackprof (#419)
Sometimes, stackprof frames don't get generated with a `name` in the frame.
I think it's probably worth tracking down why that is, but in the mean
time, speedscope simply crashes with a method call on `undefined`. The
crash is bad because it only shows up in the console--there's no visible
message saying that speedscope failed to parse and load a profile.

For more information, see #378

This fixes the crash by simply skipping the logic in demangle if the name
field isn't present on a frame. That's probably a fine tradeoff? Because in
this case, stackprof is generating ruby frames, which means that C++ name
demangling won't apply.

I have tested this by running the scripts/prepare-test-installation.sh
script and verifying that `bin/cli.js` can now successfully load the
included profile. Before these changes, I verified that speedscope failed
with the behavior mentioned in #378.

I've also included a snapshot test case, but it seems that the Jest test
harness only tests the parsing, not the rendering (correct me if I'm wrong).
So I haven't actually been able to create an automated test that would catch
a regression. Please let me know if there's a better way to have written this
test.

I've staged the commits on this branch so that the second commit (dcb9840)
showcases the minimal diff to a stackprof file that reproduces the bug. That is,
rather than look at the thousands of new lines in the stackprof profile, you can
view the second commit to see the salient part of the file.
2023-06-15 01:30:53 -07:00
Dave Vasilevsky
fcc1fa5689 fix pprof defaultSampleType (#424)
Fixes #415

* Interprets pprof's defaultSampleType as an index into the string table [as documented in the proto](0414c2f617/src/import/profile.proto (L85)), not as an index into the sample types repeated-field. This allows parsing to succeed when the string-table index is not a valid sampleTypes index, which is common on allocation profiles.
* Update the pprof snapshot. This is necessarily because we were previously interpreting an empty defaultSampleType as truthy-but-zero when long.js is present, ie: the first sample-type. But Speedscope-in-the-browser doesn't seem to include long.js, so our tests were disagreeing with in-browser behavior. With this PR, that should be fixed.
2023-06-15 01:14:47 -07:00