Performance report is emitted only when corresponding command-line argument is provided.
This commit is contained in:
@@ -200,15 +200,13 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
KotlinToJVMBytecodeCompiler.compileBunchOfSources(environment, jar, outputDir, arguments.includeRuntime);
|
||||
}
|
||||
|
||||
if (arguments.reportPerf) {
|
||||
PerformanceCounter.Companion.report(new Function1<String, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(String s) {
|
||||
reportPerf(environment.getConfiguration(), s);
|
||||
return Unit.INSTANCE$;
|
||||
}
|
||||
});
|
||||
}
|
||||
PerformanceCounter.Companion.report(new Function1<String, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(String s) {
|
||||
reportPerf(environment.getConfiguration(), s);
|
||||
return Unit.INSTANCE$;
|
||||
}
|
||||
});
|
||||
return OK;
|
||||
}
|
||||
catch (CompilationException e) {
|
||||
@@ -230,9 +228,11 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
}
|
||||
|
||||
public static void reportPerf(CompilerConfiguration configuration, String message) {
|
||||
MessageCollector collector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY);
|
||||
assert collector != null;
|
||||
collector.report(CompilerMessageSeverity.INFO, "PERF: " + message, CompilerMessageLocation.NO_LOCATION);
|
||||
if (configuration.get(JVMConfigurationKeys.PERFORMANCE_OUTPUT_ENABLED, false)) {
|
||||
MessageCollector collector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY);
|
||||
assert collector != null;
|
||||
collector.report(CompilerMessageSeverity.INFO, "PERF: " + message, CompilerMessageLocation.NO_LOCATION);
|
||||
}
|
||||
}
|
||||
|
||||
private static void putAdvancedOptions(@NotNull CompilerConfiguration configuration, @NotNull K2JVMCompilerArguments arguments) {
|
||||
@@ -240,6 +240,7 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
configuration.put(JVMConfigurationKeys.DISABLE_PARAM_ASSERTIONS, arguments.noParamAssertions);
|
||||
configuration.put(JVMConfigurationKeys.DISABLE_INLINE, arguments.noInline);
|
||||
configuration.put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize);
|
||||
configuration.put(JVMConfigurationKeys.PERFORMANCE_OUTPUT_ENABLED, arguments.reportPerf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,4 +50,7 @@ public class JVMConfigurationKeys {
|
||||
|
||||
public static final CompilerConfigurationKey<List<String>> MODULE_IDS =
|
||||
CompilerConfigurationKey.create("module id strings");
|
||||
|
||||
public static final CompilerConfigurationKey<Boolean> PERFORMANCE_OUTPUT_ENABLED =
|
||||
CompilerConfigurationKey.create("performance output enabled");
|
||||
}
|
||||
|
||||
+1
@@ -3,6 +3,7 @@ where advanced options include:
|
||||
-Xno-call-assertions Don't generate not-null assertion after each invocation of method returning not-null
|
||||
-Xno-param-assertions Don't generate not-null assertions on parameters of methods accessible from Java
|
||||
-Xno-optimize Disable optimizations
|
||||
-Xreport-perf Report detailed performance statistics
|
||||
-Xno-inline Disable method inlining
|
||||
-Xplugin <path> Load plugins from the given classpath
|
||||
|
||||
|
||||
Reference in New Issue
Block a user