/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test Test6581734.java
* @bug 6581734
* @summary CMS Old Gen's collection usage is zero after GC which is incorrect
*
*/
// 6581734 states that memory pool usage via the mbean is wrong
// for CMS (zero, even after a collection).
//
// 6580448 states that the collection count similarly is wrong
// (stays at zero for CMS collections)
// -- closed as dup of 6581734 as the same fix resolves both.
public class Test6581734 {
Test6581734 t = null;
} else {
t = new Test6581734();
}
t.run();
}
}
public Test6581734() {
}
public void run() {
// Use some memory, enough that we expect collections should
// have happened.
// Must run with options to ensure no stop the world full GC,
// but e.g. at least one CMS cycle.
// Verify some non-zero results are stored.
int poolsFound = 0;
int poolsWithStats = 0;
poolsFound++;
if (usage > 0) {
}
}
}
if (poolsFound == 0) {
throw new RuntimeException("No matching memory pools found: test with -XX:+UseConcMarkSweepGC");
}
int collectorsFound = 0;
int collectorsWithTime= 0;
+ collector.getCollectionCount());
+ collector.getCollectionTime());
throw new RuntimeException("collection count <= 0");
}
}
}
}
// verify:
if (poolsWithStats < poolsFound) {
throw new RuntimeException("pools found with zero stats");
}
throw new RuntimeException("collectors found with zero time");
}
}
long sizeAllocated = 0;
long delay = 50;
long count = 0;
while (sizeAllocated < target) {
}
count++;
}
}
}