Skip to content

Getting started🔗

Install the library🔗

Install the latest version from PyPI using pip:

pip install multimeter

Create a multimeter in your code🔗

Create a new instance of Multimeter with the probes it should use:

import multimeter


mm = multimeter.Multimeter(multimeter.ResourceProbe())

Measure while executing the code you want to measure🔗

with mm.measure(identifier='measurement-id') as measurement:
    # Here the code whose performance should be measured

Process the measured results🔗

print(f"Start {measurement.result.start}")
print(f"End {measurement.result.end}")
print(f"Duration {measurement.result.duration}")
print(f"CPU avg values: {measurement.result.values('process.cpu_rate_user')}")

Automatically store the results as JSON🔗

mm.set_storage(multimeter.FileStorage(save_directory='/my/directory', file_format=multimeter.JsonFormat()))

Where to go from here?🔗

Read the user guide for some more in-depth explanation about multimeter.

Multimeter supports different types of probes, that actually measure. A description of the individual classes with their respective metrics can be found in the documentation:

Last update: 2021-12-22