masa16 / strace_log

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StraceLog

Parse logs generated by Strace (system call tracer) and obtain statistics.

Installation

Add this line to your application's Gemfile:

gem 'strace_log'

And then execute:

$ bundle

Or install it yourself as:

$ gem install strace_log

Usage

Run command with strace:

$ strace -T -o strace.log command

Output statistics of strace log by mount point to CSV file:

$ strace-stat -s -o strace.csv strace.log

Option for strace-stat:

Usage: strace-stat [options] [FILE]
    FILE                             filename of strace log (default: stdin)
    -o, --output OUTFILE             output CSV filename
    -s, --stat                       output statistics by mount point (default: statistics by each path)
    -t, --table TABLEFILE            filename of mounted file system table (default:/etc/mtab)
    -c, --column TABLECOLUMN         column number of mount point in mtab (default:2)

Classes

  • StraceLog::ParsedCall
  • StraceLog::Stat

Example

$ strace -T -o strace.log dd if=/dev/zero of=tmpfile count=10000
$ strace-stat -s -o strace.csv strace.log
$ cat strace.csv
path,syscall,calls,errors,time,size
*,execve,1,0,0.009673,
*,brk,4,0,0.000057,
*,mmap,10,0,0.000285,
*,access,1,1,0.000021,
*,open,39,32,0.001220,
*,stat,27,21,0.000470,
*,read,10003,0,0.123271,5123334
*,fstat,5,0,0.000147,
*,mprotect,4,0,0.000075,
*,close,10,0,0.000311,
*,arch_prctl,1,0,0.000012,
*,rt_sigaction,4,0,0.000050,
*,dup2,2,0,0.000037,
*,lseek,1,0,0.000006,
*,write,10003,0,0.246277,5120136
*,munmap,1,0,0.000049,
*,exit_group,1,0,0.000000,
/,execve,1,0,0.009673,
/,access,1,1,0.000021,
/,open,29,24,0.000885,
/,stat,19,14,0.000346,
/,read,3,0,0.000101,3334
/,fstat,5,0,0.000147,
/,mmap,5,0,0.000181,
/,close,5,0,0.000167,
/home,open,9,8,0.000251,
/home,stat,8,7,0.000124,
/home,dup2,1,0,0.000030,
/home,close,2,0,0.000054,
/home,write,10000,0,0.246116,5120000
/dev,open,1,0,0.000084,
/dev,dup2,1,0,0.000007,
/dev,close,2,0,0.000049,
/dev,lseek,1,0,0.000006,
/dev,read,10000,0,0.123170,5120000
stderr,write,3,0,0.000161,136
stderr,close,1,0,0.000041,

(path=* means total sum for each system call)

Same example using pipe:

$ strace -T -s 0 -o '|strace-stat -s -o strace.csv' dd if=/dev/zero of=tmpfile count=10000

Contributing

  1. Fork it ( https://github.com/masa16/strace_log/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About


Languages

Language:Ruby 100.0%