Skip to content

Statsviz

Stephen Illingworth edited this page May 4, 2024 · 3 revisions

During development of the emulator itself it is sometimes useful to monitor runtime performance, particularly memory usage, in a live environment. For this purpose, support for the statsviz package is provided. An example screenshot of the output is shown below:

image

Rather than build support into the release binaries however, statsviz support is only available when compiled from source. Moreover, the patch file for statsviz support must be applied before compilation. The patch file is in the main github repository and is called 0001-statsviz.patch.

It is not thought that statsviz support will often be required so having to apply the patch file is not something that will affect many people. Moreover, keeping the support in an optional patch file means the emulator's bill of materials is kept small and realistic.

Statsviz support was added to Gopher2600 with commit 4cc32c4

Applying the patch file

git apply --verbose 0001-statsviz.patch

Testing that the patch file is still valid can be done either by calling the above with the --check option. ie.

git apply --check --verbose 0001-statsviz.patch

Or by using the Makefile target:

make patch_file_integrity

The latter will test all patch files in the working directory.

Using Statsviz

Once the patch has been applied, the emulator can be run from the command line with the -statsviz option. This will launch a webserver listening on localhost port 2610. The path to the statsviz page is then: http://localhost:2610/debug/statsviz/

Creating the patch file

For reference, it should be noted that the patch file was created with:

git diff > 0001-statsviz.patch

This is instead of committing the changes to the git repository. After the patch file had been created the git changes were discarded (with git checkout .)