Blame SOURCES/0079-utils-boot-analysis-utils-boot-benchmark-Add-manual-.patch

e76f14
From 915d73995f518d7592dbbca8776ddbfcb3f205de Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Tue, 3 May 2016 13:05:54 +0100
e76f14
Subject: [PATCH] utils/boot-analysis, utils/boot-benchmark: Add manual pages.
e76f14
e76f14
(cherry picked from commit 98b28b15c61e871c3b3c5efdf4387e570133c4f9)
e76f14
---
e76f14
 .gitignore                              |  2 +
e76f14
 docs/guestfs-performance.pod            |  4 ++
e76f14
 utils/boot-analysis/Makefile.am         | 13 +++++
e76f14
 utils/boot-analysis/boot-analysis.c     | 39 +------------
e76f14
 utils/boot-analysis/boot-analysis.pod   | 99 +++++++++++++++++++++++++++++++++
e76f14
 utils/boot-benchmark/Makefile.am        | 13 ++++-
e76f14
 utils/boot-benchmark/boot-benchmark.c   |  2 +-
e76f14
 utils/boot-benchmark/boot-benchmark.pod | 68 ++++++++++++++++++++++
e76f14
 8 files changed, 200 insertions(+), 40 deletions(-)
e76f14
 create mode 100644 utils/boot-analysis/boot-analysis.pod
e76f14
 create mode 100644 utils/boot-benchmark/boot-benchmark.pod
e76f14
e76f14
diff --git a/.gitignore b/.gitignore
e76f14
index d79dc98..85b19d4 100644
e76f14
--- a/.gitignore
e76f14
+++ b/.gitignore
e76f14
@@ -558,7 +558,9 @@ Makefile.in
e76f14
 /tools/stamp-virt-*.pod
e76f14
 /tools/virt-*.1
e76f14
 /utils/boot-analysis/boot-analysis
e76f14
+/utils/boot-analysis/boot-analysis.1
e76f14
 /utils/boot-benchmark/boot-benchmark
e76f14
+/utils/boot-benchmark/boot-benchmark.1
e76f14
 /utils/qemu-boot/qemu-boot
e76f14
 /utils/qemu-speed-test/qemu-speed-test
e76f14
 /v2v/.depend
e76f14
diff --git a/docs/guestfs-performance.pod b/docs/guestfs-performance.pod
e76f14
index 7304b63..b6c25e1 100644
e76f14
--- a/docs/guestfs-performance.pod
e76f14
+++ b/docs/guestfs-performance.pod
e76f14
@@ -38,6 +38,8 @@ run it, do:
e76f14
  make
e76f14
  ./run utils/boot-benchmark/boot-benchmark
e76f14
 
e76f14
+There is a manual page F<utils/boot-benchmark/boot-benchmark.1>
e76f14
+
e76f14
 =head3 Explanation
e76f14
 
e76f14
 The guestfish command above starts up the libguestfs appliance on a
e76f14
@@ -453,6 +455,8 @@ To run this program, do:
e76f14
  make
e76f14
  ./run utils/boot-analysis/boot-analysis
e76f14
 
e76f14
+There is a manual page F<utils/boot-benchmark/boot-analysis.1>
e76f14
+
e76f14
 =head2 Detailed timings using ts
e76f14
 
e76f14
 Use the L<ts(1)> command (from moreutils) to show detailed
e76f14
diff --git a/utils/boot-analysis/Makefile.am b/utils/boot-analysis/Makefile.am
e76f14
index ef9b2cb..d708de2 100644
e76f14
--- a/utils/boot-analysis/Makefile.am
e76f14
+++ b/utils/boot-analysis/Makefile.am
e76f14
@@ -17,6 +17,8 @@
e76f14
 
e76f14
 include $(top_srcdir)/subdir-rules.mk
e76f14
 
e76f14
+EXTRA_DIST = boot-analysis.pod
e76f14
+
e76f14
 noinst_PROGRAMS = boot-analysis
e76f14
 
e76f14
 boot_analysis_SOURCES = \
e76f14
@@ -41,3 +43,14 @@ boot_analysis_LDADD = \
e76f14
 	$(LTLIBINTL) \
e76f14
 	$(top_builddir)/gnulib/lib/libgnu.la \
e76f14
 	-lm
e76f14
+
e76f14
+# Manual page.
e76f14
+# It should be noinst_MANS but that doesn't work.
e76f14
+noinst_DATA = boot-analysis.1
e76f14
+
e76f14
+boot-analysis.1: boot-analysis.pod
e76f14
+	$(PODWRAPPER) \
e76f14
+	  --man $@ \
e76f14
+	  --license GPLv2+ \
e76f14
+	  --warning safe \
e76f14
+	  $<
e76f14
diff --git a/utils/boot-analysis/boot-analysis.c b/utils/boot-analysis/boot-analysis.c
e76f14
index b90806b..461c69e 100644
e76f14
--- a/utils/boot-analysis/boot-analysis.c
e76f14
+++ b/utils/boot-analysis/boot-analysis.c
e76f14
@@ -16,44 +16,7 @@
e76f14
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
e76f14
  */
e76f14
 
e76f14
-/* Trace and analyze the appliance boot process to find out which
e76f14
- * steps are taking the most time.  It is not part of the standard
e76f14
- * tests.
e76f14
- *
e76f14
- * This needs to be run on a quiet machine, so that other processes
e76f14
- * disturb the timing as little as possible.  The program is
e76f14
- * completely safe to run at any time.  It doesn't read or write any
e76f14
- * external files, and it doesn't require root.
e76f14
- *
e76f14
- * You can run it from the build directory like this:
e76f14
- *
e76f14
- *   make
e76f14
- *   ./run utils/boot-analysis/boot-analysis
e76f14
- *
e76f14
- * The way it works is roughly like this:
e76f14
- *
e76f14
- * We create a libguestfs handle and register callback handlers so we
e76f14
- * can see appliance messages, trace events and so on.
e76f14
- *
e76f14
- * We then launch the handle and shut it down as quickly as possible.
e76f14
- *
e76f14
- * While the handle is running, events (seen by the callback handlers)
e76f14
- * are written verbatim into an in-memory buffer, with timestamps.
e76f14
- *
e76f14
- * Afterwards we analyze the result using regular expressions to try
e76f14
- * to identify a "timeline" for the handle (eg. at what time did the
e76f14
- * BIOS hand control to the kernel).  This analysis is done in
e76f14
- * 'boot-analysis-timeline.c'.
e76f14
- *
e76f14
- * The whole process is repeated across a few runs, and the final
e76f14
- * timeline (including statistical analysis of the variation between
e76f14
- * runs) gets printed.
e76f14
- *
e76f14
- * The program is very sensitive to the specific messages printed by
e76f14
- * BIOS/kernel/supermin/userspace, so it won't work on non-x86, and it
e76f14
- * will require periodic adjustment of the regular expressions in
e76f14
- * order to keep things up to date.
e76f14
- */
e76f14
+/* See instructions in boot-analysis.1 */
e76f14
 
e76f14
 #include <config.h>
e76f14
 
e76f14
diff --git a/utils/boot-analysis/boot-analysis.pod b/utils/boot-analysis/boot-analysis.pod
e76f14
new file mode 100644
e76f14
index 0000000..07cc801
e76f14
--- /dev/null
e76f14
+++ b/utils/boot-analysis/boot-analysis.pod
e76f14
@@ -0,0 +1,99 @@
e76f14
+=head1 NAME
e76f14
+
e76f14
+boot-analysis - Trace and analyze the appliance boot process
e76f14
+
e76f14
+=head1 SYNOPSIS
e76f14
+
e76f14
+ ./run utils/boot-analysis/boot-analysis
e76f14
+
e76f14
+=head1 DESCRIPTION
e76f14
+
e76f14
+Trace and analyze the appliance boot process to find out which steps
e76f14
+are taking the most time.  It is not part of the standard tests.
e76f14
+
e76f14
+This needs to be run on a quiet machine, so that other processes
e76f14
+disturb the timing as little as possible.  The program is completely
e76f14
+safe to run at any time.  It doesn't read or write any external files,
e76f14
+and it doesn't require root.
e76f14
+
e76f14
+You can run it from the build directory on the built copy of
e76f14
+libguestfs like this:
e76f14
+
e76f14
+ make
e76f14
+ ./run utils/boot-analysis/boot-analysis
e76f14
+
e76f14
+If you omit C<./run> then it is run on the installed copy of libguestfs.
e76f14
+
e76f14
+=head2 How it works
e76f14
+
e76f14
+We create a libguestfs handle and register callback handlers so we
e76f14
+can see appliance messages, trace events and so on.
e76f14
+
e76f14
+We then launch the handle and shut it down as quickly as possible.
e76f14
+
e76f14
+While the handle is running, events (seen by the callback handlers)
e76f14
+are written verbatim into an in-memory buffer, with timestamps.
e76f14
+
e76f14
+Afterwards we analyze the result using regular expressions to try to
e76f14
+identify a "timeline" for the handle (eg. at what time did the BIOS
e76f14
+hand control to the kernel).  This analysis is done in
e76f14
+F<utils/boot-analysis/boot-analysis-timeline.c>.
e76f14
+
e76f14
+The whole process is repeated across a few runs, and the final
e76f14
+timeline (including statistical analysis of the variation between
e76f14
+runs) gets printed.
e76f14
+
e76f14
+The program is very sensitive to the specific messages printed by
e76f14
+BIOS/kernel/supermin/userspace.  It only works on x86-64 or aarch64.
e76f14
+It will require periodic adjustment of the regular expressions in
e76f14
+order to keep things up to date.
e76f14
+
e76f14
+=head1 OPTIONS
e76f14
+
e76f14
+=over 4
e76f14
+
e76f14
+=item B<--help>
e76f14
+
e76f14
+Display brief help.
e76f14
+
e76f14
+=item B<--append> "OPTIONS"
e76f14
+
e76f14
+Append C<OPTIONS> to the kernel command line.
e76f14
+
e76f14
+=item B<--color>
e76f14
+
e76f14
+=item B<--colour>
e76f14
+
e76f14
+Output colours (as ANSI escape sequences), even if the output is not a
e76f14
+terminal.
e76f14
+
e76f14
+=item B<-m> MB
e76f14
+
e76f14
+=item B<--memsize> MB
e76f14
+
e76f14
+Set the appliance memory size in MB.
e76f14
+
e76f14
+=item B<--smp> N
e76f14
+
e76f14
+Enable C<N> virtual CPUs.
e76f14
+
e76f14
+=item B<-v>
e76f14
+
e76f14
+=item B<--verbose>
e76f14
+
e76f14
+More verbose output, useful for debugging problems.
e76f14
+
e76f14
+=back
e76f14
+
e76f14
+=head1 SEE ALSO
e76f14
+
e76f14
+L<guestfs-performance(1)>,
e76f14
+L<http://libguestfs.org/>.
e76f14
+
e76f14
+=head1 AUTHOR
e76f14
+
e76f14
+Richard W.M. Jones L<http://people.redhat.com/~rjones/>
e76f14
+
e76f14
+=head1 COPYRIGHT
e76f14
+
e76f14
+Copyright (C) 2016 Red Hat Inc.
e76f14
diff --git a/utils/boot-benchmark/Makefile.am b/utils/boot-benchmark/Makefile.am
e76f14
index 429832a..fed2428 100644
e76f14
--- a/utils/boot-benchmark/Makefile.am
e76f14
+++ b/utils/boot-benchmark/Makefile.am
e76f14
@@ -21,6 +21,8 @@
e76f14
 
e76f14
 include $(top_srcdir)/subdir-rules.mk
e76f14
 
e76f14
+EXTRA_DIST = boot-benchmark.pod boot-benchmark-range.pl
e76f14
+
e76f14
 noinst_PROGRAMS = boot-benchmark
e76f14
 
e76f14
 boot_benchmark_SOURCES = \
e76f14
@@ -41,4 +43,13 @@ boot_benchmark_LDADD = \
e76f14
 	$(top_builddir)/gnulib/lib/libgnu.la \
e76f14
 	-lm
e76f14
 
e76f14
-EXTRA_DIST = boot-benchmark-range.pl
e76f14
+# Manual page.
e76f14
+# It should be noinst_MANS but that doesn't work.
e76f14
+noinst_DATA = boot-benchmark.1
e76f14
+
e76f14
+boot-benchmark.1: boot-benchmark.pod
e76f14
+	$(PODWRAPPER) \
e76f14
+	  --man $@ \
e76f14
+	  --license GPLv2+ \
e76f14
+	  --warning safe \
e76f14
+	  $<
e76f14
diff --git a/utils/boot-benchmark/boot-benchmark.c b/utils/boot-benchmark/boot-benchmark.c
e76f14
index 0508ee9..05cab50 100644
e76f14
--- a/utils/boot-benchmark/boot-benchmark.c
e76f14
+++ b/utils/boot-benchmark/boot-benchmark.c
e76f14
@@ -16,7 +16,7 @@
e76f14
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
e76f14
  */
e76f14
 
e76f14
-/* Benchmark the time taken to boot the libguestfs appliance. */
e76f14
+/* See instructions in boot-benchmark.1 */
e76f14
 
e76f14
 #include <config.h>
e76f14
 
e76f14
diff --git a/utils/boot-benchmark/boot-benchmark.pod b/utils/boot-benchmark/boot-benchmark.pod
e76f14
new file mode 100644
e76f14
index 0000000..b34546a
e76f14
--- /dev/null
e76f14
+++ b/utils/boot-benchmark/boot-benchmark.pod
e76f14
@@ -0,0 +1,68 @@
e76f14
+=head1 NAME
e76f14
+
e76f14
+boot-benchmark - Benchmark the time taken to boot the libguestfs appliance
e76f14
+
e76f14
+=head1 SYNOPSIS
e76f14
+
e76f14
+ ./run utils/boot-benchmark/boot-benchmark
e76f14
+
e76f14
+=head1 DESCRIPTION
e76f14
+
e76f14
+Benchmark the time taken to boot the libguestfs appliance.
e76f14
+
e76f14
+It is essentially the same as doing:
e76f14
+
e76f14
+ time guestfish -a /dev/null run
e76f14
+
e76f14
+except that it warms up the caches and repeats the test many times,
e76f14
+printing out the mean time and standard deviation.
e76f14
+
e76f14
+This needs to be run on a quiet machine, so that other processes
e76f14
+disturb the timing as little as possible.  The program is completely
e76f14
+safe to run at any time.  It doesn't read or write any external files,
e76f14
+and it doesn't require root.
e76f14
+
e76f14
+You can run it from the build directory on the built copy of
e76f14
+libguestfs like this:
e76f14
+
e76f14
+ make
e76f14
+ ./run utils/boot-benchmark/boot-benchmark
e76f14
+
e76f14
+If you omit C<./run> then it is run on the installed copy of libguestfs.
e76f14
+
e76f14
+=head1 OPTIONS
e76f14
+
e76f14
+=over 4
e76f14
+
e76f14
+=item B<--help>
e76f14
+
e76f14
+Display brief help.
e76f14
+
e76f14
+=item B<--append> "OPTIONS"
e76f14
+
e76f14
+Append C<OPTIONS> to the kernel command line.
e76f14
+
e76f14
+=item B<-m> MB
e76f14
+
e76f14
+=item B<--memsize> MB
e76f14
+
e76f14
+Set the appliance memory size in MB.
e76f14
+
e76f14
+=item B<--smp> N
e76f14
+
e76f14
+Enable C<N> virtual CPUs.
e76f14
+
e76f14
+=back
e76f14
+
e76f14
+=head1 SEE ALSO
e76f14
+
e76f14
+L<guestfs-performance(1)>,
e76f14
+L<http://libguestfs.org/>.
e76f14
+
e76f14
+=head1 AUTHOR
e76f14
+
e76f14
+Richard W.M. Jones L<http://people.redhat.com/~rjones/>
e76f14
+
e76f14
+=head1 COPYRIGHT
e76f14
+
e76f14
+Copyright (C) 2016 Red Hat Inc.
e76f14
-- 
7af31e
1.8.3.1
e76f14