From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Chaloupka Subject: Re: For review: memusage(1) man page Date: Mon, 01 Sep 2014 09:22:01 +0200 Message-ID: <54041E99.5020403@redhat.com> References: <53C8E244.2080901@redhat.com> <53CE0144.7050405@gmail.com> <53CE0517.2040005@redhat.com> <53CE1BC4.6040707@redhat.com> <5401D83C.3050806@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5401D83C.3050806-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-man-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: "Michael Kerrisk (man-pages)" Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, libc-alpha-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org, myllynen-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, drepper-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, Peter Schiffer List-Id: linux-man@vger.kernel.org Hello, Michael On 08/30/2014 03:57 PM, Michael Kerrisk (man-pages) wrote: > Hi Jan, > > You resubmitted this page in the meusage(1) thread, but > it's a page for memusagestat(1). I'm getting a little > confused as I try to review these threads. Oh, sorry about that. Man pages resent with changelog. > Could I ask you to create two new threads that submit > the current memusage.1 and memusagestat.1 pages. > Along the way, could you convert the keywords in the > command lines to lowercase+italic (\fI). (See for example > the current mtrace.1 in Git.) > > My apologies for being so slow to follow up on this. No big deal. These man pages are of low priority. > > Thanks, > > Michael > > > > On 07/22/2014 10:07 AM, Jan Chaloupka wrote: >> Adding example with small C code to demonstrate progress of memory usage >> >> .\" Copyright (c) 2013, Peter Schiffer (pschiffe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org) >> .\" >> .\" %%%LICENSE_START(GPLv2+_DOC_FULL) >> .\" This is free documentation; you can redistribute it and/or >> .\" modify it under the terms of the GNU General Public License as >> .\" published by the Free Software Foundation; either version 2 of >> .\" the License, or (at your option) any later version. >> .\" >> .\" The GNU General Public License's references to "object code" >> .\" and "executables" are to be interpreted as the output of any >> .\" document formatting or typesetting system, including >> .\" intermediate and printed output. >> .\" >> .\" This manual is distributed in the hope that it will be useful, >> .\" but WITHOUT ANY WARRANTY; without even the implied warranty of >> .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> .\" GNU General Public License for more details. >> .\" >> .\" You should have received a copy of the GNU General Public >> .\" License along with this manual; if not, see >> .\" . >> .\" %%%LICENSE_END >> .TH MEMUSAGESTAT 1 2013-04-10 "GNU glibc 2.18" "Memory diagnostic tools" >> .SH NAME >> memusagestat \- generate graphic from memory profiling data >> .SH SYNOPSIS >> .BR memusagestat " [\fIOPTION\fR]... \fIDATAFILE\fR [\fIOUTFILE\fR]" >> .SH DESCRIPTION >> .B memusagestat >> can create a PNG file with graphical representation of memory profiling >> data. >> Red line in the graph shows the heap usage (allocated memory), >> green line shows the stack usage, >> x-scale number of memory handling functions calls or time (\fB-t\fR option). >> .I DATAFILE >> is a binary data file generated by >> .BR memusage (1) >> utility with >> .B -d >> option. >> .SH OPTIONS >> .TP >> .BI \-o\ file \fR,\ \fB\-\-output= file >> Name of the output file. >> .TP >> .BI \-s\ string \fR,\ \fB\-\-string= string >> Title string used in the output graphic. >> .TP >> .BI \-t\fR,\ \fB\-\-time >> Generate output linear to time >> (default is linear to number of function calls). >> .TP >> .BI \-T\fR,\ \fB\-\-total >> Also draw graph for total memory consumption. >> .TP >> .BI \-x\ size \fR,\ \fB\-\-x-size= size >> Make graphic size pixels wide. >> .TP >> .BI \-y\ size \fR,\ \fB\-\-y\-size= size >> Make graphic size pixels high. >> .TP >> .BI \-?\fR,\ \fB\-\-help >> Print help and exit. >> .TP >> .BI \fB\-\-usage >> Print a short usage message and exit. >> .TP >> .BI \-V\fR,\ \fB\-\-version >> Print version information and exit. >> .SH EXAMPLES >> Here is a simple program \fImemusagestatexample.c\fR simulating increase >> and decrease of memory usage: >> >> .RS 4 >> #include >> .RS 0 >> #include >> .RE >> .RS 0 >> #define CYCLES 20 >> .RE >> >> int main(int argc, char ** argv) { >> int i, j; >> int *p = NULL; >> printf("malloc: %d\\n", sizeof(int)*100); >> p = malloc(sizeof(int)*100); >> >> for (i = 0; i < CYCLES; i++) { >> if (i < CYCLES/2) j = i; else j--; >> printf("realloc: %d\\n", sizeof(int)*((j)*50 + 110)); >> p = realloc(p, sizeof(int)*(j*50 + 100)); >> printf("realloc: %d\\n", sizeof(int)*((j+1)*150 + 110)); >> p = realloc(p, sizeof(int)*((j+1)*150 + 110)); >> } >> free(p); >> return 0; >> .RS 0 >> } >> .RE >> .RE >> >> After compiling and running the following, you can see progress of >> memory usage (memusagestatexample.png): >> >> memusage --data=memusagestatexample.dat ./memusagestatexample >> .RS 0 >> memusagestat memusagestatexample.dat memusagestatexample.png >> .RE >> >> .SH BUGS >> For bug reporting instructions, please see: >> . >> .SH SEE ALSO >> .BR memusage (1) >> > -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html