Skip to content

Commit

Permalink
Improved export method and added accessors for totalFullGCs and total…
Browse files Browse the repository at this point in the history
…Scavengers
  • Loading branch information
jordanmontt committed Jan 25, 2024
1 parent 03573ff commit 1888aa4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 11 deletions.
12 changes: 12 additions & 0 deletions src/IllimaniProfiler/IllAbstractProfiler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,24 @@ IllAbstractProfiler >> stopProfiling [
self updateVMStats
]

{ #category : 'accessing - statistics' }
IllAbstractProfiler >> totalFullGCs [

^ vmStats at: 7
]

{ #category : 'accessing - statistics' }
IllAbstractProfiler >> totalProfiledTime [

^ totalTime
]

{ #category : 'accessing - statistics' }
IllAbstractProfiler >> totalScavenges [

^ vmStats at: 9
]

{ #category : 'profiling' }
IllAbstractProfiler >> uninstallMethodProxies [

Expand Down
45 changes: 34 additions & 11 deletions src/IllimaniProfiler/IllFinalizationProfiler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,49 @@ Class {
#tag : 'Finalization-Profiler'
}

{ #category : 'serialization' }
{ #category : 'export' }
IllFinalizationProfiler >> exportData [

| writer csvFile fileName |
fileName := DateAndTime now asStringYMDHM.
fileName replaceAll: Character space with: $H;
replaceAll: $: with: $m.
fileName := fileName , '-samplingRate-', samplingRate asString.
fileName := fileName , '.csv'.
| writer writeStream fileName |
fileName := self fileNameToExport.
self exportMetaData: fileName , '.json'.

writeStream := (fileName , '.csv') asFileReference createFile writeStream.
writer := NeoCSVWriter on: writeStream.

csvFile := fileName asFileReference createFile writeStream.
writer := NeoCSVWriter on: csvFile.
writer writeHeader: ephemeronsCollection first headerToExportCSV.

ephemeronsCollection do: [ :anIllEphemeron |
writer nextPut: anIllEphemeron flatInstanceVariables ].

writer close
]

{ #category : 'export' }
IllFinalizationProfiler >> exportMetaData: fileName [

| tempDict jsonString writeStream |
tempDict := { ('totalExecutionTime' -> totalTime).
('totalFullGCs' -> self totalFullGCs).
('totalScavenges' -> self totalScavenges).
('sampligRate' -> samplingRate) } asDictionary.
jsonString := NeoJSONWriter toStringPretty: tempDict.

writeStream := fileName asFileReference createFile writeStream.
writeStream nextPutAll: jsonString.
writeStream close
]

{ #category : 'export' }
IllFinalizationProfiler >> fileNameToExport [

| fileName |
fileName := DateAndTime now asStringYMDHM.
fileName
replaceAll: Character space with: $H;
replaceAll: $: with: $m.
^ fileName
]

{ #category : 'profiling' }
IllFinalizationProfiler >> forceFinalizationOfObjects [

Expand Down

0 comments on commit 1888aa4

Please sign in to comment.