/* * Update the tree for a given trace */ private void updateStats(Map<String, Long> eventsPerType) { final TmfStatisticsTree statsData = TmfStatisticsTreeManager.getStatTree(fViewer.getTreeID()); if (statsData == null) { /* The stat tree has been disposed, abort mission. */ return; } Map<String, Long> map = eventsPerType; String name = fJobTrace.getName(); /** * * * <pre> * "Global", "partial", "total", etc., it's all very confusing... * * The base view shows the total count for the trace and for * each even types, organized in columns like this: * * | Global | Time range | * trace name | A | B | * Event Type | | | * <event 1> | C | D | * <event 2> | ... | ... | * ... | | | * * Here, we called the cells like this: * A : GlobalTotal * B : TimeRangeTotal * C : GlobalTypeCount(s) * D : TimeRangeTypeCount(s) * </pre> */ /* Fill in an the event counts (either cells C or D) */ for (Map.Entry<String, Long> entry : map.entrySet()) { statsData.setTypeCount(name, entry.getKey(), fIsGlobal, entry.getValue()); } /* * Calculate the totals (cell A or B, depending if isGlobal). We will * use the results of the previous request instead of sending another * one. */ long globalTotal = 0; for (long val : map.values()) { globalTotal += val; } /* Update both the tree model and the piechart model */ statsData.setTotal(name, fIsGlobal, globalTotal); TmfPieChartStatisticsModel model = fViewer.getPieChartModel(); if (model != null) { model.setPieChartTypeCount(fIsGlobal, fJobTrace, eventsPerType); } /* notify that the viewer needs to be refreshed */ fViewer.modelComplete(fIsGlobal); }