This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] fix for process virtual size display


> Ping.
Sorry, I've been very busy recently.

I'm actually inclined to keep vmc.VirtualSize instead of vmc.PagefileUsage.
However I found this formula cited in one of the Linux man pages:
          vsize=(brk-start_code+PAGE_SIZE-1)+(TASK_SIZE-esp)
which would seem to indicate vmsize actually refers to committed memory.
With this in mind, I'm happy for this patch to be committed. Further work
may be
needed to include DLLs in that figure, however that would be a separate
patch.

Chris

>
> cgf
>
> On Fri, May 09, 2003 at 11:06:28AM -0400, Christopher Faylor wrote:
> >On Fri, May 09, 2003 at 11:04:27AM -0400, Joe Buehler wrote:
> >>I offer this trivial patch as a possible fix for "top" displaying
> >>~400 megabytes as the virtual memory size for all processes.  This
> >>happens because the WIN32 info used appears to refer to "reserved"
> >>memory, not "committed", and Cygwin processes have about 400 megabytes
> >>reserved by default (for the stack and/or heap, I forget at the moment).
> >>
> >>Whether this is the right thing to do, I don't know.  The sizes
> >>shown by "top" are now slightly smaller than the working set size.
> >>Perhaps due to the way that dlls are counted in the two numbers?
> >>
> >>Anyway, I offer this if it looks better than current behavior.
> >>
> >>2003-05-09  Joe Buehler  <jhpb@draco.hekimian.com>
> >>
> >>	* fhandler_process.cc (format_process_stat): use PagefileUsage
> >>	instead of VirtualSize
> >>	(get_mem_values): Ditto.
> >
> >Looks good to me but I'd like Chris January to comment since this is his
> >code.
> >
> >cgf
> >
> >>Index: fhandler_process.cc
> >>===================================================================
> >>RCS file: /cvs/src/src/winsup/cygwin/fhandler_process.cc,v
> >>retrieving revision 1.32
> >>diff -u -r1.32 fhandler_process.cc
> >>--- fhandler_process.cc	1 Apr 2003 16:11:41 -0000	1.32
> >>+++ fhandler_process.cc	9 May 2003 14:54:39 -0000
> >>@@ -475,7 +474,7 @@
> >> 	 start_time = (spt.KernelTime.QuadPart +
> spt.UserTime.QuadPart) * HZ
> >> 	 / 10000000ULL;
> >>        priority = pbi.BasePriority;
> >>        unsigned page_size = getpagesize ();
> >>-       vmsize = vmc.VirtualSize;
> >>+       vmsize = vmc.PagefileUsage;
> >>        vmrss = vmc.WorkingSetSize / page_size;
> >>        vmmaxrss = ql.MaximumWorkingSetSize / page_size;
> >>     }
> >>@@ -740,7 +743,7 @@
> >>       res = false;
> >>       goto out;
> >>     }
> >>-  *vmsize = vmc.VirtualSize / page_size;
> >>+  *vmsize = vmc.PagefileUsage / page_size;
> >> out:
> >>   delete [] p;
> >>   CloseHandle (hProcess);
> >>--
> >>Joe Buehler
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]