Skip to content

Measure the resources of arbitrary commands easily!

License

Notifications You must be signed in to change notification settings

tira-io/measure

Repository files navigation

measure

Measuring what really matters

GPL 2.0 License Current Release
Installation  |  Command  |  API  |  Examples  |  Citation

Installation

Measure Command

Check out our latest release to find a plethora of prebuilt binaries for various architectures (AMD64, ARM64) and operating systems (Windows, Linux, MacOS). Simply downloading what fits you should work since everything is compiled into a single file.

Measure API

CMake (FetchContent)

include(FetchContent)

# Use GIT_TAG to request the tag (or branch) you would like
FetchContent_Declare(measure GIT_REPOSITORY https://github.com/tira-io/measure.git GIT_TAG v0.0.1)
FetchContent_MakeAvailable(measure)
target_link_libraries(<yourtarget> measure::measureapi)

Usage

Generally, measure offers two ways of measuring programs: a commandline interface and a C-API that can be called from and integrated into other languages easily. Please also have a look at the examples to see how it can be used.

Command

Type measurecmd --help to get a full description of the supported commandline arguments. Generally, you only need to call

measurecmd "<command>"

to measure everything, you may want to know about the shell command <command>.

API

#include <measureapi.h>

int main(int argc, char* argv[]) {
	const char* provider[] = {"git", "system", "gpu", "energy", NULL};
    char* outputJson;
	mapiConfig config = {.provider = provider, .monitor = true, .pollIntervallMs = 1000};

	mapiMeasure* measure = mapiStartMeasure(config);
    /** Measure your code here **/

	mapiStopMeasure(handle, &outputJson);
    /** The collected data is serialized into outputJson and needs to be freed by the caller **/
}

Datasources

Timeseries datatypes are denoted [T], where T is the datatype of each entry.

Git

Name Type Description Status
git > isrepo Boolean Checks if the current working directory is (part of) a Git repository Implemented
git > tag String Retrieves the tag or branch name that is checked out Implemented
git > last commit String Holds the hash identifying the latest commit Implemented
git > remote > origin String Contains the URL to the origin remote if such a remote exists Implemented
git > up to date Boolean True if no changes to files in the repository are uncommitted Planned
git > unchecked files Boolean True if files exist that are not ignored by the .gitignore and are not checked into the repository Planned
git > hash String The hash of all files checked into the repository Planned

System

Name Type Description Status
elapsed time > wallclock (ms) Float The wallclock ("real") time the program took to run Implemented
elapsed time > user (ms) Float The total time the program spent in user mode Implemented
elapsed time > system (ms) Float The total time the program spent in system mode Implemented
resources > RAM Used (KB) [UInt] The time series of RAM utilization Implemented
resources > Max RAM Used (KB) UInt The most amount of RAM the program used at any one point Implemented
resources > CPU Utilization (%) [UInt] The time series of process' CPU utilization of the Planned
system > num cores UInt The total number of CPU cores installed in the system Implemented
system > RAM (MB) UInt The total amount of RAM installed in the system Implemented
system > RAM Used (MB) [UInt] The time series of entire system's RAM utilization Planned
system > CPU Utilization (%) [Float] The time series of entire system's CPU utilization Planned

Energy

Name Type Description Status
energy > CPU [Float] Planned
energy > GPU [Float] Planned
energy > DRAM [Float] Planned

GPU

Name Type Description Status
gpu > VRAM (MB) UInt Planned
gpu > VRAM Used (MB) [UInt] Planned
gpu > Max VRAM Used (MB) UInt Planned
gpu > Utilization (%) [Float] Planned
gpu > Max Utilization (%) Float Planned

Citation

TODO