Show HN: Timep – a next-gen profiler and flamegraph-generator for bash code
Show HN (score: 7)Description
Unlike other profilers, timep also recovers and hierarchally records metadata on subshell and function nesting, allowing it to recreate the full call-stack tree for the bash code being profiled. If you call timep with the `--flame` flag, it will automatically generate a flamegraph .svg image where each block represents the wall-clock time spent on a particular command (top level) or its parent subshells/functions (all the other levels).
Using timep is simple - just source the timep.bash file then add timep before whatever you want to profile. You do not need to change in the code being profiled - timep handles everything for you. Example usage:
. ./timep.bash
timep someFunc
timep -flame someScript <inputFile
timep will generate 2 profiles for you: one showing each individual command (with full subshell/function nesting chains), and one that combines repeated loops commands into a count + total runtime line with minimal "extra" metadata.See the github README for more info on the available flags and output profile specifics.
timep works by cramming all the timing instrumentation logic into a DEBUG trap that roughly does the following:
1. record end timestamp for previous command 2. compare current state to state saved in variables last DEBUG trap to determine what sort of command is happening. e.g., if BASH_SUBSHELL increased then we know we just entered a subshell or background fork. 3. once we know what type of command is happening, generate a log line for the previous command (now that we have its end time 4. save current state in various variables (for use next debug trap) 5. record start time for the next command
then after the profiled code is done running, timep post-processes the logs to produce the final profile
More from Show
Show HN: Mist – a lightweight, self-hosted PaaS
Show HN: Mist – a lightweight, self-hosted PaaS Hi HN,<p>We’re building Mist, a lightweight, self-hosted PaaS for running and managing applications on your own servers.<p>We started Mist because we wanted a middle ground between raw VPS management and heavy, all-in-one platforms. Existing PaaS solutions often felt too complex or resource-intensive for small servers, homelabs, and side projects. We wanted something that keeps the PaaS experience but stays simple and predictable.<p>Our goals with Mist are: - A simple PaaS to deploy and manage apps on your own infrastructure - HTTPS, routing, and app access handled automatically - Low resource usage so it runs well on small VPSes - Self-hosted and transparent, with minimal magic<p>Mist focuses on being an opinionated but lightweight layer on top of your server. It doesn’t try to hide everything behind abstractions, but it does aim to remove the repetitive operational work that comes with managing apps by hand.<p>Mist is still early, and this is where we really need help. We’re actively looking for:<p>- Users who want a simple self-hosted PaaS and can share real-world feedback<p>- Contributors who want to help shape the core features, architecture, and UX<p>Website: <a href="https://trymist.cloud" rel="nofollow">https://trymist.cloud</a><p>Repo: <a href="https://github.com/corecollectives/mist" rel="nofollow">https://github.com/corecollectives/mist</a>
Show HN: Marten – Elegant Go web framework (nothing in the way)
Show HN: Marten – Elegant Go web framework (nothing in the way)
Show HN: I vibecoded an ARM64 operating system that boots on real hardware
Show HN: I vibecoded an ARM64 operating system that boots on real hardware VibeOS is a retro operating system that boots on qemu and Pi Zero 2W. I built this with Claude code in about 4 weeks.
Show HN: Seapie – a Python debugger where breakpoints drop into a REPL
Show HN: Seapie – a Python debugger where breakpoints drop into a REPL
No other tools from this source yet.