示例#1
0
		public void Add (ProjectDomStats s)
		{
			ClassEntries += s.ClassEntries;
			LoadedClasses += s.LoadedClasses;
			ReturnTypes += s.ReturnTypes;
			ReturnTypeParts += s.ReturnTypeParts;
			ClassesWithUnsharedReturnTypes += s.ClassesWithUnsharedReturnTypes;
			UnsharedReturnTypes += s.UnsharedReturnTypes;
			Parameters += s.Parameters;
			Methods += s.Methods;
			Properties += s.Properties;
			Fields += s.Fields;
			Attributes += s.Attributes;
			Events += s.Events;
			InstantiatedTypes += s.InstantiatedTypes;
		}
示例#2
0
        internal virtual ProjectDomStats GetStats()
        {
            ProjectDomStats stats = new ProjectDomStats();

            StatsVisitor v = new StatsVisitor(stats);

            v.SharedTypes = GetSharedReturnTypes().ToArray();
            foreach (IType t in instantiatedTypeCache.Values)
            {
                stats.InstantiatedTypes++;
                v.Reset();
                v.Visit(t, "Instantiated/");
                if (v.Failures.Count > 0)
                {
                    stats.UnsharedReturnTypes += v.Failures.Count;
                    stats.ClassesWithUnsharedReturnTypes++;
                }
            }
            return(stats);
        }
示例#3
0
		internal virtual ProjectDomStats GetStats ()
		{
			ProjectDomStats stats = new ProjectDomStats ();
			
			StatsVisitor v = new StatsVisitor (stats);
			v.SharedTypes = GetSharedReturnTypes ().ToArray ();
			foreach (IType t in instantiatedTypeCache.Values) {
				stats.InstantiatedTypes++;
				v.Reset ();
				v.Visit (t, "Instantiated/");
				if (v.Failures.Count > 0) {
					stats.UnsharedReturnTypes += v.Failures.Count;
					stats.ClassesWithUnsharedReturnTypes++;
				}
			}
			return stats;
		}
示例#4
0
		internal static void DumpSharedReturnTypes ()
		{
			StreamWriter w = new StreamWriter ("rt.txt");
			
			w.WriteLine ("Summary");
			w.WriteLine ("-------");
			w.WriteLine ();
			
			ProjectDomStats globalStats = new ProjectDomStats ();
			int nt = 0;
			Dictionary<string,int> count = new Dictionary<string, int> ();
			foreach (ProjectDom p in databases.Values) {
				w.WriteLine (p.GetSharedReturnTypes ().Count () + " " + p.Uri);
				ProjectDomStats stats = p.GetStats ();
				globalStats.Add (stats);
				stats.Dump (w, "  ");
				foreach (var tt in p.GetSharedReturnTypes ().Select (tt => tt.ToInvariantString ())) {
					int c;
					count.TryGetValue (tt, out c);
					count [tt] = c + 1;
					nt++;
				}
			}
			
			w.WriteLine ();
			w.WriteLine ("Totals");
			w.WriteLine ("------");
			w.WriteLine ();
			
			w.WriteLine ("Total databases: " + databases.Count);
			w.WriteLine ("Total RTs in cache: " + nt);
			w.WriteLine ("Total RTs in cache shareable: " + count.Count);
			
			globalStats.Dump (w, "");
			
			w.WriteLine ();
			w.WriteLine ("Detail");
			w.WriteLine ("------");
			w.WriteLine ();
			
			foreach (ProjectDom p in databases.Values) {
				w.WriteLine ("### " + p.Uri);
				List<string> ts = new List<string> (p.GetSharedReturnTypes ().Select (tt => tt.ToInvariantString ()));
				ts.Sort ();
				w.WriteLine ("Total: " + ts.Count);
				foreach (var tt in ts)
					w.WriteLine (tt);
				w.WriteLine ();
			}
			
			w.WriteLine ("@@@ Summary");
			List<KeyValuePair<string,int>> names = new List<KeyValuePair<string, int>> (count);
			names.Sort ((a,b) => a.Value != b.Value ? a.Value.CompareTo(b.Value) : a.Key.CompareTo(b.Key));
			w.WriteLine ("Total: " + names.Count);
			foreach (var tt in names)
				w.WriteLine (tt.Value + "\t" + tt.Key);
			w.Close ();
		}
示例#5
0
        internal static void DumpSharedReturnTypes()
        {
            StreamWriter w = new StreamWriter("rt.txt");

            w.WriteLine("Summary");
            w.WriteLine("-------");
            w.WriteLine();

            ProjectDomStats          globalStats = new ProjectDomStats();
            int                      nt          = 0;
            Dictionary <string, int> count       = new Dictionary <string, int> ();

            foreach (ProjectDom p in databases.Values)
            {
                w.WriteLine(p.GetSharedReturnTypes().Count() + " " + p.Uri);
                ProjectDomStats stats = p.GetStats();
                globalStats.Add(stats);
                stats.Dump(w, "  ");
                foreach (var tt in p.GetSharedReturnTypes().Select(tt => tt.ToInvariantString()))
                {
                    int c;
                    count.TryGetValue(tt, out c);
                    count [tt] = c + 1;
                    nt++;
                }
            }

            w.WriteLine();
            w.WriteLine("Totals");
            w.WriteLine("------");
            w.WriteLine();

            w.WriteLine("Total databases: " + databases.Count);
            w.WriteLine("Total RTs in cache: " + nt);
            w.WriteLine("Total RTs in cache shareable: " + count.Count);

            globalStats.Dump(w, "");

            w.WriteLine();
            w.WriteLine("Detail");
            w.WriteLine("------");
            w.WriteLine();

            foreach (ProjectDom p in databases.Values)
            {
                w.WriteLine("### " + p.Uri);
                List <string> ts = new List <string> (p.GetSharedReturnTypes().Select(tt => tt.ToInvariantString()));
                ts.Sort();
                w.WriteLine("Total: " + ts.Count);
                foreach (var tt in ts)
                {
                    w.WriteLine(tt);
                }
                w.WriteLine();
            }

            w.WriteLine("@@@ Summary");
            List <KeyValuePair <string, int> > names = new List <KeyValuePair <string, int> > (count);

            names.Sort((a, b) => a.Value != b.Value ? a.Value.CompareTo(b.Value) : a.Key.CompareTo(b.Key));
            w.WriteLine("Total: " + names.Count);
            foreach (var tt in names)
            {
                w.WriteLine(tt.Value + "\t" + tt.Key);
            }
            w.Close();
        }