GithubHelp home page GithubHelp logo

matthewm101 / milli-klockstat Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 11 KB

A python program that uses eBPF to monitor kernel lock contentions.

License: MIT License

Jupyter Notebook 62.20% Python 37.80%

milli-klockstat's Introduction

milli-klockstat

This tool is a modification of kLockStat by Prathyush PV. More information about kLockStat can be found here and here.

Milli-kLockStat records aggregate information about the time spent waiting to acquire kernel locks; by default, the sampling period is 50ms (20 aggregate samples per second). For each combination of process/thread ID and lock address, the following information is captured for each sampling period:

  • The timestamp of the start of the sampling period
  • The number of times the thread attempted to access the lock in one period
  • The sum (in ns) of time spent waiting for the lock to become accessible over the entire period

This allows the average wait time for a specific thread and lock to be derived for each period. Additionally, the following information is also provided for each thread-lock combination:

  • The process ID and thread ID for the thread
  • The command used to run the process
  • The address of the lock
  • The type of lock (mutex, semaphore, R/W)
  • A stack trace of the first time the thread accessed the lock while Milli-klockstat was running (future stack traces are not captured in order to reduce logging overhead)

For more information about what Milli-kLockStat prints out and its arguments, see the comments at the start of mklockstat.py.

The provided Jupyter notebook includes several useful functions for analyzing and graphing the collected data.

Usage

First, install the required dependencies:

sudo apt-get install bpfcc-tools linux-headers-$(uname -r)

Then, run mklockstat:

sudo python3 mklockstat.py (--period 50) (--time 10) (--no-filter-monitors)

The period argument controls the sampling period in milliseconds. By default, it is 50ms.

The time argument controls the time before the monitor automatically terminates. By default, it is 10s.

The no-filter-monitors argument will disable the automatic filtering of lock accesses by some known monitors (collect, collectl, tcplife-bpfcc)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.