• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An advanced benchmarking tool

temci

https://readthedocs.org/projects/temci/badge/?version=latest&style=plain

An advanced benchmarking tool written in Python 3 that supports setting up an environment for benchmarking and the generation of visually appealing reports.

It runs on Linux systems and (rudimentarily) on macOS.

Why should you use temci?

temci allows you to easily measure the execution time (and other things) of programs and compare them against each other resulting in a pretty HTML5 based report. Furthermore it can set up the environment to ensure benchmarking results with a low variance. The latter feature can be used without using temci for benchmarking by using temci short shell.

Usage

The main commands of temci are temci exec and temci report.

Suppose you want to see whether grepping for the strings that consist of a and b in the current folder is slower than for strings that consist only of a.

First we have to install temci (using Nix, see below for more instructions):

nix-env -f https://github.com/parttimenerd/temci/archive/master.tar.gz -i

After this, we can benchmark both commands with temci:

# benchmark both commands 20 times
temci short exec "grep '[ab]*' -R ." "grep 'a*' -R ." --runs 10

# append --watch to get report (in which you can move with the arrow keys and scroll)
# after every benchmark completed (use --watch_every to decrease interval)
temci short exec "grep '[ab]*' -R ." "grep 'a*' -R ." --runs 10 --watch

# if you want to improve the stability your benchmarks, run them with root privileges
# the benchmarked programs are run with your current privileges
temci short exec "grep '[ab]*' -R ." "grep 'a*' -R ." --runs 10 --sudo --preset usable

This results in a run_output.yaml file that should look like:

- attributes: {description: 'grep ''[ab]*'' -R .'}
  data:
    etime: [0.03, 0.02, 0.02, 0.03, 0.03, 0.03, 0.02, 0.03, 0.03, 0.02]
    … # other properties
- attributes: {description: grep 'a*' -R .}
  data:
    etime: [0.02, 0.03, 0.02, 0.03, 0.03, 0.02, 0.03, 0.03, 0.02, 0.02]
    … # other properties
- property_descriptions: {etime: elapsed real (wall clock) time, … }

For more information on the support measurement tools (like perf stat and rusage), the supported plugins for setting up the environment and more, see temci exec.

We can now create a report from these benchmarking results using temci report. We use the option --properties to include only the elapsed time in the report to keep the report simple:

> temci report run_output.yaml --properties etime
Report for single runs
grep '[ab]*' -R .    (   10 single benchmarks)
     etime mean =     2(6).(000)m, deviation = 18.84223%

grep 'a*' -R .       (   10 single benchmarks)
     etime mean =     2(5).(000)m, deviation = 20.00000%

Equal program blocks
     grep '[ab]*' -R .  ⟷  grep 'a*' -R .
         etime confidence =        67%, speed up =      3.85%

We see that there is no significant difference between the two commands.

There are multiple reporters besides the default console reporter. Another reporter is the html2 reporter that produces an HTML report, use it by adding the --reporter html2 option:

http://mostlynerdless.de/files/report_readme/html_report.png

Installation

The simplest way is to use the Nix package manager, after installing Nix, run:

nix-env -f https://github.com/parttimenerd/temci/archive/master.tar.gz -i

Using pip requiring at least Python 3.6:

sudo pip3 install temci

For more information see the Installation page.

Auto completion

Temci can generate auto completion files for bash and zsh. Add the following line to your .bashrc or .zshrc:

. `temci_completion $0`

Using temci to set up a benchmarking environment

Use the temci short shell COMMAND to run a command (sh by default) in a shell that is inside the benchmarking environment. Most options of temci short exec are supported. For more information, see temci shell.

Why is temci called temci?

The problem in naming programs is that most good program names are already taken. A good program or project name has (in my opinion) the following properties:

  • it shouldn't be used on the relevant platforms (in this case: github and pypi)
  • it should be short (no one wants to type long program names)
  • it should be pronounceable
  • it should have at least something to do with the program

temci is such a name. It's lojban for time (i.e. the time duration between two moments or events).

Contributing

Bug reports and code contributions are highly appreciated.

