com/oracle/jfr/gc/TestObjectCountAfterGCEvent.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/com/oracle/jfr/gc/TestObjectCountAfterGCEvent.java	Thu May  2 15:03:59 2013
--- new/com/oracle/jfr/gc/TestObjectCountAfterGCEvent.java	Thu May  2 15:03:58 2013

*** 64,74 **** --- 64,74 ---- List<FLREvent> gcEvents = selectGCEventsWithName(allEvents, gcName); assertNotEmpty(gcEvents, "Expected at least one " + gcEventPath + " event"); ! Set<Long> gcIds = new HashSet<>(); ! Set<Integer> gcIds = new HashSet<>(); gcIds.addAll(gcIdsFromEvents(gcEvents)); List<FLREvent> objectCountEvents = selectEventsWithPath(allEvents, objectCountEventPath); assertNotEmpty(gcEvents, "Expected at least one " + objectCountEventPath + " event");
*** 86,96 **** --- 86,96 ---- } finally { r.close(); } } ! private static List<FLREvent> selectObjectCountEventsWithIds(List<FLREvent> events, Set<Long> gcIds) ! private static List<FLREvent> selectObjectCountEventsWithIds(List<FLREvent> events, Set<Integer> gcIds) throws Exception { List<FLREvent> selected = new ArrayList<FLREvent>(); for (FLREvent e : events) { if (gcIds.contains(getGCIdFromEvent(e))) { selected.add(e);
*** 129,143 **** --- 129,143 ---- return selection; } private static List<FLREvent> removeEventsFromUnfinishedCMS(List<FLREvent> events) throws Exception { ! List<Long> additionalGCIds = gcIdsNotPresentInCollectionEvents(events); ! List<Integer> additionalGCIds = gcIdsNotPresentInCollectionEvents(events); StringBuilder msg = new StringBuilder(); msg.append('['); ! for (Long gcId : additionalGCIds) { ! for (Integer gcId : additionalGCIds) { msg.append(" " + gcId); } msg.append(" ]"); assertLE(additionalGCIds.size(), 1, "Expected at most one additional gcId from a concurrent CMS, but got " + msg.toString());
*** 147,183 **** --- 147,183 ---- } return removeEventsWithGCId(events, additionalGCIds.get(0)); } ! private static List<Long> gcIdsNotPresentInCollectionEvents(List<FLREvent> events) ! private static List<Integer> gcIdsNotPresentInCollectionEvents(List<FLREvent> events) throws Exception { List<FLREvent> gcEvents = selectEventsWithPath(events, "vm/gc/collector/garbage_collection"); ! List<Long> gcIds = gcIdsFromEvents(gcEvents); ! List<Integer> gcIds = gcIdsFromEvents(gcEvents); List<FLREvent> gcPhases = selectEventsWithPathPrefix(events, "vm/gc/phases"); ! Set<Long> phaseIds = new HashSet<Long>(); ! Set<Integer> phaseIds = new HashSet<Integer>(); phaseIds.addAll(gcIdsFromEvents(gcPhases)); ! for (Long gcId : gcIds) { ! for (Integer gcId : gcIds) { phaseIds.remove(gcId); } ! return Arrays.asList(phaseIds.toArray(new Long[phaseIds.size()])); ! return Arrays.asList(phaseIds.toArray(new Integer[phaseIds.size()])); } ! public static List<Long> gcIdsFromEvents(List<FLREvent> events) ! public static List<Integer> gcIdsFromEvents(List<FLREvent> events) throws Exception { ! List<Long> gcIds = new ArrayList<>(); ! List<Integer> gcIds = new ArrayList<>(); for (FLREvent e : events) { if (hasGCId(e)) { gcIds.add(getGCIdFromEvent(e)); } } return gcIds; } ! private static List<FLREvent> removeEventsWithGCId(List<FLREvent> events, Long gcId) ! private static List<FLREvent> removeEventsWithGCId(List<FLREvent> events, Integer gcId) throws Exception { List<FLREvent> selected = new ArrayList<FLREvent>(); for (FLREvent e : events) { if (hasGCId(e)) { if (getGCIdFromEvent(e) != gcId) {
*** 186,197 **** --- 186,197 ---- } } return selected; } ! private static Long getGCIdFromEvent(FLREvent e) { ! return (Long) e.getValue("gcId"); ! private static Integer getGCIdFromEvent(FLREvent e) { ! return (Integer) e.getValue("gcId"); } private static boolean hasGCId(FLREvent e) { try { e.getValue("gcId");
*** 225,229 **** --- 225,230 ---- } } return selected; } } +

com/oracle/jfr/gc/TestObjectCountAfterGCEvent.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File