61 testDumpAll();
62 }
63
64 private static void testHisto() throws Exception {
65 OutputAnalyzer output = jmap("-histo:");
66 output.shouldHaveExitValue(0);
67 OutputAnalyzer output1 = jmap("-histo");
68 output1.shouldHaveExitValue(0);
69 }
70
71 private static void testHistoLive() throws Exception {
72 OutputAnalyzer output = jmap("-histo:live");
73 output.shouldHaveExitValue(0);
74 }
75
76 private static void testHistoAll() throws Exception {
77 OutputAnalyzer output = jmap("-histo:all");
78 output.shouldHaveExitValue(0);
79 }
80
81 private static void testHistoToFile() throws Exception {
82 histoToFile(false);
83 }
84
85 private static void testHistoLiveToFile() throws Exception {
86 histoToFile(true);
87 }
88
89 private static void testHistoAllToFile() throws Exception {
90 boolean explicitAll = true;
91 histoToFile(false, explicitAll);
92 }
93
94 private static void histoToFile(boolean live) throws Exception {
95 boolean explicitAll = false;
96 histoToFile(live, explicitAll);
97 }
98
99 private static void histoToFile(boolean live, boolean explicitAll) throws Exception {
100 if (live == true && explicitAll == true) {
101 fail("Illegal argument setting for jmap -histo");
102 }
103 File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo");
104 if (file.exists()) {
105 file.delete();
106 }
107 OutputAnalyzer output;
108 if (live) {
109 output = jmap("-histo:live,file=" + file.getName());
110 } else if (explicitAll == true) {
111 output = jmap("-histo:all,file=" + file.getName());
112 } else {
113 output = jmap("-histo:file=" + file.getName());
114 }
115 output.shouldHaveExitValue(0);
116 output.shouldContain("Heap inspection file created");
117 file.delete();
118 }
119
120 private static void testFinalizerInfo() throws Exception {
121 OutputAnalyzer output = jmap("-finalizerinfo");
122 output.shouldHaveExitValue(0);
123 }
124
125 private static void testClstats() throws Exception {
126 OutputAnalyzer output = jmap("-clstats");
127 output.shouldHaveExitValue(0);
128 }
129
130 private static void testDump() throws Exception {
131 dump(false);
132 }
133
|
61 testDumpAll();
62 }
63
64 private static void testHisto() throws Exception {
65 OutputAnalyzer output = jmap("-histo:");
66 output.shouldHaveExitValue(0);
67 OutputAnalyzer output1 = jmap("-histo");
68 output1.shouldHaveExitValue(0);
69 }
70
71 private static void testHistoLive() throws Exception {
72 OutputAnalyzer output = jmap("-histo:live");
73 output.shouldHaveExitValue(0);
74 }
75
76 private static void testHistoAll() throws Exception {
77 OutputAnalyzer output = jmap("-histo:all");
78 output.shouldHaveExitValue(0);
79 }
80
81 private static void testHistoParallelZero() throws Exception {
82 OutputAnalyzer output = jmap("-histo:parallelThreadNum=0");
83 output.shouldHaveExitValue(0);
84 }
85
86 private static void testHistoParallel() throws Exception {
87 OutputAnalyzer output = jmap("-histo:parallelThreadNum=2");
88 output.shouldHaveExitValue(0);
89 }
90
91 private static void testHistoNonParallel() throws Exception {
92 OutputAnalyzer output = jmap("-histo:parallelThreadNum=1");
93 output.shouldHaveExitValue(0);
94 }
95
96 private static void testHistoToFile() throws Exception {
97 histoToFile(false);
98 }
99
100 private static void testHistoLiveToFile() throws Exception {
101 histoToFile(true);
102 }
103
104 private static void testHistoAllToFile() throws Exception {
105 boolean explicitAll = true;
106 histoToFile(false, explicitAll);
107 }
108
109 private static void testHistoFileParallelZero() throws Exception {
110 histoToFile(false, false, 0);
111 }
112
113 private static void testHistoFileParallel() throws Exception {
114 histoToFile(false, false, 2);
115 }
116
117 private static void testHistoFileNonParallel() throws Exception {
118 histoToFile(false, false, 1);
119 }
120
121 private static void histoToFile(boolean live) throws Exception {
122 boolean explicitAll = false;
123 histoToFile(live, explicitAll);
124 }
125
126 private static void histoToFile(boolean live, boolean explicitAll) throws Exception {
127 if (live == true && explicitAll == true) {
128 fail("Illegal argument setting for jmap -histo");
129 }
130 File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo");
131 if (file.exists()) {
132 file.delete();
133 }
134 OutputAnalyzer output;
135 if (live) {
136 output = jmap("-histo:live,file=" + file.getName());
137 } else if (explicitAll == true) {
138 output = jmap("-histo:all,file=" + file.getName());
139 } else {
140 output = jmap("-histo:file=" + file.getName());
141 }
142 output.shouldHaveExitValue(0);
143 output.shouldContain("Heap inspection file created");
144 file.delete();
145 }
146
147 private static void histoToFile(boolean live,
148 boolean explicitAll,
149 int parallelThreadNum) throws Exception {
150 String liveArg = "";
151 String fileArg = "";
152 String parArg = "parallelThreadNum=" + parallelThreadNum;
153 String allArgs = "-histo:";
154
155 if (live == true && explicitAll == true) {
156 fail("Illegal argument setting for jmap -histo");
157 }
158 if (live == true ) {
159 liveArg = "live,";
160 } else if(explicitAll) {
161 liveArg = "all,";
162 }
163
164 File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo");
165 if (file.exists()) {
166 file.delete();
167 }
168 fileArg = "file=" + file.getName();
169
170 OutputAnalyzer output;
171 allArgs = allArgs + liveArg + fileArg + "," + parArg + "";
172 if (live) {
173 output = jmap(allArgs);
174 } else if (explicitAll == true) {
175 output = jmap(allArgs);
176 } else {
177 output = jmap(allArgs);
178 }
179 output.shouldHaveExitValue(0);
180 output.shouldContain("Heap inspection file created");
181 file.delete();
182 }
183
184 private static void testFinalizerInfo() throws Exception {
185 OutputAnalyzer output = jmap("-finalizerinfo");
186 output.shouldHaveExitValue(0);
187 }
188
189 private static void testClstats() throws Exception {
190 OutputAnalyzer output = jmap("-clstats");
191 output.shouldHaveExitValue(0);
192 }
193
194 private static void testDump() throws Exception {
195 dump(false);
196 }
197
|