*/
//Finalize for threads: calculate probabilities and save
for (Map.Entry<Integer, CallGraph> entry : m_callGraphThreads.entrySet())
{
int iThreadID = entry.getKey();
CallGraph callGraph = entry.getValue();
//callGraph.onVirtualVertex("end_vertex");
callGraph.normalizeEndVertices();
callGraph.calculateTransitionProbabilities();
saveCallGraph(callGraph,Integer.toString(iThreadID));
}
//Merge threads graphs into the thread groups
for (Map.Entry<Integer, CallGraph> threadGraphEntry : m_callGraphThreads.entrySet())
{
ThreadDescriptor thread = this.m_threadSet.getThread(threadGraphEntry.getKey());
String strGroupName = thread.getGroup().getName();
CodeFragmentSet cfSetForGroup = thread.getGroup().getCodeFragmentSet();
CallGraph graphForThreadGroup = null;
try
{
graphForThreadGroup = getOrCreateGraph(strGroupName, cfSetForGroup, m_callGraphThreadGroups);
} catch (Exception e)
{
throw new RampException(String.format("Exception initializing graphs for thread group %s",
strGroupName, e));
}
graphForThreadGroup.mergeWith(threadGraphEntry.getValue());
}
//Finalize for thread groups
for (Map.Entry<String, CallGraph> entry : m_callGraphThreadGroups.entrySet())
{
String strGroupName = entry.getKey();
CallGraph callGraph = entry.getValue();
entry.getValue().calculateTransitionProbabilities();
saveCallGraph(callGraph,strGroupName);
}
}