~yrke/tapaal/removeNetType

« back to all changes in this revision

Viewing changes to src/dk/aau/cs/util/MemoryMonitor.java

MergedĀ lp:~yrke/tapaal/testbranch-syntaxOnlyChanges

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
public class MemoryMonitor {
16
16
 
17
 
        static interface Kernel32 extends Library {
 
17
        interface Kernel32 extends Library {
18
18
 
19
19
                static Kernel32 INSTANCE = Native.loadLibrary("kernel32", Kernel32.class);
20
20
 
112
112
                        if (Platform.isWindows()) {
113
113
                                f = p.getClass().getDeclaredField("handle");
114
114
                                f.setAccessible(true);
115
 
                                int pid = Kernel32.INSTANCE.GetProcessId((Long) f.get(p));
116
 
                                return pid;
 
115
                return Kernel32.INSTANCE.GetProcessId((Long) f.get(p));
117
116
                        } else {
118
117
                                f = p.getClass().getDeclaredField("pid");
119
118
                                f.setAccessible(true);
120
 
                                int pid = (Integer) f.get(p);
121
 
                                return pid;
 
119
                return (int) (Integer) f.get(p);
122
120
                        }
123
121
                }catch(Exception e){
124
122
                        return -1;