{"id":13628784,"url":"https://github.com/namhyung/uftrace","last_synced_at":"2026-03-02T07:20:43.005Z","repository":{"id":14025712,"uuid":"16727749","full_name":"namhyung/uftrace","owner":"namhyung","description":"Function graph tracer for C/C++/Rust/Python","archived":false,"fork":false,"pushed_at":"2026-02-12T08:09:45.000Z","size":8540,"stargazers_count":3394,"open_issues_count":409,"forks_count":535,"subscribers_count":81,"default_branch":"master","last_synced_at":"2026-02-12T17:34:20.684Z","etag":null,"topics":["function","trace","tracer","tracing"],"latest_commit_sha":null,"homepage":"https://uftrace.github.io/slide/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/namhyung.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-02-11T10:44:50.000Z","updated_at":"2026-02-12T08:09:49.000Z","dependencies_parsed_at":"2023-11-06T04:31:01.622Z","dependency_job_id":"c3e65672-e8cf-4530-9688-ed1436c44a9e","html_url":"https://github.com/namhyung/uftrace","commit_stats":{"total_commits":4070,"total_committers":119,"mean_commits":34.20168067226891,"dds":0.2965601965601966,"last_synced_commit":"7e07a435c7d805253d8971ad9e707c4682699a26"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/namhyung/uftrace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/namhyung%2Fuftrace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/namhyung%2Fuftrace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/namhyung%2Fuftrace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/namhyung%2Fuftrace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/namhyung","download_url":"https://codeload.github.com/namhyung/uftrace/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/namhyung%2Fuftrace/sbom","scorecard":{"id":456894,"data":{"date":"2025-08-11","repo":{"name":"github.com/namhyung/uftrace","commit":"12d1aeb9382a4ef002cb590eb88e7aaa1fd35caf"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"name":"Maintained","score":10,"reason":"30 commit(s) and 24 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 2/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nightly-test.yml:1","Warn: no topLevel permission defined: .github/workflows/on-demand-test.yml:1","Warn: no topLevel permission defined: .github/workflows/pr-test.yml:1","Warn: no topLevel permission defined: .github/workflows/push-test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: COPYING:0","Info: FSF or OSI recognized license: GNU General Public License v2.0: COPYING:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nightly-test.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/namhyung/uftrace/nightly-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/on-demand-test.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/namhyung/uftrace/on-demand-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr-test.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/namhyung/uftrace/pr-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr-test.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/namhyung/uftrace/pr-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr-test.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/namhyung/uftrace/pr-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pr-test.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/namhyung/uftrace/pr-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/push-test.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/namhyung/uftrace/push-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/push-test.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/namhyung/uftrace/push-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/push-test.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/namhyung/uftrace/push-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/push-test.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/namhyung/uftrace/push-test.yml/master?enable=pin","Warn: containerImage not pinned by hash: misc/docker/alpine/3.13/Dockerfile:1: pin your Docker image by updating alpine:3.13 to alpine:3.13@sha256:469b6e04ee185740477efa44ed5bdd64a07bbdd6c7e5f5d169e540889597b911","Warn: containerImage not pinned by hash: misc/docker/alpine/3.14/Dockerfile:1: pin your Docker image by updating alpine:3.14 to alpine:3.14@sha256:0f2d5c38dd7a4f4f733e688e3a6733cb5ab1ac6e3cb4603a5dd564e5bfb80eed","Warn: containerImage not pinned by hash: misc/docker/arch/Dockerfile:1: pin your Docker image by updating archlinux:latest to archlinux:latest@sha256:104d24b4464e89a16566d3e68ce0e2707aa15258c690ee9bef755930e8bc1c2d","Warn: containerImage not pinned by hash: misc/docker/centos/7/Dockerfile:1: pin your Docker image by updating centos:7 to centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4","Warn: containerImage not pinned by hash: misc/docker/fedora/33/Dockerfile:1: pin your Docker image by updating fedora:33 to fedora:33@sha256:46e6c941bb536f6a54390f9956e2566fde0738c28d21c16eb8daa16c22d13410","Warn: containerImage not pinned by hash: misc/docker/fedora/34/Dockerfile:1: pin your Docker image by updating fedora:34 to fedora:34@sha256:55a74d948c47bb002edff3c7a9a7e864152c686d7c2dc8e3df1ac4d611a20898","Warn: containerImage not pinned by hash: misc/docker/ubuntu/16.04/Dockerfile:1: pin your Docker image by updating ubuntu:16.04 to ubuntu:16.04@sha256:1f1a2d56de1d604801a9671f301190704c25d604a416f59e03c04f5c6ffee0d6","Warn: containerImage not pinned by hash: misc/docker/ubuntu/18.04/Dockerfile:1: pin your Docker image by updating ubuntu:18.04 to ubuntu:18.04@sha256:152dc042452c496007f07ca9127571cb9c29697f42acbfad72324b2bb2e43c98","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   8 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}}]},"last_synced_at":"2025-08-19T09:56:40.926Z","repository_id":14025712,"created_at":"2025-08-19T09:56:40.926Z","updated_at":"2025-08-19T09:56:40.926Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29994859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"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":["function","trace","tracer","tracing"],"created_at":"2024-08-01T22:00:57.510Z","updated_at":"2026-03-02T07:20:42.989Z","avatar_url":"https://github.com/namhyung.png","language":"C","funding_links":[],"categories":["C","Profiling","\u003ca id=\"70e64e3147675c9bcd48d4f475396e7f\"\u003e\u003c/a\u003eMonitor\u0026\u0026监控\u0026\u0026Trace\u0026\u0026追踪"],"sub_categories":["\u003ca id=\"cd76e644d8ddbd385939bb17fceab205\"\u003e\u003c/a\u003e工具"],"readme":"[![Nightly test](https://github.com/namhyung/uftrace/actions/workflows/nightly-test.yml/badge.svg)](https://github.com/namhyung/uftrace/actions/workflows/nightly-test.yml)\n[![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?logo=discord\u0026logoColor=white)](https://discord.gg/MENMKaCWqD)\n\nuftrace\n=======\n\n\u003ca href=\"https://repology.org/project/uftrace/versions\"\u003e\n    \u003cimg src=\"https://repology.org/badge/vertical-allrepos/uftrace.svg\" alt=\"Packaging status\" align=\"right\"\u003e\n\u003c/a\u003e\n\nuftrace is a function call graph tracer for C, C++, Rust and Python programs.\n\nIt hooks into the entry and exit of each function, recording timestamps\nas well as the function's arguments and return values. uftrace is capable\nof tracing both user and kernel functions, as well as library functions and\nsystem events providing an integrated execution flow in a single timeline.\n\nInitially, uftrace only supported function tracing with compiler support.\nHowever, it now allows users to trace function calls without recompilation\nby analyzing instructions in each function prologue and dynamically and\nselectively patching those instructions.\n\nUsers can also write and run scripts for each function entry and exit using\npython/luajit APIs to create custom tools for their specific purposes.\n\nuftrace offers various filters to reduce the amount of trace data and provides\nvisualization using Chrome trace viewer and flame graph or call-graph diagrams\nfor graphviz and mermaid, allowing for a big picture view of the execution flow.\n\nIt was heavily inspired by the ftrace framework of the Linux kernel and\nthe name uftrace stems from the combination of user and ftrace.\n\nIt can record data from:\n- User space C/C++/Rust functions, by either dynamically patching functions\n  using `-P.`, or else selective NOP patching using code compiled with `-pg`,\n  `-finstrument-functions` or `-fpatchable-function-entry=N`.\n- C/C++/Rust Library functions (through PLT hooking)\n- Python functions (using Python's trace/profile infrastructure)\n- Kernel functions (using the ftrace framework in Linux kernel)\n- Kernel trace events (using event tracing framework in Linux kernel)\n- Task creation, termination and scheduling events (using Linux perf_event)\n- User space events in the target binary or libraries (using SystemTap SDT ABI)\n- PMU counter values for given functions (using Linux perf_event)\n\nWith the recorded data, uftrace can:\n- Show colored and nested function call graphs.\n- Show arguments and return values symbolically using libc function prototypes\n  and DWARF debug information.\n- Apply filters to minimize the amount of trace data in both record and replay time.\n- Extract metadata from traces. (e.g. system information on which the trace was taken)\n- Generate symbol tables and memory maps of the traced program and library functions.\n- Generate task relationship trees (parent and children) of nested programs in traces.\n\nIt supports many commands and filters such as filtering by function call\nduration for analysis of program execution and performance.\n\n![uftrace-live-demo](doc/uftrace-live-demo.gif)\n\n * Homepage: https://github.com/namhyung/uftrace\n * Tutorial: https://github.com/namhyung/uftrace/wiki/Tutorial\n * Chat: https://discord.gg/MENMKaCWqD (Discord)\n * Mailing list: [uftrace@googlegroups.com](https://groups.google.com/forum/#!forum/uftrace)\n * Lightning talk: https://youtu.be/LNav5qvyK7I\n\n\nFeatures\n========\n\nuftrace traces each function in the executable and shows time durations.\n\nUsually, for this to be possible, the program needs to be compiled with\n`-pg` or `-fpatchable-function-entry=5` (`=2` is enough on aarch64).\nWith full dynamic tracing (`-P.`|`--patch=.`), uftrace works on all executables (as\nlong they are not stripped, or symbol information is available from a separate file).\n\nuftrace hooks into the PLT in the given executable file to trace library calls and with\n(`-l`|`--nest-libcall`), it also hooks into the procedure linkage tables (PLTs) of shared\nlibraries. The depth can be limited using `-D\u003cnum\u003e`, where 1 is flat call tracing.\n\nUsing (`-a`|`--auto-args`), uftrace automatically records arguments and\nreturn values of known functions. Without extra debug information, this\nincludes the API functions of standard (C language or system) libraries.\nThis can be combined with `-P.` or `-l`:\nFor example, `-la` traces nested library calls, even in stripped executables.\n\nIn addition, `-a` implies `--srcline`, so it records the source line location info, and\nthis info can be shown by `uftrace replay --srcline` and in `uftrace tui`. Users can directly\nopen the editor at the source location as shown in https://uftrace.github.io/slide/#120.\n\nIf debug information for the program (`gcc -g`) is available, `--auto-args`\nworks even on functions inside the user-compiled programs.\n\nIn case argument information is not available, argument specifications like\n(`-A udev_new@arg1/s`) can be passed on the command line or an options file.\n\nExample:\n```py\n$ uftrace record -la -A udev_new@arg1/s lsusb \u003e/dev/null\n$ uftrace replay -f+module\nor simply:\n$ uftrace -la -A udev_new@arg1/s -f+module lsusb  # -f+module adds the module name\n# DURATION     TID        MODULE NAME   FUNCTION\n 306.339 us [ 23561]            lsusb | setlocale(LC_TYPE, \"\") = \"en_US.UTF-8\";\n   1.163 us [ 23561]            lsusb | getopt_long(1, 0x7fff7175f6a8, \"D:vtP:p:s:d:Vh\") = -1;\n            [ 23561]            lsusb | udev_new(\"POSIXLY_CORRECT\") {\n   0.406 us [ 23561] libudev.so.1.7.2 |   malloc(16) = 0x55e07277a7b0;\n   2.620 us [ 23561]            lsusb | } /* udev_new */\n            [ 23561]            lsusb | udev_hwdb_new() {\n   0.427 us [ 23561] libudev.so.1.7.2 |   calloc(1, 200) = 0x55e07277a7d0;\n   5.829 us [ 23561] libudev.so.1.7.2 |   fopen64(\"/etc/systemd/hwdb/hwdb.bin\", \"re\") = 0;\n```\n\nFurthermore, it can show detailed execution flow at function level, and report\nwhich functions had the longest execution time.  It also shows information about\nthe execution environment.\n\nYou can set up filters to exclude or include specific functions when tracing.\nIn addition, function arguments and return values can be saved and shown later.\n\nIt supports multi-process and/or multi-threaded applications.  With root\nprivileges and if the kernel was built with `CONFIG_FUNCTION_GRAPH_TRACER=y`,\nkernel functions can be traced as well.\n\nHow to build and install uftrace\n================================\n\nOn Linux distros, [misc/install-deps.sh](misc/install-deps.sh) can be used to\ninstall required software(s) for building uftrace.  Those are for optional\nand advanced features, but are highly recommended.\n\n    $ sudo misc/install-deps.sh\n\nOnce you installed required software(s) on your system, it can be built and\ninstalled like following:\n\n    $ ./configure\n    $ make\n    $ sudo make install\n\nFor details about installation and dependencies, please refer to [INSTALL.md](INSTALL.md)\n\n\nHow to use uftrace\n==================\nThese are the commands supported by uftrace:\n\n * [`record`](doc/uftrace-record.md) : runs a program and saves the trace data\n * [`replay`](doc/uftrace-replay.md) : shows program execution in the trace data\n * [`report`](doc/uftrace-report.md) : shows performance statistics in the trace data\n * [`live`  ](doc/uftrace-live.md)   : does record and replay in a row (default)\n * [`info`  ](doc/uftrace-info.md)   : shows system and program info in the trace data\n * [`dump`  ](doc/uftrace-dump.md)   : shows low-level trace data\n * [`recv`  ](doc/uftrace-recv.md)   : saves the trace data from network\n * [`graph` ](doc/uftrace-graph.md)  : shows function call graph in the trace data\n * [`script`](doc/uftrace-script.md) : runs a script for recorded trace data\n * [`tui`   ](doc/uftrace-tui.md)    : show text user interface for graph and report\n\nYou can use `-h` or `--help` option to see available [commands and options](doc/uftrace.md).\n\n    $ uftrace\n    uftrace -- function (graph) tracer for userspace\n\n     usage: uftrace [COMMAND] [OPTION...] [\u003cprogram\u003e]\n\n     COMMAND:\n       record          Run a program and saves the trace data\n       replay          Show program execution in the trace data\n       report          Show performance statistics in the trace data\n       live            Do record and replay in a row (default)\n       info            Show system and program info in the trace data\n       dump            Show low-level trace data\n       recv            Save the trace data from network\n       graph           Show function call graph in the trace data\n       script          Run a script for recorded trace data\n       tui             Show text user interface for graph and report\n\n    Try `uftrace --help' or `man uftrace [COMMAND]' for more information.\n\nIf omitted, it defaults to the `live` command which is almost same as running\nrecord and replay subcommand in a row (but does not record the trace info\nto files).\n\nFor recording, the executable needs to be compiled with the `-pg`\n(or `-finstrument-functions`) option which generates profiling code\n(calling mcount or __cyg_profile_func_enter/exit) for each function.\n\nNote that, there's an experimental support for dynamic tracing on\nx86_64 and AArch64(ARM64) which doesn't require such (re-)compilations.\nAlso, recent compilers have some options to help uftrace\nto reduce tracing overhead with similar way\n(although it still needs recompilation of your program).\nPlease see [dynamic tracing](doc/uftrace-record.md#dynamic-tracing) section\nfor more details.\n\n    $ uftrace tests/t-abc\n    # DURATION    TID     FUNCTION\n      16.134 us [ 1892] | __monstartup();\n     223.736 us [ 1892] | __cxa_atexit();\n                [ 1892] | main() {\n                [ 1892] |   a() {\n                [ 1892] |     b() {\n                [ 1892] |       c() {\n       2.579 us [ 1892] |         getpid();\n       3.739 us [ 1892] |       } /* c */\n       4.376 us [ 1892] |     } /* b */\n       4.962 us [ 1892] |   } /* a */\n       5.769 us [ 1892] | } /* main */\n\nFor more analysis, you'd be better recording it first so that it can run\nanalysis commands like replay, report, graph, dump and/or info multiple times.\n\n    $ uftrace record tests/t-abc\n\nIt'll create uftrace.data directory that contains trace data files.\nOther analysis commands expect the directory exists in the current directory,\nbut one can use another using `-d` option.\n\nThe `replay` command shows execution information like above.  As you can see,\n`t-abc` is a very simple program merely calls a, b and c functions.\nIn the c function it called getpid() which is a library function implemented\nin the C library (glibc) on normal systems - the same goes to __cxa_atexit().\n\nUsers can use various filter options to limit functions it records/prints.\nThe depth filter (`-D` option) is to omit functions under the given call depth.\nThe time filter (`-t` option) is to omit functions running less than the given\ntime. And the function filters (`-F` and `-N` options) are to show/hide functions\nunder the given function.\n\nThe `-k` option enables to trace kernel functions as well (needs root access).\nWith the classic hello world program, the output would look like below (Note,\nI changed it to use fprintf() with stderr rather than the plain printf() to make\nit invoke system call directly):\n\n    $ sudo uftrace -k tests/t-hello\n    Hello world\n    # DURATION    TID     FUNCTION\n       1.365 us [21901] | __monstartup();\n       0.951 us [21901] | __cxa_atexit();\n                [21901] | main() {\n                [21901] |   fprintf() {\n       3.569 us [21901] |     __do_page_fault();\n      10.127 us [21901] |     sys_write();\n      20.103 us [21901] |   } /* fprintf */\n      21.286 us [21901] | } /* main */\n\nYou can see the page fault handler and the system call handler for write() were called\ninside the fprintf() call.\n\nAlso, it can record and show function arguments and return value with `-A` and\n`-R` options respectively.  The following example records first argument and\nreturn value of 'fib' (Fibonacci number) function.\n\n    $ uftrace record -A fib@arg1 -R fib@retval tests/t-fibonacci 5\n\n    $ uftrace replay\n    # DURATION    TID     FUNCTION\n       2.853 us [22080] | __monstartup();\n       2.194 us [22080] | __cxa_atexit();\n                [22080] | main() {\n       2.706 us [22080] |   atoi();\n                [22080] |   fib(5) {\n                [22080] |     fib(4) {\n                [22080] |       fib(3) {\n       7.473 us [22080] |         fib(2) = 1;\n       0.419 us [22080] |         fib(1) = 1;\n      11.452 us [22080] |       } = 2; /* fib */\n       0.460 us [22080] |       fib(2) = 1;\n      13.823 us [22080] |     } = 3; /* fib */\n                [22080] |     fib(3) {\n       0.424 us [22080] |       fib(2) = 1;\n       0.437 us [22080] |       fib(1) = 1;\n       2.860 us [22080] |     } = 2; /* fib */\n      19.600 us [22080] |   } = 5; /* fib */\n      25.024 us [22080] | } /* main */\n\nThe `report` command lets you know which function spends the longest time\nincluding its children (total time).\n\n    $ uftrace report\n      Total time   Self time       Calls  Function\n      ==========  ==========  ==========  ====================================\n       25.024 us    2.718 us           1  main\n       19.600 us   19.600 us           9  fib\n        2.853 us    2.853 us           1  __monstartup\n        2.706 us    2.706 us           1  atoi\n        2.194 us    2.194 us           1  __cxa_atexit\n\n\nThe `graph` command shows function call graph of given function.  In the above\nexample, function graph of function 'main' looks like below:\n\n    $ uftrace graph  main\n    # Function Call Graph for 'main' (session: 073f1e84aa8b09d3)\n    =============== BACKTRACE ===============\n     backtrace #0: hit 1, time  25.024 us\n       [0] main (0x40066b)\n\n    ========== FUNCTION CALL GRAPH ==========\n      25.024 us : (1) main\n       2.706 us :  +-(1) atoi\n                :  |\n      19.600 us :  +-(1) fib\n      16.683 us :    (2) fib\n      12.773 us :    (4) fib\n       7.892 us :    (2) fib\n\n\nThe `dump` command shows raw output of each trace record.  You can see the result\nin the Chrome browser, once the data is processed with `uftrace dump --chrome`.\nBelow is a trace of clang (LLVM) compiling a small C++ template metaprogram.\n\n[![uftrace-chrome-dump](doc/uftrace-chrome.png)](https://uftrace.github.io/dump/clang.tmp.fib.html)\n\nIt also supports flame-graph output as well.  The data can be processed with\n`uftrace dump --flame-graph` and passed to\n[flamegraph.pl](https://github.com/brendangregg/FlameGraph/blob/master/flamegraph.pl).\nBelow is a flame graph result of gcc compiling a simple C program.\n\n[![uftrace-flame-graph-dump](https://uftrace.github.io/dump/gcc.svg)](https://uftrace.github.io/dump/gcc.svg)\n\nThe `info` command shows system and program information when recorded.\n\n    $ uftrace info\n    # system information\n    # ==================\n    # program version     : uftrace v0.8.1\n    # recorded on         : Tue May 24 11:21:59 2016\n    # cmdline             : uftrace record tests/t-abc\n    # cpu info            : Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz\n    # number of cpus      : 12 / 12 (online / possible)\n    # memory info         : 20.1 / 23.5 GB (free / total)\n    # system load         : 0.00 / 0.06 / 0.06 (1 / 5 / 15 min)\n    # kernel version      : Linux 4.5.4-1-ARCH\n    # hostname            : sejong\n    # distro              : \"Arch Linux\"\n    #\n    # process information\n    # ===================\n    # number of tasks     : 1\n    # task list           : 5098\n    # exe image           : /home/namhyung/project/uftrace/tests/t-abc\n    # build id            : a3c50d25f7dd98dab68e94ef0f215edb06e98434\n    # exit status         : exited with code: 0\n    # elapsed time        : 0.003219479 sec\n    # cpu time            : 0.000 / 0.003 sec (sys / user)\n    # context switch      : 1 / 1 (voluntary / involuntary)\n    # max rss             : 3072 KB\n    # page fault          : 0 / 172 (major / minor)\n    # disk iops           : 0 / 24 (read / write)\n\nThe `script` command allows user to run a custom script on a data recorded.\nThe supported script types are Python 3, Python 2.7 and Lua 5.1 as of now.\n\nThe `tui` command is for interactive text-based user interface using ncurses.\nIt provides basic functionality of `graph`, `report` and `info` commands as of\nnow.\n\n\nLimitations\n===========\n- It can trace a C/C++/Rust/Python application on Linux and Android.\n- It *cannot* trace an already running process yet.\n- It was *not* designed for system-wide tracing in mind.\n- It mainly supports x86_64, AArch64 architectures.  It also works on x86 (32-bit), ARM (v6 and v7) but some features like dynamic tracing and automatic argument fetching might not work well.\n\n\nLicense\n=======\nThe uftrace program is released under GPL v2.  See [COPYING file](COPYING) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnamhyung%2Fuftrace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnamhyung%2Fuftrace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnamhyung%2Fuftrace/lists"}