Debian Codegraph @

native/common/include/jp_gc.h

raw symbols SCIP
1 /*****************************************************************************
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 See NOTICE file for details.
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 * Called when Python starts it Garbage collector
42 */
43 void onStart();
44
45 /**
46 * Called when Python finishes it Garbage collector
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 /* JP_GC_H */