{"id":13730842,"url":"https://github.com/arvidn/access_profiler","last_synced_at":"2025-03-15T14:30:30.097Z","repository":{"id":12363782,"uuid":"15013128","full_name":"arvidn/access_profiler","owner":"arvidn","description":"a tool to count accesses to member variables in c++ programs","archived":false,"fork":false,"pushed_at":"2013-12-09T00:46:06.000Z","size":124,"stargazers_count":75,"open_issues_count":0,"forks_count":9,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-27T03:11:57.503Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arvidn.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2013-12-07T21:23:19.000Z","updated_at":"2025-01-14T08:00:37.000Z","dependencies_parsed_at":"2022-09-10T22:40:17.442Z","dependency_job_id":null,"html_url":"https://github.com/arvidn/access_profiler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvidn%2Faccess_profiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvidn%2Faccess_profiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvidn%2Faccess_profiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvidn%2Faccess_profiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arvidn","download_url":"https://codeload.github.com/arvidn/access_profiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243742511,"owners_count":20340660,"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","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":[],"created_at":"2024-08-03T02:01:20.206Z","updated_at":"2025-03-15T14:30:29.827Z","avatar_url":"https://github.com/arvidn.png","language":"C++","readme":"access_profiler\n===============\n\n``access_profiler`` is a heavy-weight class field access\nprofiler, implemented as C++ library.\n\nto use this profiler, include ``\"access_profiler.hpp\"``\nand make the types you want to instrument derive from\n``access_profiler::instrument_type\u003c your-type \u003e`` (i.e. you\nneed to specify your type as the template argument).\n\nin you ``Jamfile``, add a dependency to the access_profiler\nlibrary.\n\nWhen you terminate your program, the access counters\nfor your types fields will be printed to \"access_profile.out\"\nin current working directory. This file lists all instrumented\ntypes and the access counters for offsets into those types.\n\nTo combine this information with the debug information for\nmore user-friendly output, use the `struct_layout`_ tool and\nuse the profile as input.\n\n.. _`struct_layout`: https://github.com/arvidn/struct_layout\n\n.. note::\n\t``access_profiler`` is currently not compatible with\n\t``std::make_shared`` or similar functions, since those\n\twon't invoke the ``new`` operator. To profile such types,\n\tconvert them to regular ``std::shared_ptr`` constructor\n\twhich still allocates the object with ``new``.\n\noutput format\n-------------\n\nEach instrumented type has its fully qualified name printed\non a single line preceded by a blank line (even the first type).\n\nAfter each instrumented type follows a list of offsets into that\ntype, colon, and the number of times that offset was accessed. The\ncounter does not distinguish between reads and writes. These\nlines are indented by at least 3 spaces, but the offset is right\nadjusted and may contain some leading spaces too.\n\nThe general outline looks like this:\n\n.. parsed-literal::\n\t\n\t*\u003cblank line\u003e*\n\t*\u003cfully qualified name of instrumented type\u003e*\n\t   *\u003coffset\u003e*:*\u003chit count\u003e*\n\t   *\u003coffset\u003e*:*\u003chit count\u003e*\n\nexample usage\n-------------\n\n::\n\t\n\t#include \"access_profiler.hpp\"\n\t#include \u003cstdio.h\u003e\n\t\n\tstruct test : access_profiler::instrument_type\u003ctest\u003e\n\t{\n\t\ttest() : a(0), b(0) {}\n\t\tchar array[50];\n\t\tint a;\n\t\tint b;\n\t};\n\t\n\tint main(int argc, char* argv[])\n\t{\n\t\ttest* t1 = new test;\n\t\n\t\tfor (int i = 0; i \u003c 10; ++i)\n\t\t{\n\t\t\t++t1-\u003ea;\n\t\t\tt1-\u003eb += t1-\u003ea;\n\t\t}\n\t\n\t\tprintf(\"%d\\n\", t1-\u003eb);\n\t\n\t\tdelete t1;\n\t}\n\nexample output\n--------------\n\noutput from a debug build::\n\n\ttest\n\t     52: 31\n\t     56: 22\n\noutput from a release build::\n\n\ttest\n\t     52: 1\n\n","funding_links":[],"categories":["Miscellaneous","排序","C++"],"sub_categories":["多项混杂"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farvidn%2Faccess_profiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farvidn%2Faccess_profiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farvidn%2Faccess_profiler/lists"}