For more information, see the Contributing page.

More Repositories

1

hello-ebpf

Hello eBPF world! Hello Java world! Let's discover eBPF together and write Java user-land library along the way.
Java
115
star
2

tiny-profiler

A tiny CPU profiler for Java written completely in Java 17.
Java
87
star
3

intellij-profiler-plugin

IntelliJ plugin to view JFR profiler files and to profile using JFR
Kotlin
52
star
4

python-dbg

Python debugger experiments
Python
26
star
5

Moderne-Physik

Skriptartiger Mitschrieb fΓΌr die Vorlesung Moderne Physik fΓΌr Informatiker, SS15/17, KIT
TeX
21
star
6

jug-profiling-talk

Notes and scripts for my JUG KA talk on Java profiling
Java
20
star
7

jfreventcollector

Collection of information on JFR events
Kotlin
17
star
8

dead-code-agent

Agent based dead code/classes detection
Java
15
star
9

meta-agent

Instrument instrumenting agents to see how they transform classes
Java
15
star
10

jfrtofp

JFR to Firefox Profiler converter
Kotlin
13
star
11

writing-a-profiler

Code for my "Writing a Profiler from Scratch" blog series on mostlynerdless.de and foojay.io
C++
10
star
12

asgct2-demo

Demo repository for JEP Candidate 435
HTML
7
star
13

panama-examples

Examples for using jextract and project Panama. Used as complimentary material for my blog posts.
Java
7
star
14

classloader-hierarchy-agent

Agent to print the classloader hierarchy
Java
5
star
15

jfrtofp-server

Bundles the JFR to FirefoxProfiler with a custom FirefoxProfiler
Java
5
star
16

swp

Experimental LR parser generator that can generate GIFs
Java
5
star
17

jfrevents-site-generator

Generator of my JFR events website, using the jfreventscollector as a data source.
Kotlin
5
star
18

parser-experiments

Tiny parsers for educational purposes
JavaScript
3
star
19

classviewer-agent

Agent to view the decompiled bytecode of classes, as they are currently executed
Java
3
star
20

vsreg

Creates VSCode launch configurations to help debugging JTREG tests and regular native programs
Python
3
star
21

jdk-profiling-tester

Testing AsyncGetCallTrace, AsyncGetCallTrace2 and JFR stacktrace collection for stability issues
Python
2
star
22

abipage

An easy to setup webpage, helping the creation of a german pupils "Abizeitung"
PHP
2
star
23

mvm

A simple virtual machine for an imperative and dynamicly typed language
C++
2
star
24

asgct_bottom

An Agent that checks the bottom-most frame returned by AsyncGetCallTrace is correct (using GST), thereby checking that ASGCT does not abort the stack walking too early.
C++
2
star
25

jdwp

JDWP packet processing and logging
Java
2
star
26

LBJOS

LBJOS is the acronym for "Little Java Based Operating System", it's my attempt to build something like an OS on the JVM...
Java
2
star
27

CyclotronSimulation

A simple simulation of cyclotron particle accelerator written for a physics class
Java
1
star
28

tunes

Games to learn some music theory
JavaScript
1
star
29

condensed-data

Library for writing compressed (JFR) event data
Java
1
star
30

dsharpy

Combining model checkers with quantitative information flow leakage computation
Python
1
star
31

AutomatonLang

A meta language for creating finite and mealy automations with an editor and the capabilty to create JFLAP files
Java
1
star
32

TinyTaskkill

Little Taskmanager for the Taskbar
C#
1
star
33

java-dbg

Java debugging experiments
Java
1
star
34

while-semantics

A visualization of evaluations of the while language via semantic rules.
JavaScript
1
star
35

ModulationJS

Eine einfache Simulation der Amplituden-, Frequenz- und Phasenmodulation zu Lehrzwecken
1
star
36

tumour_classifier

A simple tumour classifier based on microRNA expression profiles
Python
1
star
37

asuroflash

asuroflash for linux, without QT dependencies
C++
1
star
38

trace_tester

Code to make testing ASGST and writing tests easier
Java
1
star