Alexey Borzenkov 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
..
ut 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
README.md b23c1d7a80 Restoring authorship annotation for <monster@yandex-team.ru>. Commit 2 of 2. 3 years ago
actor.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
actor.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
actor_bootstrapped.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
actor_coroutine.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
actor_coroutine.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
actor_coroutine_ut.cpp 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
actor_ut.cpp b036a557f2 Restoring authorship annotation for <aozeritsky@yandex-team.ru>. Commit 2 of 2. 3 years ago
actorid.cpp 2e714b5ebd Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 2 of 2. 3 years ago
actorid.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
actorsystem.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
actorsystem.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
actorsystem_ut.cpp 2e714b5ebd Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 2 of 2. 3 years ago
ask.cpp 2e714b5ebd Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 2 of 2. 3 years ago
ask.h 2e714b5ebd Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 2 of 2. 3 years ago
ask_ut.cpp 60040c91ff Restoring authorship annotation for Ilnur Khuziev <ilnur.khuziev@yandex.ru>. Commit 2 of 2. 3 years ago
balancer.cpp 1110808a9d intermediate changes 3 years ago
balancer.h 1110808a9d intermediate changes 3 years ago
balancer_ut.cpp 1110808a9d intermediate changes 3 years ago
buffer.cpp d3a398281c Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2. 3 years ago
buffer.h d3a398281c Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2. 3 years ago
callstack.cpp 9abfb1a53b Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2. 3 years ago
callstack.h d3a398281c Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2. 3 years ago
config.h 1110808a9d intermediate changes 3 years ago
cpu_manager.cpp 1110808a9d intermediate changes 3 years ago
cpu_manager.h 1110808a9d intermediate changes 3 years ago
cpu_state.h 1110808a9d intermediate changes 3 years ago
defs.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
event.cpp 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
event.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
event_load.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
event_local.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
event_pb.cpp 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
event_pb.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
event_pb_payload_ut.cpp 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
event_pb_ut.cpp 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
events.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
events_undelivered.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
executelater.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
executor_pool_base.cpp fccc62e9bf Restoring authorship annotation for Alexander Gololobov <davenger@yandex-team.com>. Commit 2 of 2. 3 years ago
executor_pool_base.h fccc62e9bf Restoring authorship annotation for Alexander Gololobov <davenger@yandex-team.com>. Commit 2 of 2. 3 years ago
executor_pool_basic.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
executor_pool_basic.h fccc62e9bf Restoring authorship annotation for Alexander Gololobov <davenger@yandex-team.com>. Commit 2 of 2. 3 years ago
executor_pool_basic_ut.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
executor_pool_io.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
executor_pool_io.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
executor_pool_united.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
executor_pool_united.h eb540cc7a1 Restoring authorship annotation for <asorotsky@yandex-team.ru>. Commit 2 of 2. 3 years ago
executor_pool_united_ut.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
executor_thread.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
executor_thread.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
hfunc.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
interconnect.cpp 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
interconnect.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
invoke.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
io_dispatcher.cpp 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
io_dispatcher.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
lease.h 1110808a9d intermediate changes 3 years ago
log.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
log.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
log_iface.h d3a398281c Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2. 3 years ago
log_settings.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
log_settings.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
log_ut.cpp 2e714b5ebd Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 2 of 2. 3 years ago
mailbox.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
mailbox.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
mailbox_queue_revolving.h bd5ef432f5 Restoring authorship annotation for <agorodilov@yandex-team.ru>. Commit 2 of 2. 3 years ago
mailbox_queue_simple.h bd085aee9b Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 2 of 2. 3 years ago
memory_track.cpp b23c1d7a80 Restoring authorship annotation for <monster@yandex-team.ru>. Commit 2 of 2. 3 years ago
memory_track.h b23c1d7a80 Restoring authorship annotation for <monster@yandex-team.ru>. Commit 2 of 2. 3 years ago
memory_tracker.cpp b23c1d7a80 Restoring authorship annotation for <monster@yandex-team.ru>. Commit 2 of 2. 3 years ago
memory_tracker.h b23c1d7a80 Restoring authorship annotation for <monster@yandex-team.ru>. Commit 2 of 2. 3 years ago
memory_tracker_ut.cpp b23c1d7a80 Restoring authorship annotation for <monster@yandex-team.ru>. Commit 2 of 2. 3 years ago
mon.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
mon_stats.h fccc62e9bf Restoring authorship annotation for Alexander Gololobov <davenger@yandex-team.com>. Commit 2 of 2. 3 years ago
monotonic.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
monotonic.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
probes.cpp fccc62e9bf Restoring authorship annotation for Alexander Gololobov <davenger@yandex-team.com>. Commit 2 of 2. 3 years ago
probes.h 667a4ee7da Restoring authorship annotation for Alexander Rutkovsky <alexvru@mail.ru>. Commit 2 of 2. 3 years ago
process_stats.cpp fccc62e9bf Restoring authorship annotation for Alexander Gololobov <davenger@yandex-team.com>. Commit 2 of 2. 3 years ago
process_stats.h fccc62e9bf Restoring authorship annotation for Alexander Gololobov <davenger@yandex-team.com>. Commit 2 of 2. 3 years ago
scheduler_actor.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
scheduler_actor.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
scheduler_actor_ut.cpp 2e714b5ebd Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 2 of 2. 3 years ago
scheduler_basic.cpp 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
scheduler_basic.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
scheduler_cookie.cpp dc5feacd15 Restoring authorship annotation for Vitalii Gridnev <gridnevvvit@gmail.com>. Commit 2 of 2. 3 years ago
scheduler_cookie.h bd5ef432f5 Restoring authorship annotation for <agorodilov@yandex-team.ru>. Commit 2 of 2. 3 years ago
scheduler_queue.h 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago
servicemap.h 1110808a9d intermediate changes 3 years ago
worker_context.cpp 1110808a9d intermediate changes 3 years ago
worker_context.h 1110808a9d intermediate changes 3 years ago
ya.make 22d92781ba Restoring authorship annotation for Alexey Borzenkov <snaury@yandex-team.ru>. Commit 1 of 2. 3 years ago

