Coder Social home page Coder Social logo

memtrace's Introduction

Introduction
============

'memtrace' is a software to measure the memory usage of a piece of
software. The software is run with 'strace' to find all the system
calls made and the memory usage is computed from the calls that deal
with memory allocation (in Linux those are 'brk', 'mmap', 'mremap',
'munmap'). The 'clone' system call is also checked to handle properly
multi-threaded applications.

This software is most likely Linux specific at this point.

Installation
============

'memtrace' is a one-file ruby script, so Ruby must be
installed. Simply copy 'memtrace' somewhere in your path and make it
executable. For example:

$ cp memtrace ~/bin
$ chmod a+x ~/bin/memtrace

Usage
=====

The simplest way is to prepend your command with 'memtrace'. The
command will be run normally and when done, the maximum memory usage
is printed to stderr (similarly to the way 'time' works). For example:

$ memtrace ls >/dev/null
       max: heap     135168   (132k) mmap     136168   (133k) vm     271336   (265k)

The redirection of stdout (i.e. >/dev/null) discards the output of
'ls' and only the output of 'memtrace' is shown.

By default, only the memory page which have write access are
counted. The pages used by the code of the shared library are not
counted. In other words, what is reported is only the memory used by
the software to store things in memory.

To include all the pages, included the read only ones, use the '--all' switch:

$  memtrace --all ls >/dev/null
       max: heap     135168   (132k) mmap   18297680  (17.5M) vm   18432848  (17.6M)

The raw output of strace can be saved to a file to be examined by
'memtrace' later. For example:

$ memtrace -r trace ls >/dev/null
       max: heap     135168   (132k) mmap     136168   (133k) vm     271336   (265k)
$ memtrace -f trace
       max: heap     135168   (132k) mmap     136168   (133k) vm     271336   (265k)
$ memtrace -f --all trace
       max: heap     135168   (132k) mmap   18297680  (17.5M) vm   18432848  (17.6M)

Author & License
================

This software is copyrighted to Guillaume Marcais
<[email protected]> and licensed under the GPL. See COPYING.

memtrace's People

Watchers

shekk avatar

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.