• Stars
    star
    69
  • Rank 437,071 (Top 9 %)
  • Language
    C++
  • License
    GNU General Publi...
  • Created over 10 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a tool to count accesses to member variables in c++ programs

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.

Note

access_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:

<blank line> <fully qualified name of instrumented type> <offset>:<hit count> <offset>:<hit count>

example usage

#include "access_profiler.hpp"
#include <stdio.h>

struct test : access_profiler::instrument_type<test>
{
    test() : a(0), b(0) {}
    char array[50];
    int a;
    int b;
};

int main(int argc, char* argv[])
{
    test* t1 = new test;

    for (int i = 0; i < 10; ++i)
    {
        ++t1->a;
        t1->b += t1->a;
    }

    printf("%d\n", t1->b);

    delete t1;
}

example output

output from a debug build:

test
     52: 31
     56: 22

output from a release build:

test
     52: 1

More Repositories

1

libtorrent

an efficient feature complete C++ bittorrent implementation
C++
4,957
star
2

struct_layout

tool to show the structure layout of types in your C/C++ program, highlighting padding
Python
114
star
3

btfs

a user space file system for efficiently downloading and seeding torrents
C++
69
star
4

libtorrent-webui

a WebUI implementation for libtorrent based clients
C++
45
star
5

utrack

fast UDP bittorrent tracker
C++
38
star
6

libsimulator

libsimulator is a library for building discrete event simulations, implementing the ``boost.asio`` API.
C++
21
star
7

bdecode

an efficient bdecoder / parser
C++
16
star
8

libtorrent-daemon

a bittorrent client for servers
C++
14
star
9

try_signal

Turns signals within a scope into c++ exceptions
C++
13
star
10

torrent-tools

tools for creating, inspecting and modifying torrent files
C++
10
star
11

peer_ordering

This is a simple simulation of peer connections in a bittorrent swarm, illustrating the potential performance issues (peer clustering) of widely used first-come-first-serve logic for accepting incoming connections as well as a solution to that problem.
Python
8
star
12

bittorrent-trace

A tool to reconstruct and analyze bittorrent stream from a packet capture
C++
7
star
13

inline-namespace-abi-versioning

Example and test of an approach to gradually introduce proper ABI versioning with inline namespaces in a library
C++
6
star
14

libtorrent-fuzz

fuzzing infrastructure for libtorrent
C++
3
star
15

torrent-analyzer

A tool to run statistics analysis on a set of .torrent files
C++
3
star
16

bittorrent-multi-have

a bittorrent extension proposal
Python
2
star
17

moving_average

an implementation of integer moving average algorithm
Python
2
star
18

conan-boost-build-gen

a conan generator for boost-build
Python
1
star
19

hash_complete_prefix

Experiment to count "complete bit prefixes" of output from various hashes, given complete bit prefix inputs. A complete bit prefix is a number of bits in the prefix of the digest where every bit combination is present in the set of digests.
C++
1
star