14 * Description: Definitions for the class AllocInfo |
14 * Description: Definitions for the class AllocInfo |
15 * |
15 * |
16 */ |
16 */ |
17 package com.nokia.s60tools.analyzetool.engine.statistic; |
17 package com.nokia.s60tools.analyzetool.engine.statistic; |
18 |
18 |
19 |
|
20 |
|
21 /** |
19 /** |
22 * Class holds information of one memory allocation |
20 * Class holds information of one memory allocation |
|
21 * |
23 * @author kihe |
22 * @author kihe |
24 * |
23 * |
25 */ |
24 */ |
26 public class AllocInfo extends BaseInfo { |
25 public class AllocInfo extends BaseInfo { |
27 |
26 |
28 /** |
27 /** |
29 * Constructor |
28 * Constructor |
30 * @param memoryAddress memory address for this allocation |
29 * |
|
30 * @param memoryAddress |
|
31 * memory address for this allocation |
31 */ |
32 */ |
32 public AllocInfo(String memoryAddress) { |
33 public AllocInfo(String memoryAddress) { |
33 super(memoryAddress); |
34 super(memoryAddress); |
34 } |
35 } |
35 |
36 |
36 private FreeInfo freedBy = null; |
37 private FreeInfo freedBy = null; |
37 |
38 |
38 /** |
39 /** |
39 * set this allocation as freed by the provide FreeInfo |
40 * set this allocation as freed by the provided FreeInfo |
|
41 * |
40 * @param info |
42 * @param info |
41 */ |
43 */ |
42 public void setFreedBy(FreeInfo info) { |
44 public void setFreedBy(FreeInfo info) { |
43 this.freedBy =info; |
45 this.freedBy = info; |
44 } |
46 } |
45 |
47 |
46 /** |
48 /** |
47 * get the FreeInfo that freed this allocation |
49 * get the FreeInfo that freed this allocation |
|
50 * |
48 * @return a FreeInfo or null |
51 * @return a FreeInfo or null |
49 */ |
52 */ |
50 public FreeInfo getFreedBy() { |
53 public FreeInfo getFreedBy() { |
51 return this.freedBy; |
54 return this.freedBy; |
52 } |
55 } |
53 |
56 |
54 /** |
57 /** |
55 * is this allocation freed |
58 * is this allocation freed |
|
59 * |
56 * @return boolean true/false |
60 * @return boolean true/false |
57 */ |
61 */ |
58 public boolean isFreed() { |
62 public boolean isFreed() { |
59 return this.freedBy != null; |
63 return this.freedBy != null; |
60 } |
64 } |
61 |
65 |
62 @Override |
66 @Override |
63 public String toString() { |
67 public String toString() { |
64 return String.format("AllocInfo [%s freedBy=[%s]]", super.toString(), freedByToString()); |
68 return String.format("AllocInfo [%s freedBy=[%s]]", super.toString(), |
|
69 freedByToString()); |
65 } |
70 } |
66 |
71 |
67 private String freedByToString(){ |
72 private String freedByToString() { |
68 if (freedBy == null){ |
73 if (freedBy == null) { |
69 return "null"; |
74 return "null"; |
70 } |
75 } |
71 |
76 |
72 return String.format("addr=0x%08X time=%s", freedBy.getMemoryAddress(), freedBy.getTime()); |
77 return String.format("addr=0x%08X time=%s", freedBy.getMemoryAddress(), |
|
78 freedBy.getTime()); |
73 } |
79 } |
74 } |
80 } |