Skip to content
Snippets Groups Projects
Commit 21f3d1e1 authored by Jesper's avatar Jesper
Browse files

Improve statistics output

Improved output of --statistics option:

* List all classes in CSV (added non-grammar classes).
* Added is_ast column (TRUE/FALSE) for discriminating AST classes from non-grammar classes.
* Added columns for refined syns, inhs, and ITDs (refinedsyn, refinedinh, refineditd).
parent dc4c72db
No related branches found
No related tags found
No related merge requests found
......@@ -473,6 +473,7 @@ public aspect Attributes {
}
}
public int TypeDecl.numRefinedSynEqs = 0;
public Collection<SynEq> TypeDecl.refinedSynEqs = new LinkedList<SynEq>();
public void Grammar.addRefinedSynEq(String name, String className,
......@@ -492,6 +493,7 @@ public aspect Attributes {
equ.setComment(Unparser.unparseComment(node));
equ.setAspectName(declaredAspect);
c.refinedSynEqs.add(equ);
c.numRefinedSynEqs += 1;
} else {
error("can not add equation for synthesized attribute " + name + " to unknown class "
+ className, fileName, startLine);
......@@ -599,6 +601,7 @@ public aspect Attributes {
equ.setAspectName(refinedEqu.getAspectName());
}
public int TypeDecl.numRefinedInhEqs = 0;
public Collection<InhEq> TypeDecl.refinedInhEqs = new LinkedList<InhEq>();
public void Grammar.addRefinedInhEq(String childName, String name, String className,
......@@ -630,6 +633,7 @@ public aspect Attributes {
equ.setIndex(p);
}
c.refinedInhEqs.add(equ); // Sort in alphabetical order, then non-NTAs first.
c.numRefinedInhEqs += 1;
} else {
error("can not add equation for inherited attribute " + name + " to unknown class "
+ className, fileName, startLine);
......@@ -734,6 +738,7 @@ public aspect Attributes {
equ.setAspectName(refinedEqu.getAspectName());
}
public int TypeDecl.numRefinedCBDecls = 0;
public Collection<ClassBodyObject> TypeDecl.refinedClassBodyDecls =
new LinkedList<ClassBodyObject>();
......@@ -744,6 +749,7 @@ public aspect Attributes {
ClassBodyObject o = new ClassBodyObject(n, fileName, n.firstToken.beginLine, declaredAspect);
o.refinesAspect = aspectName;
c.refinedClassBodyDecls.add(o);
c.numRefinedCBDecls += 1;
} else {
error("can not add member to unknown class " + className + " in " + fileName);
}
......
......@@ -148,7 +148,7 @@ aspect JastAddCodeGen {
System.out.println("Writing attribute statistics to " + filename);
File csv = new File(filename);
PrintStream out = new PrintStream(new FileOutputStream(csv));
out.println("node,syndecl,syneq,inhdecl,inheq,colldecl,colleq");
out.println("node,is_ast,syndecl,syneq,inhdecl,inheq,colldecl,colleq,refinesyn,refineinh,refineitd");
for (TypeDecl type : getTypeDeclList()) {
type.writeStatistics(out);
}
......@@ -156,13 +156,23 @@ aspect JastAddCodeGen {
}
public void TypeDecl.writeStatistics(PrintStream out) {
out.format("%s,FALSE,%d,%d,%d,%d,%d,%d,%d,%d,%d%n", name(),
synDecls().getNumChild(), getNumSynEq(),
getNumInhDecl(), inhAttrSet().size(),
getNumCollDecl(), 0,
numRefinedSynEqs,
numRefinedInhEqs,
numRefinedCBDecls);
}
public void ASTDecl.writeStatistics(PrintStream out) {
out.format("%s,%d,%d,%d,%d,%d,%d%n", name(),
out.format("%s,TRUE,%d,%d,%d,%d,%d,%d,%d,%d,%d%n", name(),
synDecls().getNumChild(), getNumSynEq(),
getNumInhDecl(), inhAttrSet().size(),
getNumCollDecl(), getNumCollEq());
getNumCollDecl(), getNumCollEq(),
numRefinedSynEqs,
numRefinedInhEqs,
numRefinedCBDecls);
}
public String TypeDecl.modifiers = "";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment