{"id":28446641,"url":"https://github.com/parttimenerd/tiny-profiler","last_synced_at":"2025-10-08T10:51:07.879Z","repository":{"id":148759721,"uuid":"619117979","full_name":"parttimenerd/tiny-profiler","owner":"parttimenerd","description":"A tiny CPU profiler for Java written completely in Java 17.","archived":false,"fork":false,"pushed_at":"2023-11-27T08:40:49.000Z","size":947,"stargazers_count":92,"open_issues_count":0,"forks_count":19,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-30T01:38:01.353Z","etag":null,"topics":["java","profiler"],"latest_commit_sha":null,"homepage":"https://mostlynerdless.de/blog/2023/03/27/writing-a-profiler-in-240-lines-of-pure-java/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parttimenerd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-26T10:23:12.000Z","updated_at":"2025-06-25T23:08:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7324f28-33c1-4aae-8486-99e30a207c5d","html_url":"https://github.com/parttimenerd/tiny-profiler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/parttimenerd/tiny-profiler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parttimenerd%2Ftiny-profiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parttimenerd%2Ftiny-profiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parttimenerd%2Ftiny-profiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parttimenerd%2Ftiny-profiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parttimenerd","download_url":"https://codeload.github.com/parttimenerd/tiny-profiler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parttimenerd%2Ftiny-profiler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278931653,"owners_count":26070788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","profiler"],"created_at":"2025-06-06T11:07:36.945Z","updated_at":"2025-10-08T10:51:07.872Z","avatar_url":"https://github.com/parttimenerd.png","language":"Java","readme":"Tiny Profiler\n=============\n\nA tiny CPU profiler for Java written completely in Java 17.\n\nThis is an educational sampling profiler that helps demystify profilers, but is not limited to it.\n \nThis profiler is a sampling profiler with can output method tables and \nflame graphs (via [d3-flame-graph](https://github.com/spiermar/d3-flame-graph)).\nThe sampling is based on the `Thread.getAllStackTraces()` method, making it simple but also safepoint-biased.\n\nThe profiler should work on any platform with a JDK 17 or newer ([JDK 11 version](https://github.com/StSchnell/tiny-profiler) by Stefan Schnell). The usage is fairly simple:\n\n```sh\n# build it\nmvn package\n\n# run your program and print the table of methods sorted by their sample count\n# and the flame graph, taking a sample every 10ms\njava -javaagent:target/tiny-profiler.jar=flamegraph=flame.html ...\n```\n\nExample:\n\nProfiling the included fibonacci benchmark:\n\n```sh\n\u003e java -javaagent:target/tiny-profiler.jar=flamegraph=flames.html Fib.java 40\n===== method table ======\nTotal samples: 54\nMethod                                                          Samples Percentage     On top Percentage\ncom.sun.tools.javac.launcher.Main.run                                53      98,15          0       0,00\ncom.sun.tools.javac.launcher.Main.main                               53      98,15          0       0,00\ncom.sun.tools.javac.launcher.Main.compile                            28      51,85          0       0,00\njava.lang.reflect.Method.invoke                                      25      46,30          0       0,00\n```\n\nProfiling the [Renaissance](https://renaissance.dev) benchmark suite:\n\n```sh\n# download a benchmark\n\u003e test -e renaissance.jar || wget https://github.com/renaissance-benchmarks/renaissance/releases/download/v0.14.2/renaissance-gpl-0.14.2.jar -O renaissance.jar\n\n\u003e java -javaagent:./target/tiny-profiler.jar=flamegraph=flames.html -jar renaissance.jar dotty\n...\n===== method table ======\nTotal samples: 11217\nMethod                                                          Samples Percentage     On top Percentage\ndotty.tools.dotc.typer.Typer.typed                                59499     530.44          2       0.02\ndotty.tools.dotc.typer.Typer.typedUnadapted                       31050     276.81          7       0.06\nscala.runtime.function.JProcedure1.apply                          24283     216.48         13       0.12\ndotty.tools.dotc.Driver.process                                   19012     169.49          0       0.00\ndotty.tools.dotc.typer.Typer.typedUnnamed$1                       18774     167.37          7       0.06\ndotty.tools.dotc.typer.Typer.typedExpr                            18072     161.11          0       0.00\nscala.collection.immutable.List.foreach                           16271     145.06          3       0.03\n...\n```\nThis results in the following flamegraph:\n\n![flamegraph](img/flame.png)\n\nThe overhead for this example is around 2% on my MacBook Pro 13\" for a 10ms interval, which makes the profiler usable\nwhen you ignore the safepoint-bias.\n\nStructure\n---------\n- Main class: Entry point of the Java agent\n- Options: Parses and stores the agent options\n- Profiler: Contains the profiling loop\n- Store: Stores and outputs the collected results\n\nLicense\n-------\nMIT, Copyright 2023 SAP SE or an SAP affiliate company, Johannes Bechberger\nand tiny profiler contributors\n\n\n*This project is a prototype of the [SapMachine](https://sapmachine.io) team\nat [SAP SE](https://sap.com)*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparttimenerd%2Ftiny-profiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparttimenerd%2Ftiny-profiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparttimenerd%2Ftiny-profiler/lists"}