rok commented on code in PR #13516:
URL: https://github.com/apache/arrow/pull/13516#discussion_r976373194
##########
cpp/src/arrow/memory_pool_test.cc:
##########
@@ -168,7 +169,103 @@ TEST(Jemalloc, SetDirtyPageDecayMillis) {
#ifdef ARROW_JEMALLOC
ASSERT_OK(jemalloc_set_decay_ms(0));
#else
- ASSERT_RAISES(Invalid, jemalloc_set_decay_ms(0));
+ ASSERT_RAISES(NotImplemented, jemalloc_set_decay_ms(0));
+#endif
+}
+
+TEST(Jemalloc, GetAllocationStats) {
+#ifdef ARROW_JEMALLOC
+ uint8_t* data;
+ int64_t allocated, active, metadata, resident, mapped, retained, allocated0,
active0,
+ metadata0, resident0, mapped0, retained0;
+ int64_t thread_allocated, thread_deallocated, thread_peak_read,
thread_allocated0,
+ thread_deallocated0, thread_peak_read0;
+ auto pool = default_memory_pool();
+ ABORT_NOT_OK(jemalloc_memory_pool(&pool));
+ ASSERT_EQ("jemalloc", pool->backend_name());
+
+ // Record stats before allocating
+ ASSERT_OK_AND_ASSIGN(allocated0, jemalloc_get_stat("stats.allocated"));
+ ASSERT_OK_AND_ASSIGN(active0, jemalloc_get_stat("stats.active"));
+ ASSERT_OK_AND_ASSIGN(metadata0, jemalloc_get_stat("stats.metadata"));
+ ASSERT_OK_AND_ASSIGN(resident0, jemalloc_get_stat("stats.resident"));
+ ASSERT_OK_AND_ASSIGN(mapped0, jemalloc_get_stat("stats.mapped"));
+ ASSERT_OK_AND_ASSIGN(retained0, jemalloc_get_stat("stats.retained"));
+ ASSERT_OK_AND_ASSIGN(thread_allocated0,
jemalloc_get_stat("thread.allocated"));
+ ASSERT_OK_AND_ASSIGN(thread_deallocated0,
jemalloc_get_stat("thread.deallocated"));
+ ASSERT_OK_AND_ASSIGN(thread_peak_read0,
jemalloc_get_stat("thread.peak.read"));
+
+ // Allocate memory
+ ASSERT_OK(jemalloc_set_decay_ms(10000));
Review Comment:
This was a leftover from something I was trying earlier. Removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]