Skip to content

Commit 50a173e

Browse files
committed
jemalloc_analyse: Add support for 5.1.0
Jemalloc 5(.1.0) has changed the ouput format, adding some new columns (currently ignored by this script) and renaming others. Add aliases for the renamed columns so we can still calculate fragmentation. Change-Id: I9d52a9ccae877684f3e21671c4c2ff9adb5591a4 Reviewed-on: http://review.couchbase.org/112589 Tested-by: Build Bot <[email protected]> Reviewed-by: James Harrison <[email protected]>
1 parent 51284b8 commit 50a173e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

scripts/jemalloc/jemalloc_analyse.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ def calc_bin_stats(stats, arena_ID):
7474
for x in line.split()]
7575
c = dict(zip(headers, fields))
7676

77+
# jemalloc 5.0.0 onwards renames `runs` to `slabs` for small
78+
# allocations. Copy back to the old name to allow calculations to work.
79+
if 'curslabs' in c:
80+
c['curruns'] = c['curslabs']
81+
7782
# Derive some stats from each class, additional ones (see below) need
7883
# totals...
7984
try:
@@ -107,6 +112,12 @@ def calc_bin_stats(stats, arena_ID):
107112
fields = [int(x) for x in line.split()]
108113
c = dict(zip(headers, fields))
109114

115+
# jemalloc 5.0.0 onwards renames `curruns` to `l(large)extents` for
116+
# large allocations. Copy back to the old name to allow
117+
# calculations to work.
118+
if 'curlextents' in c:
119+
c['curruns'] = c['curlextents']
120+
110121
c['bin'] = '-'
111122
c['regs'] = 1 # Only one region per large allocation
112123
c['pgs'] = c['pages'] if 'pages' in c else c['size']//4096

tests/scripts_tests/runtests.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ IF("${COUCHBASE_MEMORY_ALLOCATOR}" STREQUAL "jemalloc")
1010
)
1111
ENDIF()
1212

13-
FOREACH(version 3.6 3.6_cropped 4.3.1 current)
13+
FOREACH(version 3.6 3.6_cropped 4.3.1 5.1.0 current)
1414
SET(INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/jemalloc_${version}.log)
1515
SET(OUTPUT_FILE
1616
${CMAKE_CURRENT_BINARY_DIR}/jemalloc_output_${version}.log)

0 commit comments

Comments
 (0)