WL#682: Memory consumption estimation for x86/32 Linux

Status: Un-Assigned   —   Priority: Medium

We currently print possible memory consumption in case of crash which does not
really makes sence in MySQL 4.0

- Innodb is now standard while its buffers are not accounted
- Now one can set variables on per connection basics
- Actually it never reported anything real as only some of connections allocate
everything needed, while some of memory consumptions are not accounted while can
be really mahor - ie temporary tables.

The  generic and so prefered way is to use status reporting function:

The call to use that works on most OS is 'getrusage', which provides
the following information (on Linux):

           struct rusage {
                 struct timeval ru_utime; /* user time used */
                 struct timeval ru_stime; /* system time used */
                 long ru_maxrss;          /* maximum resident set size */
                 long ru_ixrss;      /* integral shared memory size */
                 long ru_idrss;      /* integral unshared data size */
                 long ru_isrss;      /* integral unshared stack size */
                 long ru_minflt;          /* page reclaims */
                 long ru_majflt;          /* page faults */
                 long ru_nswap;      /* swaps */
                 long ru_inblock;         /* block input operations */
                 long ru_oublock;         /* block output operations */
                 long ru_msgsnd;          /* messages sent */
                 long ru_msgrcv;          /* messages received */
                 long ru_nsignals;        /* signals received */
                 long ru_nvcsw;      /* voluntary context switches */
                 long ru_nivcsw;          /* involuntary context switches */

We even might wish to add this function call as MySQL function as this would be
quite useful for some cases, ie for MySQL monitoring