金融信创如何推动金融服务效率与安全的全面提升
608
2022-10-27
access_profiler - 一个工具用于统计在C++程序中访问成员变量
access_profiler
access_profiler is a heavy-weight class field access profiler, implemented as C++ library.
to use this profiler, include "access_profiler.hpp" and make the types you want to instrument derive from access_profiler::instrument_type< your-type > (i.e. you need to specify your type as the template argument).
in you Jamfile, add a dependency to the access_profiler library.
When you terminate your program, the access counters for your types fields will be printed to "access_profile.out" in current working directory. This file lists all instrumented types and the access counters for offsets into those types.
To combine this information with the debug information for more user-friendly output, use the struct_layout tool and use the profile as input.
Noteaccess_profiler is currently not compatible with std::make_shared or similar functions, since those won't invoke the new operator. To profile such types, convert them to regular std::shared_ptr constructor which still allocates the object with new.
output format
Each instrumented type has its fully qualified name printed on a single line preceded by a blank line (even the first type).
After each instrumented type follows a list of offsets into that type, colon, and the number of times that offset was accessed. The counter does not distinguish between reads and writes. These lines are indented by at least 3 spaces, but the offset is right adjusted and may contain some leading spaces too.
The general outline looks like this:
example usage
#include "access_profiler.hpp"#include
example output
output from a debug build:
test 52: 31 56: 22
output from a release build:
test 52: 1
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~