public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: Make gmondump conform to its doc + adjust doc
@ 2021-08-02  9:25 Mark Geisert
  2021-08-03  8:04 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Geisert @ 2021-08-02  9:25 UTC (permalink / raw)
  To: cygwin-patches

The doc for gmondump says 1 or more FILENAME are expected, but 0 is
handled. That's an oversight. Make invocation with 0 FILENAMEs print a
one-line help message.

Reword the beginning of profiler's description doc to clarify target's
child processes are run but only optionally profiled.

---
 winsup/doc/utils.xml    |  7 ++++---
 winsup/utils/gmondump.c | 12 ++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/winsup/doc/utils.xml b/winsup/doc/utils.xml
index 659541f00..0b9e38549 100644
--- a/winsup/doc/utils.xml
+++ b/winsup/doc/utils.xml
@@ -2240,9 +2240,10 @@ specifying an empty password.
 
     <refsect1 id="profiler-desc">
       <title>Description</title>
-    <para>The <command>profiler</command> utility executes a given program, and
-      optionally the children of that program, collecting the location of the
-      CPU instruction pointer (IP) many times per second. This gives a profile
+    <para>The <command>profiler</command> utility executes a given program and
+      any children of that program, collecting the location of the CPU
+      instruction pointer (IP) many times per second. (It is optional to
+      collect this info from child processes.) This info gives a profile
       of the program's execution, showing where the most time is being spent.
       This profiling technique is called "IP sampling".</para>
 
diff --git a/winsup/utils/gmondump.c b/winsup/utils/gmondump.c
index e469f01f1..ec9db0598 100644
--- a/winsup/utils/gmondump.c
+++ b/winsup/utils/gmondump.c
@@ -46,6 +46,14 @@ OPTIONS are:\n\
   exit (where == stderr ? 1 : 0 );
 }
 
+void __attribute__ ((__noreturn__))
+usage1 (FILE *where)
+{
+  fprintf (where, "Usage: %s [OPTIONS] FILENAME...\n", pgm);
+
+  exit (where == stderr ? 1 : 0 );
+}
+
 void
 note (const char *fmt, ...)
 {
@@ -248,6 +256,10 @@ main(int argc, char **argv)
         ;
       }
 
+  if (optind >= argc)
+    /* Print one-line help and exit. */
+    usage1 (ofile);
+
   for (int i = optind; i < argc; i++)
     gmondump1 (argv[i]);
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Cygwin: Make gmondump conform to its doc + adjust doc
  2021-08-02  9:25 [PATCH] Cygwin: Make gmondump conform to its doc + adjust doc Mark Geisert
@ 2021-08-03  8:04 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2021-08-03  8:04 UTC (permalink / raw)
  To: cygwin-patches

On Aug  2 02:25, Mark Geisert wrote:
> The doc for gmondump says 1 or more FILENAME are expected, but 0 is
> handled. That's an oversight. Make invocation with 0 FILENAMEs print a
> one-line help message.
> 
> Reword the beginning of profiler's description doc to clarify target's
> child processes are run but only optionally profiled.
> 
> ---
>  winsup/doc/utils.xml    |  7 ++++---
>  winsup/utils/gmondump.c | 12 ++++++++++++
>  2 files changed, 16 insertions(+), 3 deletions(-)

Pushed.


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-03  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02  9:25 [PATCH] Cygwin: Make gmondump conform to its doc + adjust doc Mark Geisert
2021-08-03  8:04 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).