Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Expose gc_stats as core.memory.GC.stats #1610

Merged
merged 4 commits into from
Jul 19, 2016
Merged

Expose gc_stats as core.memory.GC.stats #1610

merged 4 commits into from
Jul 19, 2016

Conversation

mihails-strasuns
Copy link
Contributor

Replaces #1591 with
changes as suggested by @MartinNowak

@WalterBright
Copy link
Member

By removing several fields, it's become rather useless. I put those stats in there because they were useful for debugging and tuning the implementation.

@mihails-strasuns
Copy link
Contributor Author

Please discuss / agree on it with @MartinNowak as it was his suggestion. I personally don't care which field set it is as longas current 2 are present.

@mihails-strasuns
Copy link
Contributor Author

Original bugzilla issue : https://issues.dlang.org/show_bug.cgi?id=16019

@MartinNowak
Copy link
Member

By removing several fields, it's become rather useless. I put those stats in there because they were useful for debugging and tuning the implementation.

Those are not portable to other GCs, not even to the already planned GC changes. We want to get rid of pools and move the freelists to thread local caches.
This coarse API is intended for programs to monitor GC usage, not for GC implementors to debug their code.
If you want implementation specific stats from the GC, you can already use --DRT-gcopt=profile:2.

/// total size of GC heap
size_t heapsize;
/// free bytes on the GC heap (might only get updated after a collection)
size_t freesize;

Choose a reason for hiding this comment

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

Any reason for the alllowercase? Since we are adding something new, we might follow the current style guide, right?

@mihails-strasuns
Copy link
Contributor Author

Ping

@@ -1214,7 +1214,7 @@ class ConservativeGC : GC
size_t bsize = 0;

//debug(PRINTF) printf("getStats()\n");
memset(&stats, 0, GCStats.sizeof);
memset(&stats, 0, core.memory.GC.Stats.sizeof);
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: remove the memset because it is redundant for out parameters. (See https://dlang.org/spec/function.html#parameters)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a bad idea to put unrelated changes in pull requests. Please open a new one.

@MartinNowak
Copy link
Member

Some improvements in https://github.com/Dicebot/druntime/pull/1.

Dicebot added 4 commits July 19, 2016 04:59
Before making stats struct and thus standardizing it, field set
it defines has to be reduced to minimal amount meaningful to
any GC implementation.
@mihails-strasuns
Copy link
Contributor Author

Picked changes from @MartinNowak and rebased. Also checked it on simple allocating apps, reported stats match expectations exactly.

@PetarKirov
Copy link
Member

Does it make sense to add a test for this in https://github.com/dlang/druntime/tree/master/test? Perhaps in a separate PR?

@MartinNowak
Copy link
Member

Does it make sense to add a test for this in https://github.com/dlang/druntime/tree/master/test? Perhaps in a separate PR?

Writing a test makes sense, but it shouldn't be too sensitive to different values getting reported.

@MartinNowak
Copy link
Member

Auto-merge toggled on

@mihails-strasuns-sociomantic
Copy link
Contributor

Yeah I am not sure what exactly to test as the stats are supposed to show GC internal memory data, not match exactly allocation volume from the user code. Checking that used stats increase somewhat if GC allocation happens is pretty much only reliable thing.

@MartinNowak MartinNowak merged commit 7414b4e into dlang:master Jul 19, 2016
@mihails-strasuns
Copy link
Contributor Author

Oh, almost forgot about it - where should I submit release note update PR?

@schveiguy
Copy link
Member

where should I submit release note update PR

If you close the bugzilla issue, it will automatically get included in the changelog. If you want to make a more detailed entry in the changelog, update the changelog.dd file in this repo.

mihails-strasuns-sociomantic pushed a commit to mihails-strasuns-sociomantic/druntime that referenced this pull request May 13, 2017
mihails-strasuns-sociomantic pushed a commit to mihails-strasuns-sociomantic/druntime that referenced this pull request Nov 17, 2017
mihails-strasuns-sociomantic pushed a commit to mihails-strasuns-sociomantic/druntime that referenced this pull request Mar 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants