Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend memory tracing for programatic use and to report on max RSS #1600

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

poodlewars
Copy link
Collaborator

The idea for this is so that we can measure growth in peak RSS in benchmarks. I'll add one to enterprise soon like,

    for (auto _ : state) {
        auto before_sync = util::get_memory_use_summary();
        sync.go();
        auto after_sync = util::get_memory_use_summary();
        uint64_t max_rss_before_mib = before_sync.max_resident.value_ >> 20;
        state.counters["max_rss_before_sync_mib"] = max_rss_before_mib;
        uint64_t max_rss_after_mib = after_sync.max_resident.value_ >> 20;
        state.counters["max_rss_after_sync_mib"] = max_rss_after_mib;
        state.counters["max_rss_growth_during_sync_mib"] = max_rss_after_mib - max_rss_before_mib;
    }

Test output:

(310) ➜  cpp git:(sync_snapshots_mem) ✗ /home/alex/source/arcticdb-enterprise/out/linux-release-build/ArcticDB/cpp/arcticdb/test_unit_arcticdb --gtest_filter=*PrintMemUsage* --gtest_color=no Note: Google Test filter = *PrintMemUsage*
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from Allocator
[ RUN      ] Allocator.PrintMemUsage
[2024-06-04 16:21:17.596] [arcticdb] [debug] /home/alex/source/arcticdb-enterprise/ArcticDB/cpp/arcticdb/util/test/test_tracing_allocator.cpp (TestBody:45) size[95.7Mb] resident[33.6Mb] max_resident[33.6Mb] shared[28.1Mb] text[43.9Mb] data/stack[6.2Mb]
[       OK ] Allocator.PrintMemUsage (0 ms)
[----------] 1 test from Allocator (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total) [  PASSED  ] 1 test.

Output:

(310) ➜  cpp git:(sync_snapshots_mem) ✗ /home/alex/source/arcticdb-enterprise/out/linux-release-build/ArcticDB/cpp/arcticdb/test_unit_arcticdb --gtest_filter=*PrintMemUsage* --gtest_color=no
Note: Google Test filter = *PrintMemUsage*
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from Allocator
[ RUN      ] Allocator.PrintMemUsage
[2024-06-04 16:21:17.596] [arcticdb] [debug] /home/alex/source/arcticdb-enterprise/ArcticDB/cpp/arcticdb/util/test/test_tracing_allocator.cpp (TestBody:45) size[95.7Mb] resident[33.6Mb] max_resident[33.6Mb] shared[28.1Mb] text[43.9Mb] data/stack[6.2Mb]
[       OK ] Allocator.PrintMemUsage (0 ms)
[----------] 1 test from Allocator (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 1 test.
@poodlewars poodlewars merged commit d9bf407 into master Jun 5, 2024
111 checks passed
@poodlewars poodlewars deleted the memory-debugging-tools branch June 5, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants