From 542282857ba2c430a5bd7ef1b9be573bbfd7473a Mon Sep 17 00:00:00 2001 From: Christian Krause Date: Fri, 15 Jan 2016 15:09:38 +0100 Subject: [PATCH 1/5] bumps project version to next SNAPSHOT --- build.sbt | 2 -- version.sbt | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 version.sbt diff --git a/build.sbt b/build.sbt index 11ee685..b2c9d9d 100644 --- a/build.sbt +++ b/build.sbt @@ -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 ( diff --git a/version.sbt b/version.sbt new file mode 100644 index 0000000..993b525 --- /dev/null +++ b/version.sbt @@ -0,0 +1 @@ +git.baseVersion in ThisBuild := "0.2.0-SNAPSHOT" From 002ca4e861ea56429e5f6eee53ad8b84ea47d9c8 Mon Sep 17 00:00:00 2001 From: Christian Krause Date: Thu, 25 Feb 2016 08:36:29 +0100 Subject: [PATCH 2/5] corrects README mistake fixes #1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 97b389a..53c0490 100644 --- a/README.md +++ b/README.md @@ -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 From 39ce8e8c4124cd2f5edab77804c07870b2cb56c9 Mon Sep 17 00:00:00 2001 From: Christian Krause Date: Sat, 26 Mar 2016 13:52:27 +0100 Subject: [PATCH 3/5] adds man page fixes #3 --- README.md | 1 + build.sbt | 4 +- strace-analyzer.1 | 94 ++++++++++++++++++++++++++++++++++++++++++++ strace-analyzer.1.md | 85 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 strace-analyzer.1 create mode 100644 strace-analyzer.1.md diff --git a/README.md b/README.md index 53c0490..0a059f3 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/build.sbt b/build.sbt index b2c9d9d..0ed6a58 100644 --- a/build.sbt +++ b/build.sbt @@ -15,9 +15,11 @@ 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") Seq ( license -> ("share/" + name + "/LICENSE"), - notice -> ("share/" + name + "/NOTICE.md") + notice -> ("share/" + name + "/NOTICE.md"), + manPage -> ("share/man/man1/" + manPage) ) } ) diff --git a/strace-analyzer.1 b/strace-analyzer.1 new file mode 100644 index 0000000..cfe27a3 --- /dev/null +++ b/strace-analyzer.1 @@ -0,0 +1,94 @@ +.\" Automatically generated by Pandoc 1.17.0.3 +.\" +.TH "STRACE\-ANALYZER" "1" "March 2016" "Version 0.2.0-SNAPSHOT" "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: + +.SH AUTHOR +.PP +Christian Krause +.SH SEE ALSO +.PP +\f[B]strace(1)\f[] diff --git a/strace-analyzer.1.md b/strace-analyzer.1.md new file mode 100644 index 0000000..25624ae --- /dev/null +++ b/strace-analyzer.1.md @@ -0,0 +1,85 @@ +% STRACE-ANALYZER(1) Version 0.2.0-SNAPSHOT | 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: + +# AUTHOR + +Christian Krause + +# SEE ALSO + +**strace(1)** From a05ad505026325dfd2f4d64f9ad300782899ba29 Mon Sep 17 00:00:00 2001 From: Christian Krause Date: Sat, 26 Mar 2016 18:37:47 +0100 Subject: [PATCH 4/5] adds bash completion fixes #2 --- bash-completion.sh | 31 +++++++++++++++++++++++++++++++ build.sbt | 4 +++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 bash-completion.sh diff --git a/bash-completion.sh b/bash-completion.sh new file mode 100644 index 0000000..d5c0eea --- /dev/null +++ b/bash-completion.sh @@ -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 diff --git a/build.sbt b/build.sbt index 0ed6a58..dff572c 100644 --- a/build.sbt +++ b/build.sbt @@ -16,10 +16,12 @@ lazy val root = (project in file(".")). 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"), - manPage -> ("share/man/man1/" + manPage) + manPage -> ("share/man/man1/" + manPage), + completion -> ("share/bash-completion/completions/" + name) ) } ) From 20c1b8add6998f187bd81c1e57b470667dd8d306 Mon Sep 17 00:00:00 2001 From: Christian Krause Date: Sun, 28 May 2017 19:05:01 +0200 Subject: [PATCH 5/5] bumps project version to 0.1.1 --- strace-analyzer.1 | 2 +- strace-analyzer.1.md | 2 +- version.sbt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/strace-analyzer.1 b/strace-analyzer.1 index cfe27a3..eea02c5 100644 --- a/strace-analyzer.1 +++ b/strace-analyzer.1 @@ -1,6 +1,6 @@ .\" Automatically generated by Pandoc 1.17.0.3 .\" -.TH "STRACE\-ANALYZER" "1" "March 2016" "Version 0.2.0-SNAPSHOT" "strace\-analyzer manual" +.TH "STRACE\-ANALYZER" "1" "March 2016" "Version 0.1.1" "strace\-analyzer manual" .hy .SH NAME .PP diff --git a/strace-analyzer.1.md b/strace-analyzer.1.md index 25624ae..107585b 100644 --- a/strace-analyzer.1.md +++ b/strace-analyzer.1.md @@ -1,4 +1,4 @@ -% STRACE-ANALYZER(1) Version 0.2.0-SNAPSHOT | strace-analyzer manual +% STRACE-ANALYZER(1) Version 0.1.1 | strace-analyzer manual % % March 2016 diff --git a/version.sbt b/version.sbt index 993b525..11b9bfc 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -git.baseVersion in ThisBuild := "0.2.0-SNAPSHOT" +git.baseVersion in ThisBuild := "0.1.1"