2002-02-19 Mike Kestner <mkestner@speakeasy.net>

* generator/Statistics.cs : New. Gathers stats about generation.
	* generator/*.cs : Hook in the stat counters.

svn path=/trunk/gtk-sharp/; revision=2491
This commit is contained in:
Mike Kestner 2002-02-19 03:12:47 +00:00
parent 179097cbf6
commit ede9016e25
10 changed files with 188 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2002-02-19 Mike Kestner <mkestner@speakeasy.net>
* generator/Statistics.cs : New. Gathers stats about generation.
* generator/*.cs : Hook in the stat counters.
2002-02-18 Mike Kestner <mkestner@speakeasy.net>
* generator/StructBase.cs (GenCtor): StudCapsify static method names.

View file

@ -63,16 +63,20 @@ namespace GtkSharp.Generation {
switch (node.Name) {
case "field":
Statistics.IgnoreCount++;
// GenField(member, table, sw);
break;
case "callback":
Statistics.IgnoreCount++;
break;
case "constructor":
Statistics.IgnoreCount++;
break;
case "method":
Statistics.IgnoreCount++;
break;
default:
@ -87,6 +91,7 @@ namespace GtkSharp.Generation {
sw.Flush();
sw.Close();
Statistics.BoxedCount++;
}
}
}

View file

@ -86,13 +86,14 @@ namespace GtkSharp.Generation {
if (node.Name != "member") {
continue;
}
//FIXME: Generate the methods.
//FIXME: Generate the method.
XmlElement member = (XmlElement) node;
}
sw.WriteLine ("}");
sw.Flush();
sw.Close();
Statistics.CBCount++;
}
}

View file

@ -29,6 +29,7 @@ namespace GtkSharp.Generation {
gen.Generate (table);
}
Statistics.Report();
return 0;
}

View file

@ -105,6 +105,7 @@ namespace GtkSharp.Generation {
sw.Flush();
sw.Close();
Statistics.EnumCount++;
}
}

View file

@ -95,6 +95,7 @@ namespace GtkSharp.Generation {
sw.Flush();
sw.Close();
Statistics.IFaceCount++;
}
}

View file

@ -80,12 +80,14 @@ namespace GtkSharp.Generation {
switch (node.Name) {
case "field":
Statistics.IgnoreCount++;
//if (!GenField(member, table, sw)) {
// Console.WriteLine("in object " + CName);
//}
break;
case "callback":
Statistics.IgnoreCount++;
break;
case "constructor":
@ -150,6 +152,7 @@ namespace GtkSharp.Generation {
sw.Flush();
sw.Close();
Statistics.ObjectCount++;
}
public bool GenProperty (XmlElement prop, SymbolTable table, StreamWriter sw, out String name)
@ -174,6 +177,7 @@ namespace GtkSharp.Generation {
} else if (table.IsInterface(c_type)) {
// FIXME: Handle interface props properly.
Console.Write("Interface property detected ");
Statistics.ThrottledCount++;
return true;
} else {
m_type = table.GetMarshalType(c_type);
@ -181,6 +185,7 @@ namespace GtkSharp.Generation {
if ((cs_type == "") || (m_type == "")) {
Console.Write("Property has unknown Type {0} ", c_type);
Statistics.ThrottledCount++;
return false;
}
@ -210,6 +215,7 @@ namespace GtkSharp.Generation {
sw.WriteLine("\t\t}");
sw.WriteLine();
Statistics.PropCount++;
return true;
}
@ -220,6 +226,7 @@ namespace GtkSharp.Generation {
String marsh = SignalHandler.GetName(sig, table);
if (marsh == "") {
Statistics.ThrottledCount++;
return false;
}
@ -245,6 +252,7 @@ namespace GtkSharp.Generation {
sw.WriteLine("\t\t}");
sw.WriteLine();
Statistics.SignalCount++;
return true;
}
}

153
generator/Statistics.cs Normal file
View file

@ -0,0 +1,153 @@
// Statistics.cs : Generation statistics class implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// <c> 2002 Mike Kestner
namespace GtkSharp.Generation {
using System;
using System.Collections;
public class Statistics {
static int cbs = 0;
static int enums = 0;
static int objects = 0;
static int structs = 0;
static int boxed = 0;
static int interfaces = 0;
static int methods = 0;
static int ctors = 0;
static int props = 0;
static int sigs = 0;
static int throttled = 0;
static int ignored = 0;
public static int CBCount {
get {
return cbs;
}
set {
cbs = value;
}
}
public static int EnumCount {
get {
return enums;
}
set {
enums = value;
}
}
public static int ObjectCount {
get {
return objects;
}
set {
objects = value;
}
}
public static int StructCount {
get {
return structs;
}
set {
structs = value;
}
}
public static int BoxedCount {
get {
return boxed;
}
set {
boxed = value;
}
}
public static int CtorCount {
get {
return ctors;
}
set {
ctors = value;
}
}
public static int MethodCount {
get {
return methods;
}
set {
methods = value;
}
}
public static int PropCount {
get {
return props;
}
set {
props = value;
}
}
public static int SignalCount {
get {
return sigs;
}
set {
sigs = value;
}
}
public static int IFaceCount {
get {
return interfaces;
}
set {
interfaces = value;
}
}
public static int ThrottledCount {
get {
return throttled;
}
set {
throttled = value;
}
}
public static int IgnoreCount {
get {
return ignored;
}
set {
ignored = value;
}
}
public static void Report()
{
Console.WriteLine("Generation Summary:");
Console.WriteLine("\tEnums: " + enums);
Console.WriteLine("\tStructs: " + structs);
Console.WriteLine("\tBoxed: " + boxed);
Console.WriteLine("\tInterfaces: " + interfaces);
Console.WriteLine("\tCallbacks: " + cbs);
Console.WriteLine("\tObjects: " + objects);
Console.WriteLine("\tProperties: " + props);
Console.WriteLine("\tSignals: " + sigs);
Console.WriteLine("\tMethods: " + methods);
Console.WriteLine("\tConstructors: " + ctors);
Console.WriteLine("\tThrottled: " + throttled);
Console.WriteLine("\tIgnored: " + ignored);
Console.WriteLine("Total Nodes: " + (enums+structs+boxed+interfaces+cbs+objects+props+sigs+methods+ctors+throttled+ignored));
}
}
}

View file

@ -62,6 +62,7 @@ namespace GtkSharp.Generation {
call = "(" + call + ")";
} else {
Console.Write("ctor ");
Statistics.ThrottledCount++;
return false;
}
@ -99,6 +100,7 @@ namespace GtkSharp.Generation {
sw.WriteLine("\t\t}");
sw.WriteLine();
Statistics.CtorCount++;
return true;
}
@ -117,6 +119,7 @@ namespace GtkSharp.Generation {
if (cs_type == "") {
Console.WriteLine ("Field has unknown Type {0}", c_type);
Statistics.ThrottledCount++;
return false;
}
@ -146,12 +149,14 @@ namespace GtkSharp.Generation {
call = "(Handle, " + call + ")";
} else {
Console.Write("method ");
Statistics.ThrottledCount++;
return false;
}
XmlElement ret_elem = method["return-type"];
if (ret_elem == null) {
Console.Write("Missing return type in method ");
Statistics.ThrottledCount++;
return false;
}
@ -161,6 +166,7 @@ namespace GtkSharp.Generation {
String s_ret = table.GetCSType(rettype);
if (m_ret == "" || s_ret == "") {
Console.Write("rettype: " + rettype + " method ");
Statistics.ThrottledCount++;
return false;
}
@ -184,6 +190,7 @@ namespace GtkSharp.Generation {
sw.WriteLine("\t\t}");
sw.WriteLine();
Statistics.MethodCount++;
return true;
}

View file

@ -63,16 +63,20 @@ namespace GtkSharp.Generation {
switch (node.Name) {
case "field":
Statistics.IgnoreCount++;
// GenField(member, table, sw);
break;
case "callback":
Statistics.IgnoreCount++;
break;
case "constructor":
Statistics.IgnoreCount++;
break;
case "method":
Statistics.IgnoreCount++;
break;
default:
@ -87,6 +91,7 @@ namespace GtkSharp.Generation {
sw.Flush();
sw.Close();
Statistics.StructCount++;
}
}
}