TIREx Tracker
Automatic resource and metadata tracking for information retrieval experiments.
[](https://github.com/tira-io/tirex-tracker/actions/workflows/ci.yml)
[](https://github.com/tira-io/tirex-tracker/graphs/contributors)
[](https://codecov.io/github/tira-io/tirex-tracker/)
\
[](https://github.com/tira-io/tirex-tracker/releases/)
[](https://github.com/tira-io/tirex-tracker/releases/)
[](https://github.com/tira-io/tirex-tracker/releases/)
[](https://github.com/tira-io/tirex-tracker/releases/)
\
[](https://pypi.org/project/tirex-tracker/)
[](https://pypi.org/project/tirex-tracker/)
[](https://pypi.org/project/tirex-tracker/)
[](https://tira-io.github.io/tirex-tracker/)
\
[](https://central.sonatype.com/artifact/io.tira/tirex-tracker)
[](https://github.com/tira-io/tirex-tracker/packages/)
[](https://javadoc.io/doc/io.tira/tirex-tracker)
\
[](https://github.com/tira-io/tirex-tracker/issues)
[](https://github.com/tira-io/tirex-tracker/commits)
[](LICENSE)
[CLI](#command-line-tool) • [C/C++ API](#cc-api) • [Python API](#python-api) • [Java/Kotlin API](#javakotlinjvm-api) • [Citation](#citation)
---
The TIREx tracker is a command line tool and API to automatically track resource usage, hardware specifications, and [other metadata](#tracked-measures) when running information retrieval experiments.
It can be used either from the [command line](#command-line-tool), from [C/C++ code](#cc-api), in [Python applications](#python-api), or in [Java/Kotlin applications](#javakotlinjvm-api).
## Command Line Tool
Download a prebuilt binary for your hardware architecture and operating system from the [latest release](https://github.com/tira-io/tirex-tracker/releases/latest).
After downloading, run `tirex-tracker --help` to get a full description of all supported command line arguments.
In most cases, you would use the TIREx tracker CLI like this:
```shell
tirex-tracker ""
```
This will measure all hardware metrics and metadata while executing the given shell command ``.
## C/C++ API
To use the TIREx tracker in your C/C++ projects, first include this repository to your [CMake](https://cmake.org/) file like this:
```cmake
include(FetchContent)
# Use GIT_TAG to request the tag (or branch) you would like
FetchContent_Declare(tirex_tracker GIT_REPOSITORY https://github.com/tira-io/tirex-tracker.git GIT_TAG 0.0.11)
FetchContent_MakeAvailable(tirex_tracker)
target_link_libraries( tirex_tracker::tirex_tracker)
```
This will link the TIREx tracker C API to your binaries.
Take a look at the [examples](c/examples/) to see how our C API can be used.
A minimal example is shown below:
```c
#include
int main() {
// Configure measures to track.
tirexMeasureConf conf[] = {
{TIREX_TIME_ELAPSED_WALL_CLOCK_MS, TIREX_AGG_NO},
// Further measures...
tirexNullConf // sentinel value
};
tirexTrackingConf trackingConf = {.measures = conf, .pollIntervalMs = 100};
tirexMeasureHandle* handle;
tirexStartTracking(trackingConf, &handle);
// Do something...
tirexResult* result;
tirexStopTracking(handle, &result);
// Analyze the results.
tirexResultFree(result);
}
```
The TIREx tracker will automatically track the specified metrics and metadata for everything that is run between `tirexStartTracking` and `tirexStopTracking`.
You can customize the measures to track by adjusting the `conf` array in the example above.
By default, `tirexStartTracking` tracks the calling process only. To track a subprocess instead
(and optionally everything it spawns), set `pid` and `trackSubprocesses`:
```c
tirexTrackingConf trackingConf = {
.measures = conf,
.pid = child_pid, // e.g. from fork()/posix_spawn(), instead of TIREX_PID_SELF
.trackSubprocesses = true, // also aggregate the child's own descendants
.pollIntervalMs = 100,
};
```
## Python API
The Python API can be [installed](#pip-dependency) via Pip from [PyPI](https://pypi.org/project/tirex-tracker/).
After installing the package, you can use the TIREx tracker in your [Python](#python-usage).
### Pip Dependency
First, install the TIREx tracker Python package from [PyPI](https://pypi.org/project/tirex-tracker/):
```shell
pip install tirex-tracker
```
### Python Usage
> [!TIP]
> An exhaustive documentation of the TIREx tracker's Python API can be found on [GitHub Pages](https://tira-io.github.io/tirex-tracker/).
Now, you can track the hardware metrics and metadata of your Python code by using the [context manager](https://geeksforgeeks.org/context-manager-in-python/):
```python
from tirex_tracker import tracking
with tracking() as results:
# Do something...
print(results)
```
Alternatively, you can track the hardware metrics and metadata of a Python function by using the [function decorator](https://geeksforgeeks.org/decorators-in-python/):
```python
from tirex_tracker import tracked
@tracked
def do_something():
# Do something...
do_something()
print(do_something.results)
```
If you cannot use either the context manager or the function decorator from above, you can manually start and stop the tracking:
```python
from tirex_tracker import start_tracking, stop_tracking
handle = start_tracking()
try:
# Do something...
finally:
results = stop_tracking(handle)
print(results)
```
By default, tracking targets the calling process. To track a subprocess instead (and optionally
everything it spawns), pass `pid` and `track_subprocesses`:
```python
import subprocess
from tirex_tracker import tracking
proc = subprocess.Popen(["some-command"])
with tracking(pid=proc.pid, track_subprocesses=True) as results:
proc.wait()
print(results)
```
## Java/Kotlin/JVM API
The Java/Kotlin API can be installed via Gradle or Maven from the [Maven Central Repository](https://central.sonatype.com/artifact/io.tira/tirex-tracker).
After installing the package, you can use the TIREx tracker JVM API in your [Java](#java-usage) or [Kotlin](#kotlin-usage) projects.
Alternative: GitHub Packages
Alternatively to the Maven Central Repository, the TIREx tracker JVM API is also published to [GitHub Packages](https://github.com/tira-io/tirex-tracker/packages/).
To use GitHub Packages, you must first authenticate ([Maven instructions](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages), [Gradle instructions](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages)).
### Gradle Dependency
For Gradle, add the following line to the `dependencies` block of your `build.gradle` (or `build.gradle.kts`) file:
```gradle
dependencies {
implementation("io.tira:tirex-tracker:x.x.x")
}
```
### Maven Dependency
For Maven projects, add these lines to your `pom.xml` file:
```xml
io.tira
tirex-tracker
x.x.x
```
Replace the version placeholder (`x.x.x`) with the [latest available version tag](https://central.sonatype.com/artifact/io.tira/tirex-tracker).
You can now use the TIREx tracker JVM API in your [Java](#java-usage) or [Kotlin](#kotlin-usage) projects.
### Java Usage
> [!TIP]
> An exhaustive documentation of the TIREx tracker's Java API can be found in its [Javadoc](https://javadoc.io/doc/io.tira/tirex-tracker).
For pure Java projects, the easiest way is to use the `track` function and pass your code to be tracked as a lambda like this:
```java
package io.tira.tirex.tracker.example;
import io.tira.tirex.tracker.*;
void main() {
var result = Tracker.track(() -> {
// Do something...
});
System.out.println(result);
}
```
Alternatively, use the [try-with-resources syntax](https://baeldung.com/java-try-with-resources) like this:
```java
TrackingHandle handle = TrackingHandle.start();
try (handle) {
// Do something...
}
System.out.println(handle.getResults());
```
By default, tracking targets the calling process. Because `pid` and `trackSubprocesses` are the
last two parameters of `start`/`track`, and Java has no named arguments, reaching them means
passing every optional parameter in between explicitly:
```java
Process proc = new ProcessBuilder("some-command").start();
TrackingHandle handle = TrackingHandle.start(
Tracker.getALL_MEASURES(), /*pollIntervalMillis=*/1000L,
/*systemName=*/null, /*systemDescription=*/null,
/*exportFilePath=*/null, /*exportFormat=*/null,
/*pid=*/proc.pid(), /*trackSubprocesses=*/true
);
try (handle) {
proc.waitFor();
}
System.out.println(handle.getResults());
```
### Kotlin Usage
In Kotlin projects, the `track` function takes an [inline block](https://kotlinlang.org/docs/inline-functions.html) so that your code can be tracked like this:
```kotlin
package io.tira.tirex.tracker.example
import io.tira.tirex.tracker.*
fun main() {
val result = track {
// Do something...
}
println(result)
}
```
By default, tracking targets the calling process. Kotlin's named arguments make `pid` and
`trackSubprocesses` easy to reach directly, to track a subprocess instead (and optionally
everything it spawns):
```kotlin
val proc = ProcessBuilder("some-command").start()
val result = track(pid = proc.pid(), trackSubprocesses = true) {
proc.waitFor()
}
```
## Tracked Measures
### `ir_metadata` Extension
The resources, hardware specifications, and metadata tracked by the TIREx tracker can easily be exported to an [`ir_metadata`](https://ir-metadata.org/) file.
Not all of our extensive metadata fits well into the current `ir_metadata` specification [version 0.1](https://ir-metadata.org/metadata/overview/). We therefore extend the specification and propose `ir_metadata` 0.2-beta:
## Contributing
We happily accept [pull requests](https://github.com/tira-io/tirex-tracker/compare), [feature requests](https://github.com/tira-io/tirex-tracker/issues/new/choose), and [bug reports](https://github.com/tira-io/tirex-tracker/issues/new/choose) to the TIREx tracker!
To get started for contributing to the development, first clone this repository:
```shell
git clone https://github.com/tira-io/tirex-tracker.git
cd tirex-tracker
```
The further steps will depend on which part of the TIREx tracker's API you work on: the [C API](#c-development), the [Python API](#python-development), or the [JVM API](#jvm-development).
### C development
> [!TIP]
> If you are not familiar with CMake, we highly recommend using the [CMake Visual Studio Code extension](https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/how-to.md#configure-a-project).
We use the meta-build tool [CMake](https://cmake.org/) to configure the project. Different build targets are used so that you can select what to build.
[Doxygen](https://doxygen.nl/) is used to generate the documentation for the C API.
If you haven't installed CMake and/or Doxygen, please install it as described [here for CMake](https://cmake.org/download/) and [here for Doxygen](https://doxygen.nl/download.html)
First, configure CMake enable desired build targets by running the following. Here, we use [GCC](https://gcc.gnu.org/) but any C++20 compliant compiler also works.
```shell
cmake -S c/ -B c/build/ \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_C_COMPILER=gcc-13 \
-D CMAKE_CXX_COMPILER=g++-13 \
-D BUILD_SHARED_LIBS=YES \
-D TIREX_TRACKER_BUILD_DOCS=YES \
-D TIREX_TRACKER_BUILD_DEB=YES \
-D TIREX_TRACKER_BUILD_EXAMPLES=YES
```
> [!TIP]
> If you do not want to generate the documentation and have not installed Doxygen, you can disable it by setting `TIREX_TRACKER_BUILD_DOCS=NO`.
To build the library, run
```shell
cmake --build c/build/ --config Release --target tirex_tracker
```
Under Linux, this will compile the C API into a statically linked library at `c/build/extensions/libtirex_tracker.so`. The supported targets are:
| Target | Type | Description |
|:-----------------------|:--------------|:----------------------------------------------------------------------------------------------|
| `tirex_tracker` | library | A shared library containing `tirex_tracker` and all extensions. |
| `measure` | executable | The `measure` command. |
| `01_tracking` | executable | Example 01: demonstrating basic tracking. |
| `02_list_measures` | executable | Example 02: demonstrating how to fetch meta information through the API. |
| `04_ir_extension` | executable | Example 04: demonstrating the IR extension (`measureext_ir`). |
| `tirex_tracker_docs` | documentation | The library documentation (only available if Doxygen is installed). |
| `package` | package | The Debian package contining the `measure` command. |
That means, to build the Debian package, run:
```shell
cmake --build c/build/ --config Release --target package
```
You will find the compiled Debian package file at `c/build/tirex-tracker-*-Linux.deb` (where `*` is the version).
#### CMake Options
The below CMake options are used to include/exclude certain features from the build, which can improve the build time.
| Option | Description | Default |
|:-------------------------------|:--------------------------------------------------------------------------------------------------------|:-------:|
| `TIREX_TRACKER_ONLY_DOCS` | Build only the documentation (disables tests and others). | `OFF` |
| `TIREX_TRACKER_BUILD_EXAMPLES` | Build the examples. | `OFF` |
| `TIREX_TRACKER_BUILD_DEB` | Build the Debian package. | `OFF` |
| `TIREX_TRACKER_BUILD_DOCS` | Build the documentation. | `OFF` |
| `TIREX_TRACKER_BUILD_CMD_DEB` | Build the Debian package for the `measure` command (requires `TIREX_TRACKER_BUILD_EXAMPLES` to be `ON`) | `OFF` |
### Python development
When developing (parts of) the Python API, first create a virtual environment and then install all necessary developer tooling by running:
```shell
python3 -m venv venv/
source venv/bin/activate
pip install python/[tests,examples]
```
Once the Python developer tools are set up like that, you can check the Python code, static typing, and security, and run all tests with:
```shell
ruff check python/ # Code format and LINT
mypy python/ # Static typing
bandit -c python/pyproject.toml -r python/ # Security
pytest python/ # Unit tests
```
### JVM Development
The JVM wrapper API uses [Gradle](https://gradle.org/) for build and test.
Consistent builds are ensured by using a [Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper_basics.html).
To build the classes, run:
```shell
jvm/gradlew --project-dir jvm/ build
```
Tests and checks for Java and Kotlin usage can be run by:
```shell
jvm/gradlew --project-dir jvm/ check
```
## Citation
If you find our work useful and reference or use it in a paper, please cite us.
```bibtex
@inproceedings{tirextracker2025,
author = {Hagen, Tim and Fr{\"o}be, Maik and Merker, Jan Heinrich and Scells, Harrisen and Hagen, Matthias and Potthast, Martin},
booktitle = {48th International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR 2025)},
month = jul,
publisher = {ACM},
title = {{TIREx Tracker: The Information Retrieval Experiment Tracker}},
year = {2025}
}
```
You can also use the [`CITATION.cff`](./CITATION.cff) to generate a citation in other formats.
## License
The TIREx tracker code is licensed under the [MIT License](./LICENSE).
If you use the TIREx tracker in your experiments, we would appreciate you [citing](#citation) our paper.
## Abstract
> The reproducibility and transparency of retrieval experiments heavily depends on properly provided information on the experimental setup and conditions. But as manually curating such experiment metadata can be tedious, error-prone, and inconsistent, metadata should be systematically collected in an automatic way—similar to the collection of Python and git-specific settings in the `ir_metadata` reference implementation. To enable a platform-independent automatic metadata collection following the `ir_metadata` specification, we introduce the TIREx tracker: a tool realized via a lightweight C binary, pre-compiled with all dependencies for all major platforms to track hardware configurations, usage of power/CPUs/RAM/GPUs, and experiment/system versions. The TIREx tracker seamlessly integrates into Python, Java, or C/C++ workflows and can be easily incorporated in run submissions of shared tasks, which we showcase for the TIRA/TIREx platform.