| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#ifndef JP_GC_H |
| 17 |
#define JP_GC_H |
| 18 |
|
| 19 |
struct JPGCStats |
| 20 |
{ |
| 21 |
long long python_rss; |
| 22 |
long long java_rss; |
| 23 |
long long current_rss; |
| 24 |
long long max_rss; |
| 25 |
long long min_rss; |
| 26 |
long long python_triggered; |
| 27 |
} ; |
| 28 |
|
| 29 |
class JPGarbageCollection |
| 30 |
{ |
| 31 |
public: |
| 32 |
|
| 33 |
explicit JPGarbageCollection(); |
| 34 |
|
| 35 |
void init(JPJavaFrame& frame); |
| 36 |
|
| 37 |
void shutdown(); |
| 38 |
void triggered(); |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
void onStart(); |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
void onEnd(); |
| 49 |
|
| 50 |
void getStats(JPGCStats& stats); |
| 51 |
|
| 52 |
private: |
| 53 |
bool running; |
| 54 |
bool in_python_gc; |
| 55 |
bool java_triggered; |
| 56 |
PyObject *python_gc; |
| 57 |
jclass _SystemClass; |
| 58 |
jclass _ContextClass; |
| 59 |
jmethodID _gcMethodID; |
| 60 |
|
| 61 |
jmethodID _totalMemoryID; |
| 62 |
jmethodID _freeMemoryID; |
| 63 |
jmethodID _maxMemoryID; |
| 64 |
jmethodID _usedMemoryID; |
| 65 |
jmethodID _heapMemoryID; |
| 66 |
|
| 67 |
size_t last_python; |
| 68 |
size_t last_java; |
| 69 |
size_t low_water; |
| 70 |
size_t high_water; |
| 71 |
size_t limit; |
| 72 |
size_t last; |
| 73 |
int java_count; |
| 74 |
int python_count; |
| 75 |
int python_triggered; |
| 76 |
} ; |
| 77 |
|
| 78 |
#endif |