illimani-memory-profiler

A Memory Profiler for Pharo

https://github.com/jordanmontt/illimani-memory-profiler

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.5%) to scientific vocabulary

Keywords

allocations memory object-lifetimes oop pharo profiler profiling-library smalltalk
Last synced: 6 months ago · JSON representation ·

Repository

A Memory Profiler for Pharo

Basic Info
  • Host: GitHub
  • Owner: jordanmontt
  • License: mit
  • Language: Smalltalk
  • Default Branch: main
  • Homepage:
  • Size: 1.33 MB
Statistics
  • Stars: 10
  • Watchers: 1
  • Forks: 6
  • Open Issues: 3
  • Releases: 5
Topics
allocations memory object-lifetimes oop pharo profiler profiling-library smalltalk
Created over 3 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

Illimani: a Memory Profiler

Pharo versionPharo versionPharo version

Illimani is a memory profiler for Pharo that tracks object allocation sites, lifetimes, and garbage collection (GC) cycles. It uses fast and meta-safe instrumentation to profile all object allocations and offers customizable sampling support. It allows the creation of custom memory profilers.

How to install it

Latest version smalltalk EpMonitor disableDuring: [ Metacello new baseline: 'IllimaniProfiler'; repository: 'github://jordanmontt/illimani-memory-profiler:dev'; load ].

Stable version smalltalk EpMonitor disableDuring: [ Metacello new baseline: 'IllimaniProfiler'; repository: 'github://jordanmontt/illimani-memory-profiler:main'; load ].

Quick Getting Started

Profiling a given code snippet

st IllMemoryProfiler new profileOn: [ 15 timesRepeat: [ StPlaygroundPresenter open close ] ] ; open; yourself

Profiling the Pharo IDE activity for a given amount of time

st IllMemoryProfiler new profileFor: 6 seconds; open; yourself

Example 1, Profiling the Pharo IDE activity

st IllMemoryProfiler new copyExecutionStack; profileFor: 6 seconds; open; yourself

Example 2, Profiling on a code snippet:

st IllMemoryProfiler new profileOn: [ 15 timesRepeat: [ StPlaygroundPresenter open close ] ] ; open; yourself

How to use

Profile a code snippet or the Pharo IDE

You can decide both to profile a given method block or just watching the activity of the image for some time.

```st profiler := IllMemoryProfiler new. "With this the profiler will block the ui and you will only capture the objects created by your code snippet" profiler profileOn: [ anObject performSomeAction ].

"With this the profiler with not block the UI nor the image. So, you will capture all the allocations of the image" profiler profileFor: 2 seconds. ```

Profiler manual API

For starting the stoping the profiling manually. This can be useful if you don't know how long your program will run and you need to interact with the Pharo's IDE.

st profiler startProfiling. profiler stopProfiling.

Open the GUI

You can open the ui at any time with the message open (even if the profiler is still profiling)

st profiler open.

Sample the allocations

By default, the profiler captures 1% of the allocations. We chose this number because in our experiments we found out that the profiler producess precise results with minimal overhead with that sampling rate. You can change the sampling rate. Attention, the sampling rate needs to be a fraction.

```st "Capture 10% of the allocations" profiler samplingRate: 1/10.

"Capture 100% of the allocations" profiler samplingRate: 1. ```

Export the profiled data to files

You can export the data to csv and json files by doing:

st profiler exportData

This will create a csv file with all the information about the allocated objects, and some other auxiliary files in json and csv. This auxiliary files can be the meta data about the total profiled time, the gc activity, etc.

Monitor the GC activity

You can monitor the GC activity while the profiler is profiling with the message monitorGCActivity. This will fork a process that will take GC statistics once per second. Then, when exporting the profiler data, two csv files will be exported containing both the scavenges and full GCs. By default, the GC monitoring is disabled. You can enable the GC monitor with the message:

st profiler monitorGCActivity

Implement your own memory profiler

Illimani is also a profiling framework. A user can implement his own profiler by subclassing the IllAbstractProfiler class and defining the few missing methods. Especially, the internalRegisterAllocation: method. The internalRegisterAllocation: method will be called each time that an allocation is produced (or when sampling, each time that the sampling rates matches) with the newly allocated object as a parameter. You can the IllAllocationRateProfiler class as an example of a simple memory profiler.

Statistics

Without the UI, because the profiler is independent from the UI, you can access to some statistics. See the protocol accessing - statistics in the profiler to see the methods. Also, the profiler has a statistics model that groups and sorts the allocation by class and by methods.

A glance at the UI

image

Related papers

Implementation details

  • Illimani uses method proxies library to capture the allocations. It instruments all the allocator methods in Pharo.
  • The object lifetimes profiler uses Ephemerons to know when an object is about to be finalized.
  • It has an statistics model that helps with the calculations of allocations grouping them by classes and methods and sorting them by number of allocations.
  • The UI is independent of the profiler. It can be used without it. You will have access to all allocations and to the same statistics.

Owner

  • Name: Sebastian Jordan Montaño
  • Login: jordanmontt
  • Kind: user
  • Location: France
  • Company: Inria - Lille Nord Europe

Software engineer

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Jordan Montaño
    given-names: Sebastian
    orcid: https://orcid.org/0000-0002-7726-8377
title: "Illimani Memory Profiler"
version: 1.1.0
identifiers:
  - type: doi
    value: 10.5281/zenodo.13897420
date-released: 2024-10-07

GitHub Events

Total
  • Release event: 1
  • Delete event: 1
  • Push event: 79
  • Pull request event: 7
  • Create event: 2
Last Year
  • Release event: 1
  • Delete event: 1
  • Push event: 79
  • Pull request event: 7
  • Create event: 2

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 43
  • Total pull requests: 16
  • Average time to close issues: 4 months
  • Average time to close pull requests: 5 days
  • Total issue authors: 4
  • Total pull request authors: 6
  • Average comments per issue: 1.0
  • Average comments per pull request: 1.13
  • Merged pull requests: 14
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 3
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 9 days
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jordanmontt (16)
  • akevalion (2)
  • tinchodias (2)
  • hernanmd (1)
Pull Request Authors
  • jordanmontt (9)
  • jecisc (2)
  • akevalion (2)
  • pdebruic (1)
  • pavel-krivanek (1)
Top Labels
Issue Labels
Pull Request Labels