# Metrics from RTA
module rta_metrics
-import modelbuilder
private import rapid_type_analysis
-private import metrics_base
+import metrics_base
import mmodules_metrics
import mclasses_metrics
-import frontend
redef class ToolContext
var rta_metrics_phase: Phase = new RTAMetricsPhase(self, null)
mmetrics.register(new MNLDD(toolcontext.modelbuilder))
mmetrics.collect(new HashSet[MModule].from([mainmodule]))
mmetrics.to_console(1, not toolcontext.opt_nocolors.value)
- if csv then mmetrics.to_csv.save("{out}/{mainmodule}.csv")
+ if csv then mmetrics.to_csv.write_to_file("{out}/{mainmodule}.csv")
var mtypes = new HashSet[MType]
var analysis = new RapidTypeAnalysis(toolcontext.modelbuilder, mainmodule)
cmetrics.register(analysis.cnli)
cmetrics.register(analysis.cnlc)
cmetrics.to_console(1, not toolcontext.opt_nocolors.value)
- if csv then cmetrics.to_csv.save("{out}/mclasses.csv")
+ if csv then cmetrics.to_csv.write_to_file("{out}/mclasses.csv")
print toolcontext.format_h2("\n ## Total live instances by mtypes")
var tmetrics = new MetricSet
tmetrics.register(analysis.tnli)
tmetrics.register(analysis.tnlc)
tmetrics.to_console(1, not toolcontext.opt_nocolors.value)
- if csv then tmetrics.to_csv.save("{out}/mtypes.csv")
+ if csv then tmetrics.to_csv.write_to_file("{out}/mtypes.csv")
print toolcontext.format_h2("\n ## MType complexity")
var gmetrics = new MetricSet
gmetrics.register(new TDGS)
gmetrics.collect(mtypes)
gmetrics.to_console(1, not toolcontext.opt_nocolors.value)
- if csv then gmetrics.to_csv.save("{out}/complexity.csv")
+ if csv then gmetrics.to_csv.write_to_file("{out}/complexity.csv")
callsite_info(analysis)
# dump type and method infos
if csv then
- analysis.live_types_to_csv.save("{out}/rta_types.csv")
+ analysis.live_types_to_csv.write_to_file("{out}/rta_types.csv")
analysis.live_methods_to_tree.write_to_file("{out}/rta_methods.dat")
end
end
super
tnlc.values.inc(mtype)
- mtype = mtype.as_notnullable
+ mtype = mtype.undecorate
if mtype isa MClassType then
cnlc.values.inc(mtype.mclass)
end
redef class MType
private fun signature_depth: Int do
- var mtype = self.as_notnullable
+ var mtype = self.undecorate
if not mtype isa MGenericType then return 0
var depth = 0