Skip to content

Add ReadMemStats function#193

Merged
jarifibrahim merged 4 commits intomasterfrom
ibrahim/jemalloc-stats
Sep 9, 2020
Merged

Add ReadMemStats function#193
jarifibrahim merged 4 commits intomasterfrom
ibrahim/jemalloc-stats

Conversation

@jarifibrahim
Copy link
Contributor

@jarifibrahim jarifibrahim commented Sep 8, 2020

JE Malloc is used to manually allocate memory. This PR adds a ReadMemStats
function (similar to runtime.ReadMemStats) that can be used to fetch JE Malloc statistics at runtime.

This PR supports fetching Allocated, Active, Retained, and Resident memory information.

Fixes - DGRAPH-2382


This change is Reviewable

The ReadJEMallocStats function can be used to fetch JE Malloc statistics
at runtime.
Copy link
Contributor

@ashish-goswami ashish-goswami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @anurags92, @jarifibrahim, @karlmcguire, @manishrjain, and @martinmr)


z/calloc_jemalloc.go, line 86 at r1 (raw file):

func ReadJEMallocStats(stats *JEMallocStats) {
	if stats == nil {
		panic("function argument should not be nil")

See if we can avoid panic here.


z/calloc_jemalloc.go, line 95 at r1 (raw file):

// fetchStat is used to read a specific attribute from je malloc stats using
// mallctl.

can be fit into same line.

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change. Got some comments. :lgtm:

Reviewed 2 of 3 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @anurags92, @jarifibrahim, @karlmcguire, and @martinmr)


z/calloc.go, line 15 at r2 (raw file):

// JEMallocStats is used to fetch JE Malloc Stats. The stats are fetched from
// the mallctl namespace http://jemalloc.net/jemalloc.3.html#mallctl_namespace.
type JEMallocStats struct {

MemStats


z/calloc_jemalloc.go, line 84 at r2 (raw file):

// ReadJEMallocStats populates stats with JE Malloc statistics.
func ReadJEMallocStats(stats *JEMallocStats) {

ReadMemStats

@jarifibrahim jarifibrahim changed the title Add ReadJEMallocStats function Add MemStats function Sep 9, 2020
@jarifibrahim jarifibrahim changed the title Add MemStats function Add ReadMemStats function Sep 9, 2020
@jarifibrahim jarifibrahim merged commit 578ecae into master Sep 9, 2020
@jarifibrahim jarifibrahim deleted the ibrahim/jemalloc-stats branch September 9, 2020 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants