EMMA Coverage Report (generated Sat Aug 20 11:00:51 CDT 2011)
[all classes][tuffy.util]

COVERAGE SUMMARY FOR SOURCE FILE [DebugMan.java]

nameclass, %method, %block, %line, %
DebugMan.java100% (1/1)29%  (4/14)45%  (51/113)40%  (15.8/39)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DebugMan100% (1/1)29%  (4/14)45%  (51/113)40%  (15.8/39)
DebugMan (): void 0%   (0/1)0%   (0/3)0%   (0/1)
checkBaseMem (): void 0%   (0/1)0%   (0/3)0%   (0/2)
checkPeakMem (): void 0%   (0/1)0%   (0/9)0%   (0/4)
getBaseMem (): long 0%   (0/1)0%   (0/2)0%   (0/1)
getLog (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPeakMem (): long 0%   (0/1)0%   (0/2)0%   (0/1)
log (String): void 0%   (0/1)0%   (0/5)0%   (0/2)
pause (): void 0%   (0/1)0%   (0/12)0%   (0/4)
runningInWindows (): boolean 0%   (0/1)0%   (0/8)0%   (0/2)
usedMemory (): long 0%   (0/1)0%   (0/15)0%   (0/6)
<static initializer> 100% (1/1)100% (11/11)100% (5/5)
_runGC (): void 100% (1/1)100% (25/25)100% (8/8)
runGC (): void 100% (1/1)100% (9/9)100% (2/2)
usedMemoryp (): long 100% (1/1)100% (6/6)100% (1/1)

1package tuffy.util;
2import java.util.Scanner;
3 
4/**
5 * Container of methods for debugging purposes.
6 */
7public class DebugMan {
8        
9        private static StringBuilder log = new StringBuilder();
10 
11        public static void log(String s){
12                log.append(s);
13        }
14        
15        public static String getLog(){
16                return log.toString();
17        }
18        
19        public static void pause() {
20                System.out.println("\nPress enter to continue...");
21                Scanner in = new Scanner(System.in);
22                in.nextLine();
23        }
24        
25        public static boolean runningInWindows(){
26                String os = System.getProperty("os.name").toLowerCase();
27                return os.contains("win");
28        }
29        
30        private static final Runtime s_runtime = Runtime.getRuntime ();
31    public static void runGC() throws Exception
32    {
33        // It helps to call Runtime.gc()
34        // using several method calls:
35        for (int r = 0; r < 4; ++ r) _runGC ();
36    }
37    private static void _runGC () throws Exception
38    {
39        long usedMem1 = usedMemoryp (), usedMem2 = Long.MAX_VALUE;
40        for (int i = 0; (usedMem1 < usedMem2) && (i < 500); ++ i)
41        {
42            s_runtime.runFinalization ();
43            s_runtime.gc ();
44            Thread.yield();
45            
46            usedMem2 = usedMem1;
47            usedMem1 = usedMemoryp ();
48        }
49    }
50    
51    private static long usedMemoryp ()
52    {
53        return s_runtime.totalMemory () - s_runtime.freeMemory ();
54    }
55        
56        public static long usedMemory(){
57                try{
58                        runGC();
59                }catch(Exception e){
60                        System.err.println(e.getMessage());
61                }
62            long mem0 = Runtime.getRuntime().totalMemory() -
63              Runtime.getRuntime().freeMemory();
64            return mem0;
65        }
66        
67        static private long baseMem = 0;
68        public static void checkBaseMem(){
69                baseMem = usedMemory();
70        }
71        
72        public static long getBaseMem(){
73                return baseMem;
74        }
75        
76        
77        static private long peakMem = 0;
78        public static void checkPeakMem(){
79                long mem = usedMemory();
80                if(mem > peakMem){
81                        peakMem = mem;
82                }
83        }
84        
85        public static long getPeakMem(){
86                return peakMem;
87        }
88 
89}

[all classes][tuffy.util]
EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov