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

*** 109,148 **** --- 109,148 ---- } } return result; } ! private static Long getGCIdFromEvent(FLREvent e) throws Exception { ! return (Long) e.getValue("gcId"); ! private static Integer getGCIdFromEvent(FLREvent e) throws Exception { ! return (Integer) e.getValue("gcId"); } ! private static List<FLREvent> filterRefProcEventsByGcId(List<FLREvent> events, Long id) ! private static List<FLREvent> filterRefProcEventsByGcId(List<FLREvent> events, Integer id) throws Exception { List<FLREvent> result = new ArrayList<FLREvent>(); for (FLREvent e : events) { if (getGCIdFromEvent(e).equals(id)) { result.add(e); } } return result; } ! private static List<Long> mapGCEventsToIds(List<FLREvent> events) throws Exception { ! List<Long> gcIds = new ArrayList<Long>(); ! private static List<Integer> mapGCEventsToIds(List<FLREvent> events) throws Exception { ! List<Integer> gcIds = new ArrayList<Integer>(); for (FLREvent e : events) { gcIds.add(getGCIdFromEvent(e)); } return gcIds; } private static List<List<FLREvent>> groupRefStatEventsByGCId(List<FLREvent> allEvents, List<FLREvent> gcEvents) throws Exception { ! List<Long> gcIds = mapGCEventsToIds(gcEvents); ! List<Integer> gcIds = mapGCEventsToIds(gcEvents); List<FLREvent> refProcEvents = filterEventsOnPath(allEvents, refStatsEventPath); List<List<FLREvent>> result = new ArrayList<List<FLREvent>>(); ! for (Long l : gcIds) { ! List<FLREvent> events = filterRefProcEventsByGcId(refProcEvents, l); ! for (Integer id : gcIds) { ! List<FLREvent> events = filterRefProcEventsByGcId(refProcEvents, id); if (events.size() > 0) { result.add(events); } } return result;
*** 151,171 **** --- 151,171 ---- private static String referenceType(FLREvent e) throws Exception { FLRStruct s = (FLRStruct) e.getResolvedValue("type"); return (String) s.getValue("type"); } ! private static void assertReferenceType(HashSet<String> types, String type, Long gcId) ! private static void assertReferenceType(HashSet<String> types, String type, Integer gcId) throws Exception { assertTrue(types.contains(type + " reference"), "Expected " + refStatsEventPath + " event with type " + type + " reference for gc with id " + gcId); assertNE(gcId, -1, "Expected " + refStatsEventPath + " to have a gcId"); } private static void verifyRefStatEvents(List<FLREvent> events) throws Exception { HashSet<String> types = new HashSet<String>(); ! long gcId = -1; ! int gcId = -1; for (FLREvent e : events) { types.add(referenceType(e)); gcId = getGCIdFromEvent(e); // all the event should have the same gcId } assertReferenceType(types, "Soft", gcId);
*** 185,197 **** --- 185,197 ---- return events; } List<FLREvent> gcEvents = filterEventsOnPath(events, gcEventPath); ! List<Long> gcIds = mapGCEventsToIds(gcEvents); ! Long largestGCId = 0L; ! for (Long gcId : gcIds) { ! List<Integer> gcIds = mapGCEventsToIds(gcEvents); ! Integer largestGCId = 0; ! for (Integer gcId : gcIds) { if (gcId > largestGCId) { largestGCId = gcId; } }

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