the file is in dmd-v2.023/src/druntime/src/gc/basic/gcstats.d
and declared: module gc.gcstats;
However, if I do:
import gc.gcstats;
dmd says: module gcstats cannot read file 'gc/gcstats.d'
if I do:
import gcstats;
dmd says: module gcstats cannot read file 'gcstats.d'
So how do I import gcstats?
Comment #1 by someanon — 2009-01-15T17:10:21Z
and more fun:
previously I call: std.gc.getStats(...);
according to: http://digitalmars.com/d/2.0/changelog.html#new2_020
from to
std.gc.*() memory.gc_*()
I tried: memory.gc_getStats(gs);
it says: Error: undefined identifier memory
I tried: core.memory.gc_getStats(gs);
it says: Error: undefined identifier module memory.gc_getStats
I tried: core.memory.gc.getStats(gs);
it says: Error: undefined identifier module memory.gc
I tried: core.memory.getStats(gs);
it says: Error: undefined identifier module memory.getStats
Come on!!!!! is the release package really tested? or the doc accurate at all?
Comment #2 by sean — 2009-01-16T11:23:07Z
Since that module isn't in the import directory, it should be clear that it's not intended to be externally visible. GC stats have yet to be formally defined in druntime, so there is no public interface for accessing them. You can obtain them manually via:
struct GCStats
{
size_t poolsize; // total size of pool
size_t usedsize; // bytes allocated
size_t freeblocks; // number of blocks marked FREE
size_t freelistsize; // total of memory on free lists
size_t pageblocks; // number of blocks marked PAGE
}
extern (C) GCStats gc_stats();
auto s = gc_stats();
But be aware that the structure of GCStats may change.
Comment #3 by yebblies — 2011-06-10T07:17:24Z
The package.module now matches the directory and file name, so this would work if you added the right directories to the import path.