README.md

Memory tracker

https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/actors/core/memory_track.h

Использование:

  • отслеживание аллокаций экземпляров конкретного класса через new/delete и new[]/delete[]
  • отслеживание аллокаций в контейнерах
  • ручное отслеживание моментов аллокации/деаллокации

Отслеживание аллокаций класса через new/delete

Использование с автоматически генерируемой меткой:

#include <library/cpp/actors/core/memory_track.h>

struct TTypeLabeled
    : public NActors::NMemory::TTrack<TTypeLabeled>
{
    char payload[16];
};

Использование с пользовательским именем метки:

#include <library/cpp/actors/core/memory_track.h>

static const char NamedLabel[] = "NamedLabel";

struct TNameLabeled
    : public NActors::NMemory::TTrack<TNameLabeled, NamedLabel>
{
    char payload[32];
};

Отслеживание аллокаций в контейнерах

#include <library/cpp/actors/core/memory_track.h>

static const char InContainerLabel[] = "InContainerLabel";

struct TInContainer {
    char payload[16];
};

std::vector<TInContainer, NActors::NMemory::TAlloc<TInContainer>> vecT;

std::vector<TInContainer, NActors::NMemory::TAlloc<TInContainer, InContainerLabel>> vecN;

using TKey = int;

std::map<TKey, TInContainer, std::less<TKey>,
    NActors::NMemory::TAlloc<std::pair<const TKey, TInContainer>>> mapT;

std::map<TKey, TInContainer, std::less<TKey>,
    NActors::NMemory::TAlloc<std::pair<const TKey, TInContainer>, InContainerLabel>> mapN;

std::unordered_map<TKey, TInContainer, std::hash<TKey>, std::equal_to<TKey>,
    NActors::NMemory::TAlloc<std::pair<const TKey, TInContainer>>> umapT;

std::unordered_map<TKey, TInContainer, std::hash<TKey>, std::equal_to<TKey>,
    NActors::NMemory::TAlloc<std::pair<const TKey, TInContainer>, InContainerLabel>> umapN;

Ручное отслеживание аллокаций/деаллокаций

#include <library/cpp/actors/core/memory_track.h>

static const char ManualLabel[] = "ManualLabel";

...
NActors::NMemory::TLabel<ManualLabel>::Add(size);

...
NActors::NMemory::TLabel<ManualLabel>::Sub(size);

Собираемые метрики

Сервис utils, пользовательская метка label, сенсоры:

  • MT/Count: количество аллокаций в моменте
  • MT/Memory: аллоцированная память в моменте
  • MT/PeakCount: пиковое значение количества аллокаций (сэмплится с фиксированной частотой)
  • MT/PeakMemory: пиковое значение аллоцированной памяти