public void ComputeResults(ICollection m_Files, Hashtable htAppBin, ICollection filters) { // First Pass Visit scan = new Visit(); scan.Collectors.Register("App", new AppCollector()); scan.Collectors.Register("CallGraph", new CallGraphCollector()); scan.DoScan(m_Files, htAppBin, filters); AppCollector appresult = (AppCollector)scan.Collectors["App"]; CallGraphCollector callgraph = (CallGraphCollector)scan.Collectors["CallGraph"]; // Code Rank foreach (NodeGraph nodeGraph in callgraph.Values) { CodeRank rank = new CodeRank(); rank.CalculateRank(nodeGraph); foreach (Node node in nodeGraph.Nodes) { try { m_dtCodeRank.Rows.Add(nodeGraph.Application, node.TypeName, node.MethodName, node.Rank); } catch (ConstraintException constraint) { Console.WriteLine(constraint.Message); } } } // App Usage foreach (AppResult app in appresult.Values) { m_dtAppStats.Rows.Add(app.AppName, app.SystemCalls.Count); } // Second Pass Visit scantype = new Visit(); scantype.Collectors.Register("Type", new TypeCollector(m_dtCodeRank)); scantype.DoScan(m_Files, htAppBin, filters); TypeCollector typeresult = (TypeCollector)scantype.Collectors["Type"]; // Type Usage + Coverage foreach (TypeResult tr in typeresult.Values) { foreach (MethodResult mr in tr.Methods.Values) { // systemType, systemMethod, methodLength, TotalUse, RankedUse, TotalAppsThatUse, Coverage m_dtResults.Rows.Add(tr.Name, mr.Name, -1, mr.MethodFrequency, mr.MethodRankedFrequency, mr.TotalAppCount, -1); } } // Join Coverage with the Usage data. JoinCoverage(); // Run Plugin Collectors. Plugins.ComputeResults(this, m_Files, htAppBin); }
public static void ComputeResults(Results results, ICollection files, Hashtable htBin ) { ArrayList customVisit = new ArrayList(); ArrayList communityVisit = new ArrayList(); foreach (AbstractPlugin plugin in plugins) { if (plugin.UsesCommunityVisitor) { communityVisit.Add(plugin); } else { customVisit.Add(plugin); } } foreach (AbstractPlugin plugin in customVisit) { plugin.ComputeResults(results, files, htBin, results.Filters); } if (communityVisit.Count > 0) { Visit visit = new Visit(); // Gather collectors from plugins. foreach (AbstractPlugin plugin in communityVisit) { visit.Collectors.Register(plugin.Name, plugin.CreateCollector()); } // Visit Assemblies. visit.DoScan(files, htBin, results.Filters); // Give Plugin results of scanning foreach (AbstractPlugin plugin in communityVisit) { plugin.SetOutputTable(visit.Collectors[plugin.Name]); } } }
public static void ComputeResults(Results results, ICollection files, Hashtable htBin) { ArrayList customVisit = new ArrayList(); ArrayList communityVisit = new ArrayList(); foreach (AbstractPlugin plugin in plugins) { if (plugin.UsesCommunityVisitor) { communityVisit.Add(plugin); } else { customVisit.Add(plugin); } } foreach (AbstractPlugin plugin in customVisit) { plugin.ComputeResults(results, files, htBin, results.Filters); } if (communityVisit.Count > 0) { Visit visit = new Visit(); // Gather collectors from plugins. foreach (AbstractPlugin plugin in communityVisit) { visit.Collectors.Register(plugin.Name, plugin.CreateCollector()); } // Visit Assemblies. visit.DoScan(files, htBin, results.Filters); // Give Plugin results of scanning foreach (AbstractPlugin plugin in communityVisit) { plugin.SetOutputTable(visit.Collectors[plugin.Name]); } } }
public void ComputeResults(ICollection m_Files, Hashtable htAppBin, ICollection filters ) { // First Pass Visit scan = new Visit(); scan.Collectors.Register("App", new AppCollector()); scan.Collectors.Register("CallGraph", new CallGraphCollector()); scan.DoScan (m_Files, htAppBin, filters); AppCollector appresult = (AppCollector)scan.Collectors["App"]; CallGraphCollector callgraph = (CallGraphCollector)scan.Collectors["CallGraph"]; // Code Rank foreach (NodeGraph nodeGraph in callgraph.Values) { CodeRank rank = new CodeRank(); rank.CalculateRank(nodeGraph); foreach (Node node in nodeGraph.Nodes) { try { m_dtCodeRank.Rows.Add(nodeGraph.Application, node.TypeName, node.MethodName, node.Rank); } catch (ConstraintException constraint) { Console.WriteLine(constraint.Message); } } } // App Usage foreach (AppResult app in appresult.Values) { m_dtAppStats.Rows.Add(app.AppName, app.SystemCalls.Count); } // Second Pass Visit scantype = new Visit(); scantype.Collectors.Register("Type", new TypeCollector( m_dtCodeRank )); scantype.DoScan( m_Files, htAppBin, filters); TypeCollector typeresult = (TypeCollector)scantype.Collectors["Type"]; // Type Usage + Coverage foreach (TypeResult tr in typeresult.Values) { foreach (MethodResult mr in tr.Methods.Values) { // systemType, systemMethod, methodLength, TotalUse, RankedUse, TotalAppsThatUse, Coverage m_dtResults.Rows.Add(tr.Name, mr.Name, -1, mr.MethodFrequency, mr.MethodRankedFrequency, mr.TotalAppCount, -1); } } // Join Coverage with the Usage data. JoinCoverage(); // Run Plugin Collectors. Plugins.ComputeResults(this, m_Files, htAppBin); }