GithubHelp home page GithubHelp logo

gavinbeatty / spall-web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from colrdavidson/spall-web

0.0 0.0 0.0 4.01 MB

Simple, Fast, Portable Profiling

Home Page: https://gravitymoth.com/spall

License: MIT License

Shell 0.12% JavaScript 14.07% Python 1.09% C 9.29% HTML 1.32% Odin 74.11%

spall-web's Introduction

spall

spall is a profiler library and a web-frontend for exploring your code and digging into potential performance problems.

spall use

^ this is a 180 MB (526 MB JSON equivalent), 5 minute trace from Happenlance, courtesy of @pmttavara!

Features

  • Zippy! spall can load 500 MB of .spall data into your browser in a second or two, and you can scroll and pan it at a glorious 165+ FPS
  • Easy to Use! Single-header C library for instrumenting your code
  • Numbers Galore! spall can collect a handful of very useful stats about your program without even breaking a sweat
  • Light/Dark Modes! You can blow your eyes out in light mode, relish the sweet neon colors in dark mode, or auto-switch with your system
  • Velociraptors Included! Uhh, wait, sorry, we're all out. No velociraptors here. You can pretend though.

Try it over at Gravity Moth

Usage

spall includes a small single-header C library, spall.h.

spall currently supports 2 different file formats:

  • .json, in Google's trace format used by perfetto, chrome://tracing, and speedscope, described below
  • .spall, our custom binary format

You can either instrument your code with our header, or use your existing chrome://tracing compatible JSON dumping code.

Heads Up!

If you're starting from scratch, you probably want to use the spall header to generate events. The binary format has much lower profiling overhead (so your traces should be more accurate), and ingests around 10x faster than the JSON format.

JSON Trace Format Overview

If you want to use JSON, spall expects events following Google's JSON trace format They look like this:

[
	{"cat":"function", "name":"main", "ph": "X", "pid": 0, "tid": 0, "ts": 0, "dur": 1},
	{"cat":"function", "name":"myfunction", "ph": "B", "pid": 0, "tid": 0, "ts": 0},
	{"cat":"function", "ph": "E", "pid": 0, "tid": 0, "ts": 0}
]

(spall doesn't care about trailing commas and close brackets are not required, to ease file creation / event streaming)

Field Types

cat - Category of event. Currently unused

name - the name of the event, a string

ph - The type of event

Type Symbol
Begin "B"
End "E"
Complete "X"

tid - thread id, u32 pid - process id, u32

All tids and pids must be between 0 and u32_MAX, as whole values

ts - timestamp, a double, in microseconds dur - timestamp, a double, in microseconds

(A timestamp of 1 starts at 1 μs)

Event Types

Spall currently supports only Begin, End, and Complete events

Complete

{"cat":"function", "name":"foo", "ph": "X", "pid": 0, "tid": 0, "ts": 0, "dur": 1},

Complete events require a duration field, because they track a function's start/end all in one

Begin

{"cat":"function", "name":"myfunction", "ph": "B", "pid": 0, "tid": 0, "ts": 0},

End

{"cat":"function", "ph": "E", "pid": 0, "tid": 0, "ts": 0},

End events automatically close the most recent begin event with the same pid and tid, so they don't need names

Important Notes

Regardless of ingest format, all begin and end events within a process/thread (pid/tid) are expected to be in earliest timestamp first, sorted order ex:

[
	{"cat":"function", "name":"main", "ph": "B", "pid": 0, "tid": 0, "ts": 0},
	{"cat":"function", "name":"foo", "ph": "B", "pid": 0, "tid": 0, "ts": 1},
	{"cat":"function", "ph": "E", "pid": 0, "tid": 0, "ts": 2},
	{"cat":"function", "ph": "E", "pid": 0, "tid": 0, "ts": 3}
]

spall-web's People

Contributors

colrdavidson avatar jack-punter avatar kelimion avatar pmttavara avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.