diff --git a/src/IllimaniProfiler/IllAbstractExporter.class.st b/src/IllimaniProfiler/IllAbstractExporter.class.st index 74a294c..f7be2eb 100644 --- a/src/IllimaniProfiler/IllAbstractExporter.class.st +++ b/src/IllimaniProfiler/IllAbstractExporter.class.st @@ -11,9 +11,13 @@ Class { } { #category : 'exporting' } -IllAbstractExporter >> exportAllocationModelCollection: fileName [ +IllAbstractExporter >> exportAllocationModelCollection [ - | writeStream writer | + | writeStream writer fileName | + + baseFileName ifNil: [ baseFileName := self fileNameToExport ]. + fileName := baseFileName , '.csv'. + writeStream := fileName asFileReference createFile writeStream. writer := (NeoCSVWriter on: writeStream) writeHeader: self headerOfAllocationModel; @@ -31,8 +35,8 @@ IllAbstractExporter >> exportData [ baseFileName := self fileNameToExport. - self exportMetaData: baseFileName , '.json'. - self exportAllocationModelCollection: baseFileName , '.csv'. + self exportMetaData. + self exportAllocationModelCollection. self exportGCActivity ] @@ -43,15 +47,23 @@ IllAbstractExporter >> exportGCActivity [ ] { #category : 'exporting' } -IllAbstractExporter >> exportMetaData: fileName [ +IllAbstractExporter >> exportMetaData [ + + | tempDict jsonString writeStream avgLifetimes fileName | + + baseFileName ifNil: [ baseFileName := self fileNameToExport ]. + fileName := baseFileName , '.json'. + + avgLifetimes := ((profiler objectAllocations sum: #lifetime) + / profiler objectAllocations size) asFloat. - | tempDict jsonString writeStream | tempDict := { ('totalExecutionTime' -> profiler totalTime). ('totalFullGCs' -> profiler totalFullGCs). ('profiledCode' -> profiler profiledCode). ('totalScavenges' -> profiler totalScavenges). ('samplingRate' -> profiler samplingRate). - ('profiler' -> profiler class name) } asDictionary. + ('profiler' -> profiler class name). + ('averageLifetimes' -> avgLifetimes) } asDictionary. jsonString := NeoJSONWriter toStringPretty: tempDict. writeStream := fileName asFileReference createFile writeStream. diff --git a/src/IllimaniProfiler/IllAbstractProfiler.class.st b/src/IllimaniProfiler/IllAbstractProfiler.class.st index bd9fc11..49aacd7 100644 --- a/src/IllimaniProfiler/IllAbstractProfiler.class.st +++ b/src/IllimaniProfiler/IllAbstractProfiler.class.st @@ -58,10 +58,18 @@ IllAbstractProfiler >> beginningOfProfilingTime [ { #category : 'exporting' } IllAbstractProfiler >> exportData [ + "This exports BOTH the metadata AND the raw allocations" (self exporterClass on: self) exportData ] +{ #category : 'exporting' } +IllAbstractProfiler >> exportMetaData [ + "This exports ONLY the medata data, not the raw allocations" + + (self exporterClass on: self) exportMetaData +] + { #category : 'exporting' } IllAbstractProfiler >> exporterClass [