EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.measurement.strategies.activeresource.cpu]

COVERAGE SUMMARY FOR SOURCE FILE [MandelbrotDemand.java]

nameclass, %method, %block, %line, %
MandelbrotDemand.java0%   (0/1)0%   (0/7)0%   (0/110)0%   (0/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MandelbrotDemand0%   (0/1)0%   (0/7)0%   (0/110)0%   (0/30)
MandelbrotDemand (): void 0%   (0/1)0%   (0/14)0%   (0/4)
cleanup (): void 0%   (0/1)0%   (0/1)0%   (0/1)
drawMandelbrot (long): void 0%   (0/1)0%   (0/34)0%   (0/6)
getName (): String 0%   (0/1)0%   (0/2)0%   (0/1)
getStrategysResource (): ResourceTypeEnum 0%   (0/1)0%   (0/2)0%   (0/1)
iterate (float, float): int 0%   (0/1)0%   (0/53)0%   (0/15)
run (long): void 0%   (0/1)0%   (0/4)0%   (0/2)

1package de.uka.ipd.sdq.measurement.strategies.activeresource.cpu;
2 
3import de.uka.ipd.sdq.measurement.strategies.activeresource.AbstractDemandStrategy;
4import de.uka.ipd.sdq.measurement.strategies.activeresource.ResourceTypeEnum;
5 
6public class MandelbrotDemand extends AbstractDemandStrategy {
7 
8        private int BAILOUT = 16;
9        private int MAX_ITERATIONS = 1000;
10 
11        public MandelbrotDemand() {
12                super(-2,0,2,40,20);
13        }
14 
15        private int iterate(float x, float y) {
16                float cr = y - 0.5f;
17                float ci = x;
18                float zi = 0.0f;
19                float zr = 0.0f;
20                int i = 0;
21                while (true) {
22                        i++;
23                        float temp = zr * zi;
24                        float zr2 = zr * zr;
25                        float zi2 = zi * zi;
26                        zr = zr2 - zi2 + cr;
27                        zi = temp + temp + ci;
28                        if (zi2 + zr2 > BAILOUT)
29                                return i;
30                        if (i > MAX_ITERATIONS)
31                                return 0;
32                }
33        }
34 
35        private void drawMandelbrot(long init) {
36                // Date d1 = new Date();
37                int n = (int) init;
38                float m = (float) n;
39                int x, y;
40                for (y = -n; y < n; y++) {
41                        // System.out.print("\n");
42                        for (x = -n; x < n; x++) {
43                                if (iterate(x / m, y / m) == 0) {
44                                        // System.out.print("*");
45                                } else {
46                                        // System.out.print(" ");
47                                }
48 
49                        }
50                }
51                // Date d2 = new Date();
52                // long diff = d2.getTime() - d1.getTime();
53                // System.out.println("\nJava Elapsed " + diff / 1000.0f);
54        }
55 
56        @Override
57        public void run(long initial) {
58                drawMandelbrot(initial);
59        }
60 
61        @Override
62        public ResourceTypeEnum getStrategysResource() {
63                return ResourceTypeEnum.CPU;
64        }
65 
66        @Override
67        public String getName() {
68                return "Mandelbrot";
69        }
70        
71        @Override
72        public void cleanup() {
73                // Do nothing.
74        }
75}

[all classes][de.uka.ipd.sdq.measurement.strategies.activeresource.cpu]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov