0
@@ -96,6 +96,7 @@ import org.jruby.javasupport.JavaSupport;
0
import org.jruby.management.BeanManager;
0
import org.jruby.management.ClassCache;
0
import org.jruby.management.Config;
0
+import org.jruby.management.ParserStats;
0
import org.jruby.parser.Parser;
0
import org.jruby.parser.ParserConfiguration;
0
import org.jruby.runtime.Binding;
0
@@ -205,8 +206,10 @@ public final class Ruby {
0
this.kcode = config.getKCode();
0
this.beanManager = new BeanManager(this, config.isManagementEnabled());
0
this.jitCompiler = new JITCompiler(this);
0
+ this.parserStats = new ParserStats(this);
0
this.beanManager.register(new Config(this));
0
+ this.beanManager.register(parserStats);
0
this.beanManager.register(new ClassCache(this));
0
this.cacheMap = new CacheMap(this);
0
@@ -566,6 +569,10 @@ public final class Ruby {
0
return (IRubyObject) rj.getValue();
0
+ public Parser getParser() {
0
public BeanManager getBeanManager() {
0
@@ -1899,10 +1906,12 @@ public final class Ruby {
0
public Node parseFile(InputStream in, String file, DynamicScope scope) {
0
+ if (parserStats != null) parserStats.addLoadParse();
0
return parser.parse(file, in, scope, new ParserConfiguration(0, false, false, true));
0
public Node parseInline(InputStream in, String file, DynamicScope scope) {
0
+ if (parserStats != null) parserStats.addEvalParse();
0
return parser.parse(file, in, scope, new ParserConfiguration(0, false, true));
0
@@ -1915,10 +1924,12 @@ public final class Ruby {
0
bytes = content.getBytes();
0
+ if (parserStats != null) parserStats.addEvalParse();
0
return parser.parse(file, new ByteArrayInputStream(bytes), scope,
0
new ParserConfiguration(lineNumber, false));
0
public Node parse(String content, String file, DynamicScope scope, int lineNumber,
0
boolean extraPositionInformation) {
0
@@ -1934,11 +1945,13 @@ public final class Ruby {
0
public Node parseEval(ByteList content, String file, DynamicScope scope, int lineNumber) {
0
+ if (parserStats != null) parserStats.addEvalParse();
0
return parser.parse(file, content, scope, new ParserConfiguration(lineNumber, false));
0
public Node parse(ByteList content, String file, DynamicScope scope, int lineNumber,
0
boolean extraPositionInformation) {
0
+ if (parserStats != null) parserStats.addJRubyModuleParse();
0
return parser.parse(file, content, scope,
0
new ParserConfiguration(lineNumber, extraPositionInformation, false));
0
@@ -2340,6 +2353,7 @@ public final class Ruby {
0
getBeanManager().unregisterCompiler();
0
getBeanManager().unregisterConfig();
0
+ getBeanManager().unregisterParserStats();
0
getBeanManager().unregisterClassCache();
0
getBeanManager().unregisterMethodCache();
0
@@ -2976,6 +2990,9 @@ public final class Ruby {
0
// Management/monitoring
0
private BeanManager beanManager;
0
+ private ParserStats parserStats;
0
private final JITCompiler jitCompiler;