1 /*
2 * Inkscape::Debug::GCHeap - heap statistics for libgc heap
3 *
4 * Authors:
5 * MenTaLguY <mental@rydia.net>
6 *
7 * Copyright (C) 2004 MenTaLguY
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
12 #ifndef SEEN_INKSCAPE_DEBUG_GC_HEAP_H
13 #define SEEN_INKSCAPE_DEBUG_GC_HEAP_H
15 #include "gc-core.h"
16 #include "debug/heap.h"
18 namespace Inkscape {
19 namespace Debug {
21 class GCHeap : public Debug::Heap {
22 public:
23 int features() const {
24 return SIZE_AVAILABLE | USED_AVAILABLE | GARBAGE_COLLECTED;
25 }
26 Util::shared_ptr<char> name() const {
27 return Util::share_static("libgc");
28 }
29 Heap::Stats stats() const {
30 Stats stats;
31 stats.size = GC::Core::get_heap_size();
32 stats.bytes_used = stats.size - GC::Core::get_free_bytes();
33 return stats;
34 }
35 void force_collect() { GC::Core::gcollect(); }
36 };
38 }
39 }
41 #endif
43 /*
44 Local Variables:
45 mode:c++
46 c-file-style:"stroustrup"
47 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
48 indent-tabs-mode:nil
49 fill-column:99
50 End:
51 */
52 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :