Skip to content

Commit

Permalink
merge branch 'release/0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
wookietreiber committed May 28, 2017
2 parents 54a26be + 20c1b8a commit 96ce668
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ build dependencies:
git clone https://github.com/wookietreiber/strace-analyzer.git
cd strace-analyzer
sbt stage
export $PATH="$PWD/target/universal/stage/bin:$PATH"
export PATH="$PWD/target/universal/stage/bin:$PATH"
```

usage
Expand All @@ -44,6 +44,7 @@ cat app-strace.log.27049 | strace-analyzer read | column -t
More help can be gotten via:

```bash
man strace-analyzer
strace-analyzer --help
```

Expand Down
31 changes: 31 additions & 0 deletions bash-completion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# bash completion for strace-analyzer

_strace-analyzer()
{
local cur prev
_init_completion || return

case $prev in
summary|read|write|io)
_expand || return 0
compopt -o filenames
COMPREPLY=( $( compgen -fd -- "$cur" ) )
return 0
;;
esac

case $cur in
--*)
COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
;;
-*)
COMPREPLY=( $( compgen -W '-? -h -help -version --help --version' -- $cur ) )
;;
*)
COMPREPLY=( $( compgen -W 'summary read write io' -- $cur ) )
;;
esac

return 0
} &&
complete -F _strace-analyzer strace-analyzer
8 changes: 5 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ organization in ThisBuild := "com.github.wookietreiber"

scalaVersion in ThisBuild := "2.11.7"

git.baseVersion in ThisBuild := "0.1.0"

lazy val root = (project in file(".")).
enablePlugins(BuildInfoPlugin).
settings (
Expand All @@ -17,9 +15,13 @@ lazy val root = (project in file(".")).
mappings in Universal <++= name in Universal map { name =>
val license = file("LICENSE")
val notice = file("NOTICE.md")
val manPage = file("strace-analyzer.1")
val completion = file("bash-completion.sh")
Seq (
license -> ("share/" + name + "/LICENSE"),
notice -> ("share/" + name + "/NOTICE.md")
notice -> ("share/" + name + "/NOTICE.md"),
manPage -> ("share/man/man1/" + manPage),
completion -> ("share/bash-completion/completions/" + name)
)
}
)
94 changes: 94 additions & 0 deletions strace-analyzer.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
.\" Automatically generated by Pandoc 1.17.0.3
.\"
.TH "STRACE\-ANALYZER" "1" "March 2016" "Version 0.1.1" "strace\-analyzer manual"
.hy
.SH NAME
.PP
strace\-analyzer \- analyzes strace output
.SH SYNOPSIS
.PP
\f[B]strace\-analyzer\f[] <\f[I]command\f[]> [\f[I]log1\f[]
\f[I]log2\f[] ...]
.SH DESCRIPTION
.PP
\f[B]strace\-analyzer\f[] analyzes logs created by \f[B]strace(1)\f[].
There are different analysis commands which are explained in the
\f[B]Analysis Commands\f[] section.
.PP
The file descriptors you see when looking at the logs manually are not
very descriptive, i.e.
to know what happened with which file, pipe, etc.
For this reason, \f[B]strace\-analyzer\f[] associates these file
descriptors with file names.
These associations are made when syscalls like \f[B]open(2)\f[],
\f[B]creat(2)\f[], \f[B]dup(2)\f[] or \f[B]pipe(2)\f[] are read from the
log and are terminated when they get \f[B]close(2)\f[]d.
.PP
There are some \f[B]strace(1)\f[] command line options that are required
for \f[B]strace\-analyzer\f[] to interpret the logs correctly.
The option \f[B]\-T\f[] is required to trace the time spent on the
syscalls themselves.
The option \f[B]\-ttt\f[] is required to trace the syscalls over time.
The option \f[B]\-o\f[] is required to store the logs on disk.
The option \f[B]\-ff\f[] is required for each process to get its own log
file.
The problem with strace and writing syscalls from multiple processes (or
threads) to the same output file is that start and end of a single
syscall are split over two lines and there is no way of merging them
back together with respect to the file descriptor association.
Thus, the resulting \f[B]strace(1)\f[] invocation to create the logs
should look as in the \f[B]EXAMPLES\f[] section.
.SS Analysis Commands
.TP
.B summary
Prints a summary for the syscalls \f[B]read(2)\f[] and
\f[B]write(2)\f[].
.RS
.RE
.TP
.B read
Prints a \f[B]read(2)\f[] summary for each file.
.RS
.RE
.TP
.B write
Prints a \f[B]write(2)\f[] summary for each file.
.RS
.RE
.TP
.B io
Does both the \f[B]read\f[] and \f[B]write\f[] commands for each file.
.RS
.RE
.SH OPTIONS
.TP
.B \-?, \-h, \-help, \-\-help
Prints usage information.
.RS
.RE
.TP
.B \-version, \-\-version
Prints the current version number.
.RS
.RE
.SH EXAMPLES
.SS create logs
.PP
strace \-T \-ttt \-ff \-o /tmp/strace\-dd.log dd if=/dev/zero
of=/dev/null count=1024 bs=1M
.SS analyze logs
.PP
strace\-analyzer io /tmp/strace\-dd.log.*
.SS analyze logs with filtering and pretty, tabular printing
.PP
strace\-analyzer io /tmp/strace\-dd.log.* | grep /dev/ | column \-t
.SH BUGS, ISSUES and FEATURE REQUESTS
.PP
See GitHub issues:
<https://github.com/wookietreiber/strace-analyzer/issues>
.SH AUTHOR
.PP
Christian Krause <https://github.com/wookietreiber>
.SH SEE ALSO
.PP
\f[B]strace(1)\f[]
85 changes: 85 additions & 0 deletions strace-analyzer.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
% STRACE-ANALYZER(1) Version 0.1.1 | strace-analyzer manual
%
% March 2016

# NAME

strace-analyzer - analyzes strace output

# SYNOPSIS

| **strace-analyzer** \<*command*> \[*log1* *log2* ...]

# DESCRIPTION

**strace-analyzer** analyzes logs created by **strace(1)**. There are different analysis commands
which are explained in the **Analysis Commands** section.

The file descriptors you see when looking at the logs manually are not very descriptive, i.e. to
know what happened with which file, pipe, etc. For this reason, **strace-analyzer** associates these
file descriptors with file names. These associations are made when syscalls like **open(2)**,
**creat(2)**, **dup(2)** or **pipe(2)** are read from the log and are terminated when they get
**close(2)**d.

There are some **strace(1)** command line options that are required for **strace-analyzer** to
interpret the logs correctly. The option **-T** is required to trace the time spent on the syscalls
themselves. The option **-ttt** is required to trace the syscalls over time. The option **-o** is
required to store the logs on disk. The option **-ff** is required for each process to get its own
log file. The problem with strace and writing syscalls from multiple processes (or threads) to the
same output file is that start and end of a single syscall are split over two lines and there is no
way of merging them back together with respect to the file descriptor association. Thus, the
resulting **strace(1)** invocation to create the logs should look as in the **EXAMPLES** section.

## Analysis Commands

summary

: Prints a summary for the syscalls **read(2)** and **write(2)**.

read

: Prints a **read(2)** summary for each file.

write

: Prints a **write(2)** summary for each file.

io

: Does both the **read** and **write** commands for each file.

# OPTIONS

-?, -h, -help, --help

: Prints usage information.

-version, --version

: Prints the current version number.

# EXAMPLES

## create logs

strace -T -ttt -ff -o /tmp/strace-dd.log dd if=/dev/zero of=/dev/null count=1024 bs=1M

## analyze logs

strace-analyzer io /tmp/strace-dd.log.*

## analyze logs with filtering and pretty, tabular printing

strace-analyzer io /tmp/strace-dd.log.* | grep /dev/ | column -t

# BUGS, ISSUES and FEATURE REQUESTS

See GitHub issues: <https://github.com/wookietreiber/strace-analyzer/issues>

# AUTHOR

Christian Krause <https://github.com/wookietreiber>

# SEE ALSO

**strace(1)**
1 change: 1 addition & 0 deletions version.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git.baseVersion in ThisBuild := "0.1.1"

0 comments on commit 96ce668

Please sign in to comment.