Skip to content
Permalink
Browse files
Add cycle tool, to test the startup and shutdown cycle
  • Loading branch information
LadyCailin committed Apr 25, 2020
1 parent 1be2ece commit 33c054cd6a17abe5a5c421d90e028aac976541f3
Showing 1 changed file with 27 additions and 0 deletions.
@@ -26,6 +26,7 @@
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.environments.Environment;
import com.laytonsmith.core.environments.GlobalEnv;
import com.laytonsmith.core.exceptions.CancelCommandException;
import com.laytonsmith.core.exceptions.ConfigCompileException;
import com.laytonsmith.core.exceptions.ConfigCompileGroupException;
import com.laytonsmith.core.exceptions.ConfigRuntimeException;
@@ -1741,4 +1742,30 @@ public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exce
}

}

@tool(value = "cycle", undocumented = true)
public static class CycleMode extends AbstractCommandLineTool {

@Override
public ArgumentParser getArgumentParser() {
return ArgumentParser.GetParser()
.addDescription("Fully starts up the interpreter engine, and runs exit(0), which represents"
+ " the engine overhead. Meant for"
+ " performance testing of the engine itself. Note that the first run will install"
+ " various things, which should not be compared against second startup. In general,"
+ " you can time this command, with, for instance ");
}

@Override
public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exception {
Environment env = Static.GenerateStandaloneEnvironment(true);
try {
MethodScriptCompiler.execute("exit(0);", null, true, env, Environment.getDefaultEnvClasses(),
(output) -> {}, null, null);
} catch (CancelCommandException ex) {
//
}
}

}
}

0 comments on commit 33c054c

Please sign in to comment.